Gamepad teleoperation for the Jetracer

I have my Jetbot teleoperation working fine using an XBox gamepad through my PC.
I also have a Jetracer that I can control manually with my R/C hand controller.
However it would be nice to be able to teleoperate the Jetracer with a gamepad through the PC, like with the Jetbot, instead of using the Jetracer web interface and a mouse.
Has anyone successful driven the Jetracer with a gamepad though their PC instead of using a mouse?
I can probably modify the Jetracer py code using the Jetbot teleoperation py code, but I hate reinventing the wheel if someone else has already successfully done so.
Regards,
TCIII

This is certainly do-able. I believe we avoided the use of the gamepad for JetRacer because JetRacer is much faster than JetBot. The latency / uncertainty in wifi networking may cause some trouble and we didn’t want to see people break their cars. This is why we opted for using the direct RC controller for manual control and override.

That said, assuming you accept the risks in this approach, you can easily link the gamepad controller axes to the JetRacer values just like in JetBot. For example,

traitlets.dlink((controller.axes[0], 'value'), (car, 'steering'), transform=lambda x: 0.5 * x)  # link controller 0.5 * controller axes 0 value to car steering
traitlets.dlink((controller.axes[1], 'value'), (car, 'throttle'), transform=lambda x: 0.3 * x)  # link 0.3 * axes 1 value to throttle

Please note, I’ve chosen arbitrary controller axes and scaling values. You’ll want to adjust the scaling constants and controller axes to fit your needs.

Please let me know if this helps or you have any questions.

Best,
John

1 Like

@jaybdub,

Thank you for the response, much appreciated.

I will take a look at what you have suggested to modify and get back to you if I have any issues or to how it performs.

Regards,
TCIII