Ask Your Question

How to Split /cmd_vel into left and right wheel of 2WD robot?

asked 2019-09-26 13:12:49 -0500

atul0532 gravatar image

Hi All Can you please help me writing the equation to split the velocity on left and right wheel of a differential robot from the /cmd_vel? I want to take smooth turns i.e both wheel should rotate in forward direction but at different speed while taking curves /turns

Equation which I encountered till now simply splits the velocity in which one wheel moves in clockwise Direction and other anticlockwise while taking turns.

Any help will be greatly appreciated.

edit retag flag offensive close merge delete


It sounds like you're actually asking about the kinematics of a differential drive robot.

There are a few Q&As about that already here on ROS Answers. Take a look at #q244540 and the resources linked from that answer for instance.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-26 13:17:06 -0500 )edit

@gvdhoorn I have seen the post. But unfortunately most of the link for the useful resources are not opening expect the YouTube video. Since I have lack of time can please share me link to a blog or documentation from where I can get a good idea.


atul0532 gravatar image atul0532  ( 2019-09-26 14:53:28 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-09-26 13:53:15 -0500

@gvdhoorn is right, this is a topic with an abundance of documentation in the community and simple geometry.

With that said this is how

vel_l = ((msg.linear.x - (msg.angular.z * self.wheel_bias / 2.0)) / self.wheel_radius) * 60/(2*3.14159)
vel_r = ((msg.linear.x + (msg.angular.z * self.wheel_bias / 2.0)) / self.wheel_radius) * 60/(2*3.14159)
edit flag offensive delete link more


Thanks @stevemacenski. I am noob in this field. Can you tell me the reason of multiplying the equation by (60/(2*3.14))

atul0532 gravatar image atul0532  ( 2019-09-26 14:51:28 -0500 )edit

That's conversion between rad and RPM. You dont need that if you dont need RPM

stevemacenski gravatar image stevemacenski  ( 2019-09-26 15:56:24 -0500 )edit

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: 2019-09-26 13:12:49 -0500

Seen: 1,190 times

Last updated: Sep 26 '19