Basic Robot Methods? (turn_degrees, drive_cm, dist traveled)
How best to achieve the following basic robot methods in ROS2 (foxy and galactic both):
- turn_degrees() --> pub /cmd_vel until /odom heading change achieved?
- drive_cm() --> pub /cmd_vel until /odom x change achieved?
- log distance traveled by robot --> (sum of absolute value of average of left and right encoder changes)?
Or are there ROS2 packages that implement these as services or actions?
I'm not aware of any packages specifically, but perhaps Nav2 can be configured such that it could do these things @stevemacenski (it's a bit overkill, but would be the easiest to scale up to actual navigation)?.
Alternatively: this sounds like a basic position controller closing the loop over the
/odom
topic withTwist
s going to/cmd_vel
indeed.Nav2 would be overkill, these would all be trivial to implement in an hour a piece or less.
It would be overkill, but allow for a seamless transition to more complex planning problems.