NVIDIA-AI-IOT / jetbot

An educational AI robot based on NVIDIA Jetson Nano.
MIT License
2.98k stars 1.02k forks source link

Jetson Nano Jetbot Jupyter Teleoperation Notebook - Unable to connect Logitech F710 #104

Closed ARLunan closed 2 years ago

ARLunan commented 5 years ago

While I successfully connected this F710 gamepad set to "X" mode to a Jetbot (SD flashed with full 64 GB image) with the Controller registered at /dev/input/js0 as indicated by running "jstest" and "jstest-gtk", and

jetbot@jetbot:~$ ls -l /dev/input/js* crw-rw-r--+ 1 root input 13, 0 Jul 9 20:05 /dev/input/js0

jetbot@jetbot:~$ dmesg | grep Logitech [ 9.024635] usb 1-2.2: Manufacturer: Logitech [ 9.142803] usb 1-2.4: Product: Logitech Cordless RumblePad 2 [ 9.142806] usb 1-2.4: Manufacturer: Logitech [ 9.145635] hid-generic 0003:046D:C22F.0004: hidraw0: USB HID v1.11 Device [Logitech Logitech Cordless RumblePad 2] on usb-70090000.xusb-2.4/input0 [ 9.147602] hid-generic 0003:046D:C22F.0005: hidraw1: USB HID v1.11 Device [Logitech Logitech Cordless RumblePad 2] on usb-70090000.xusb-2.4/input1 [ 9.976788] logitech-djreceiver 0003:046D:C52B.0003: hidraw2: USB HID v1.11 Device [Logitech USB Receiver] on usb-70090000.xusb-2.2/input2 [ 10.149106] input: Logitech K400 Plus as /devices/70090000.xusb/usb1/1-2/1-2.2/1-2.2:1.2/0003:046D:C52B.0003/0003:046D:404D.0006/input/input2 [ 10.195240] logitech-hidpp-device 0003:046D:404D.0006: input,hidraw3: USB HID v1.11 Keyboard [Logitech K400 Plus] on usb-70090000.xusb-2.2:1 [ 15.416493] usb 1-2.4: Manufacturer: Logitech [ 15.418012] input: Logitech Gamepad F710 as /devices/70090000.xusb/usb1/1-2/1-2.4/1-2.4:1.0/input/input3 jetbot@jetbot:~$

Rebooted the Nano Jetson and the usual updates: sudo apt-get update, upgrade, list-upgrade, and "rsync jetbot/notebooks ~/Notebooks

[u]However running the [b]Teleoperation Notebook with index (1) or (0), no action.[/b][/u]

I would appreciate any diagnostic steps.

[b]My Diagnostic Actions[/b] I confirmed that the Jetbot appears properly configured as the Basic_Motion Notebook works actuating the motors from a remotely connected Jupyter Notebook.

Here's the Jupiter Teleoperation Notebook sequence from my Mac Safari Browser connected to the Nano Jetbot:

Create gamepad controller

The first thing we want to do is create an instance of the Controller widget, which we'll use to drive our robot. The Controller widget takes a index parameter, which specifies the number of the controller. This is useful in case you have multiple controllers attached, or some gamepads appear as multiple controllers. To determine the index of the controller you're using,

Visit http://html5gamepad.com.

Press buttons on the gamepad you're using Remember the index of the gamepad that is responding to the button presses Next, we'll create and display our controller using that index.

import ipywidgets.widgets as widgets

controller = widgets.Controller(index=1) # replace with index of your controller

display(controller)

Connect gamepad and press any button. Even if the index is correct, you may see the text Connect gamepad and press any button. That's because the gamepad hasn't registered with this notebook yet. Press a button and you should see the gamepad widget appear above.

[b] Nothing happens here[/b]

from jetbot import Robot import traitlets

robot = Robot()

left_link = traitlets.dlink((controller.axes[1], 'value'), (robot.left_motor, 'value'), transform=lambda x: -x) right_link = traitlets.dlink((controller.axes[3], 'value'), (robot.right_motor, 'value'), transform=lambda x: -x)


IndexError Traceback (most recent call last)

in 4 robot = Robot() 5 ----> 6 left_link = traitlets.dlink((controller.axes[1], 'value'), (robot.left_motor, 'value'), transform=lambda x: -x) 7 right_link = traitlets.dlink((controller.axes[3], 'value'), (robot.right_motor, 'value'), transform=lambda x: -x) IndexError: tuple index out of range Awesome! Our robot should now respond to our gamepad controller movements. Now we want to view the live video feed from the camera! The Notebook cells that follow show that the Camera image functions work correctly Further, 1) running https://html5gamepad.com displays the F710 id name, proper button and joystick operation. The name is Logitech Wireless Gamepad F710(Standard GAMEPAD Vendor 046d Product c21f. 2) On the Nano desktop Chrome Browser: https://gamedevelopment.tutsplus.com/tutorials/using-the-html5-gamepad-api-to-add-controller-support-to-browser-games--cms-21345 has an html Demo that correctly reads the gamepad and displays the Button and Joystick status: Gamepad connected! id: Logitech Wireless Gamepad F710 (STANDARD GAMEPAD Vendor: o4gd Product c21f Button1...... . . Stick 1:0, -0.00000061.... Stick 2:0, -0.00000061...
ARLunan commented 5 years ago

Solved by 1) Connecting F710 Usb dongle on the Remote Laptop that is used to access the Nano , and 2) edit Teleoperation Notebook Index=0, from the default=1.