Modify jetbot libraries

Hello!

I want to modify robot.py to change the the I2C bus from 1 to 0, and modify the robot.forward function because my jetbots wheel motors aren’t spinning perfectly in same speed so the bot is making an arc move with forward command. Whats the best way to modify jetbot libraries? I have already achieve this by modifying the /usr/local/lib/python3.6/dist-packages/jetbot-0.4.1-py3.6.egg/jetbot/robot.py file inside the jupyter container. But surely there must be a better way?

Basic info:
Hardware: Jetson Nano 4GB
Software: Installed Jetpack 4.4.1, jetbot 0.4,1 (installed w this tutorial: Using Docker Container - JetBot)

OT: You have a great product, ordered another nano!

Hey bhepatiitti,

Thanks for reaching out!

You may not need to modify the library itself to accomplish this. One way to alleviate this is to tune the motor gains.

The value sent to the motors is y = alpha * x + beta. By default, alpha = 1 and beta = 0.

You could do

robot.left_motor.alpha = 0.9
robot.right_motor.alpha = 1.1

Or something similar. Please note, with an open loop system (which JetBot forward function is) you will inevitably see some arc.

To adjust the i2c bus,

robot = Robot(i2c_bus=0)

Please let me know if this helps, or you run into any issues.

Best,
John

Yes this worked and surely it’s much more better way to solve this :)