Ask Your Question

robot pose slightly off when publishing to /cmd_vel

asked 2015-03-13 17:53:31 -0500

SSJ gravatar image


I have been trying to build a very basic template of motion of a robot in a coordinate system. I want to implement basic functions like move_forward, move_back, move_right and move_left giving in as parameters the distance for the robot to move.

I have two questions :- 1. When I try using basic actionlib communication architecture and publish 'Twist' messages and latch for a particular time (after adjusting speed to move a unit distance) , I am able to move the robot but the final pose of the robot is always slightly off than what is expected. For example - i expect the robot to move to (3,0) from (0,0) but the actual coordinates read (2.9,-1.6e-12). Whats going wrong ?

2.I am a newbie. Currently, I am using stage_ros with custom world files to model my robot, and a very simple actionlib server-client architecture for publishing to topics. Is there any better package i could use ? I would really appreciate any pointers.


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-03-15 14:42:18 -0500

ahendrix gravatar image

I'm not sure why or how you're using actionlib; can you share a bit of your code?

The trouble here is that, due to the time it takes for the robot to accelerate and decelerate, friction, minor timing errors, and wheel slip, the robot won't move exactly 3 meters if you send it a velocity command of 1m/s for 3 seconds. What you're doing is called open-loop control.

The solution to this is to do closed-loop control; that is, to create a feedback loop between the desired and actual position of the robot, and to send velocity commands which reduce that error. For a first version, you can subscribe to the robot's position on the odometry topic. This will give you the robot's position according to the wheel encoders, which will compensate for acceleration, friction and timing errors, but won't compensate for wheel slip. Compensating for wheel slip is much harder, because you need some sort of map and localization or SLAM.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-03-13 17:53:31 -0500

Seen: 633 times

Last updated: Mar 15 '15