Jetson 4GB Waveshare JetBot - PS3 Control Python Code

Hello Friends
Can some one help me with the Python code to increase speed, decrease speed, left, right controlling through PS3 joystick in teleoperation code provided in Jupyter Notebook ? the pre-built Jetbot comes with examples under teleoperation, but that code just runs the motors fast in forward direction. If some one can share your Python code which can be added in the Jupyter notebook will be great help

Hi @anbukumar73 ,

Thanks for reaching out!

To lower the speed with Python you could modify the lines of code where you connect the joystick to the robot motors.

For example,

speed = 0.5

left_link = traitlets.dlink((controller.axes[0], 'value'), (robot.left_motor, 'value'), transforms=lambda x: - speed * x)
right_link = traitlets.dlink((controller.axes[1], 'value'), (robot.left_motor, 'value'), transforms=lambda x: - speed * x)

Most importantly, notice the transform=lambda x: - speed * x. This takes in the original value, and multiplies it by speed, and then passes the returned value to the motors.

Let me know if this helps or you have any questions.

Best,
John

Dear John
Appreciate your inputs, however if you look at the Teleoperation code in examples notebook, I cannot turn the jetbot to left or right with the joystick. example code works only forward and backward. Could you please help with the code to insert Left and Right controls ?

Hello John
Could you please help me understand what value should I input in this code in order to increase or decrease the speed using PS3 JoyStick ?

transforms=lambda x: - speed * x