Classic encoder of 2.0 ticks per degree:
encoder_reading = int(720 / 2) or int(721 / 2) = 360
New encoder of 5.3333 ticks per degree:
encoder_reading = int( 1920/5.33333) to int( 1925/5.3333) = 360
So if I am interpreting this correctly, encoder operations in the new GoPiGo3 operate at roughly 1/5th degree precision, but the encoder reading API is still whole degree precision for +/- half degree accuracy.
Since ROS does not use methods that perform internal encoder calculations (like offset_motor_encoder() which drives till encoder value exceeds the requested encoder reading), the ROS odometry uses the +/- half degree accuracy and outputs distances with roughly +/- 0.29 mm accuracy for a calibrated GoPiGo3 (gpg3_config.json has wheel dia and wheel base to make encoder readings closely match actual distance traveled and actual angle turned).
Well it is greatly misleading number. Back when I was doing my “non-ROS” occupancy grid project, I came up with something being 2.8% of distance traveled using the encoders.
I spent part of today on calibration. Rather than use the control panel I wrote a couple of scripts using easygopigo3.py to create the gpg3_config.json file (which didn’t exist as part of the image I had downloaded) and then figure out the proper values for WHEEL_DIAMETER and WHEEL_BASE_WIDTH.
However in further testing, it doesn’t look like gopigo3 actually reads from the json file. Although it’s a bit ugly, it seems like the most straight forward workaround is to just hard code the values in the gopigo3_driver.py file in the mygopigo package. It’s not like they’re going to change a lot.
and determined my Wheel dia: 66.77mm and Wheel Base: 106.14mm
Then I updated /Dexter and the gopigo3 egg to the latest (version 1.3) which writes the json file if it does not exist, and reads it if it does.
NOTE: I first updated from the install-on-Ubuntu branch, but after hours of wondering why it wasn’t creating or reading the gpg_config.json file, I updated from the master branch and got version 1.3…
Then I manually edited the numbers from the wheelDia and wheelBase tests into the file.
The other approach is to use ROS parameters with default values. Once I get everything working with my ROS2 gopigo3_node, I am contemplating setting up somethings as parameters.
But I’m conflicted by the mix of gopigo3 configuration with ROS configuration. ROS doesn’t realize that the latest gopigo3 code is setting things that my “16 tick” bot must have configured correctly or all the ROS speeds and distances will be wrong.
For the older 6 tick bots, after the GoPiGo3 object is instantiated:
These GoPiGo object values have to be set if the load_robot_constants() is not called (older gopgio3.py version 1.2):