ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Basic Robot Methods? (turn_degrees, drive_cm, dist traveled)

asked 2021-11-03 12:15:38 -0500

RobotDreams gravatar image

updated 2021-11-03 12:16:24 -0500

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?

edit retag flag offensive close merge delete

Comments

1

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 with Twists going to /cmd_vel indeed.

gvdhoorn gravatar image gvdhoorn  ( 2021-11-03 13:30:47 -0500 )edit

Nav2 would be overkill, these would all be trivial to implement in an hour a piece or less.

stevemacenski gravatar image stevemacenski  ( 2021-11-08 15:50:07 -0500 )edit

It would be overkill, but allow for a seamless transition to more complex planning problems.

gvdhoorn gravatar image gvdhoorn  ( 2021-11-09 02:20:29 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-11-11 11:19:55 -0500

RobotDreams gravatar image

As no one pointed me to anything specific, I chose to tackle building a "Robot Independent" odometer node in discrete Python by watching the /odom topic for start and end of motion and tallying the 3D distance traveled of each update between the start and end of motion. (I learned that not all robots publish encoders on the same topic and message format, where most are publishing odometry using a standard message format.)

After the fact, I found this code example (publishing the distance where I am using Python logging out to a file):

https://www.theconstructsim.com/ros-q...

Perhaps if my bagging skills were better I would log the distance segments to a topic and bag them to an odometer bag.

The other two methods, drive_cm() and turn_degrees() are indeed easy to implement but as mapping and navigation are next on my learning path, I expect I will find the "ROS way" for these I am sure someone has coded before.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-11-03 12:15:38 -0500

Seen: 88 times

Last updated: Nov 11 '21