Open tame0001 opened 8 months ago
I think we can probably use the ROS built-in Timer
class? It's able to run a callback on a loop which is what we want here, and it doesn't block the process when doing so.
More requirements:
Send error messages. Check check_error
function on this file: https://github.com/boilerrobotics/rover-code/blob/odrive-telemetry/components/odrive/utils.py
Test with subscriber -> https://github.com/boilerrobotics/base-station/issues/3. It is not required to run both code in two separated machines. You can run both in the same machine on the different terminals.
[optional] It will be more convenient if we can run and test the code with only 1 ODrive at a time. Function find_odrives
in this file https://github.com/boilerrobotics/rover-code/blob/odrive-telemetry/components/odrive/utils.py experiment on that concept. If you think it work, try to add in to the package
We need to add a function periodically read Odrive value. Let's start with voltage , current. These two parameters are Odrive basic. So, there will be 6 values. Next, it would be nice to experiment with other parameters. I don't have done this before, so I can only point to potential parameters. mechanical power, electrical power, estimated velocity.
We will need to create a custom message for these parameters. The structure of the message is debatable. As well as the topic name. I am open to hearing what you think.
The challenge is we probably cannot write a dedicated package for this task since
drive
occupies the Odrive abstract. We need to add this function intodrive
package (still okay to write another file then import todrive
's main file. We will need to create a periodical task but how to do that in the most effective way is still a question. Usingtime.sleep()
is probably not a good idea as it will block the process. Let's think about it.The end goal is to send this information as a topic to the base station. Then I will run MQTT bridge on the base station and pass this data to GUI.