I am glad to hear that it seems to be working now!
I made a mistake earlier and was not correctly comparing the software posted on GitHub and in the user’s guide to what we are actually loading on the robots during production. In production we have been loading an older version of the software that had different code for using the proximity sensors, including not having the total_counts function which combined with mixing up the files explains the issues you were having. I will edit my earlier post to reflect this. Regardless though, as a general guideline, backing up your programs somewhere out of the way and updating the robot’s firmware by following the instructions in the user’s guide is a good starting point to troubleshoot problems like these.
Here are answers to your new questions:
- The
polyfunction is ultimately inherited from the framebuf library built into Micropython. The other commands you mentioned are defined inzumo_2040_robot\_lib\sh1106.py.
- The
machinelibrary is built into MicroPython. (It is specific to MicroPython and not part of Python). You can find more information it in MicroPython documentation.
-
It is probably not practical to go over where all of the numbers in our Zumo software come from, but you are welcome to ask about the ones you are working with and that you are unable to figure out from reviewing the code and comments in it.
max_speedbeing 6000 makes the full range of motor speeds (0-100%) available, so you can reduce it if you want the maximum motor speed to be lower, but increasing the value will not increase the maximum motor speed. You can look atzumo_2040_robot\motors.pyto see how the motor functions work.kpandkdare the PID (Proportional–integral–derivative) controller constants. (gyro_turn.pydoes not use an integral term.) In our example programs that use PID control, the default values that should generally work okay based on our experimentation, but there might be room for optimization depending on your particular robot and what you specifically are aiming to achieve (i.e your desired tradeoff between responsiveness and accuracy).
- Patrick
