RPi Pico diff drive, what motor data to HW interface?
I'm currently attempting to write a complete "library" for the RPi Pico, running Micro-ROS, for controlling a differential drive robot.
I'm copying and taking inspiration from these existing Arduino/ RPi projects:
ROS2 Control hardware interface
Basically, the first project is a motor driver/ PID controller, running on an Arduino. The second is running on an RPI, communicating via ROSserial (?). The hardware interface on the Pi requests encoder counts from the Arduino, thereby computing wheel velocity and position, before sending that data to ROS2 Control. In return, the hardware interface transmits motor speed commands to the motor driver on the Arduino. At least that is my naive/ oversimplified understanding.
For my Pico implementation, I would prefer to do all relevant computation on the Pico. I see no problem in computing wheel velocity and positions, and send them to the hardware interface via a custom ROS2 topic/ message, or perhaps a service if that is more suitable.
However, I don't know if there is a "convention", or expectation, that the hardware interface should receive encoder data only.
What would you do?
Asked by Ross Botman on 2023-08-04 05:32:55 UTC
Answers
I will follow the excellent recipe given by Josh Newans:
https://www.youtube.com/watch?v=J02jEKawE5U
Basically the Pi/ HW Interface will get the total encoder counts since Pico bootup. Compute position
in radians, and velocity
in radians/ second. Store values in Wheel
instances.
I will use a ROS2 service for communication, instead of the read_encoders()
function that Newans use in his Arduino serial communication. Service server on the Pico, client on the Pi.
Asked by Ross Botman on 2023-08-05 14:54:32 UTC
Comments