Ask Your Question
0

cmd_vel/Twist Transform Twist Message into Left and Right motor commands

asked 2015-05-27 01:13:49 -0500

miguel gravatar image

Hi There,

I have a six wheeled wild thumper that I am using for my final year project for university. I need to transform the linear.x and angular.z velocities into left and right motor commands.

Have you any idea how this is possible?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2015-05-27 02:33:15 -0500

Humpelstilzchen gravatar image

updated 2016-08-13 14:11:13 -0500

The default wild thumper can not measure its speed, which is required. Did you add encoder to the motors?

You basicly need to transform the linear and angular velocity into speeds for the left and right motors, something like

float speed_wish_right = (cmd_vel.angle*WHEEL_DIST)/2 + cmd_vel.speed;
float speed_wish_left = cmd_vel.speed*2-speed_wish_right;

with WHEEL_DIST as the distance between left and right wheels (25.2cm on my wild thumper), cmd_vel.angle is the angular z component and cmd_vel.speed the linear x component.

edit flag offensive delete link more

Comments

I would personally go for something like the ros_controldiff_drive_controller, as that does all these things for you - and more.

Of course, this does not remove the need for encoders, as @Humpelstilzchen already noted.

gvdhoorn gravatar imagegvdhoorn ( 2015-05-27 03:11:37 -0500 )edit

Thank you so much for the reply.

I have a motor controller that gives the robot a speed from 0-255 using PWM. Does this count for a measure of the speed? I am although going to be using a camera to estimate the motion using optical flow for odometry.

miguel gravatar imagemiguel ( 2015-05-27 10:20:30 -0500 )edit

This will be very difficult, most ros packages expect that you satisfy their velocity. But if you e.g. just want to teleop it doesn't really matter.

Humpelstilzchen gravatar imageHumpelstilzchen ( 2015-05-27 11:33:35 -0500 )edit

Oh ok. I dont just need to teleop. I am doing an autonomous 2D mapping robot so i will have to look into this.

miguel gravatar imagemiguel ( 2015-05-28 11:22:31 -0500 )edit

So this example code what units would the speed be in?

miguel gravatar imagemiguel ( 2015-06-02 08:10:51 -0500 )edit

default unit for ros is linear: m/s, angular: rad/s

Humpelstilzchen gravatar imageHumpelstilzchen ( 2015-06-02 14:46:15 -0500 )edit

Is that suppose to be "+ cmd_vel.speed" at the end of the first line instead of just "+ cmd_vel"?

kwiesz91 gravatar imagekwiesz91 ( 2015-10-26 14:19:17 -0500 )edit

Im not too sure about that, I landed up using the differential_drive ( http://wiki.ros.org/differential_drive ) package which does it for you.

miguel gravatar imagemiguel ( 2015-10-26 14:37:30 -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

2 followers

Stats

Asked: 2015-05-27 01:13:49 -0500

Seen: 4,639 times

Last updated: Aug 13 '16