Argh ... Discovered bug in C++ GoPiGo3 with 16 tick motors

When the serial_numbers.pkl file was introduced for 16 tick motors, I added the serial lookup to the C++ GoPiGo3 API (GoPiGo3.cpp and header file), and I tested that the TICKS_PER_REVOLUTION indeed got set to 16 for GoPiGo3 boards that were known to have shipped with the 16 tick motors (Dave was one).

I also created a “C++ Drive your GoPiGo3 with keyboard” example at that time.

My Pull Request for the changes was accepted Dec 2022.

l have been testing the new GoPiGo3 Install methods, and I noticed that the C++ GoPiGo3 API ENCODER_TICKS_PER_DEGREE for Dave (16 tick motors) is 5.333 but the variable is of type integer. OOPS…

I decided to compare the Python Motor_Follow.py example and the C++ motors.cpp example, and discovered the encoder values in the C++ example are wrong going forward and totally off going backwards.

Update: Thanks to Claude for finding a wrong type conversion. C++ is so arcane after 30 years of Python and Java.

1 Like