0
$\begingroup$

Rosanswers logo

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?


Originally posted by miguel on ROS Answers with karma: 170 on 2015-05-27

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Humpelstilzchen with karma: 1504 on 2015-05-27

This answer was ACCEPTED on the original site

Post score: 5


Original comments

Comment by gvdhoorn on 2015-05-27:
I would personally go for something like the ros_control diff_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.

Comment by miguel on 2015-05-27:
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.

Comment by Humpelstilzchen on 2015-05-27:
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.

Comment by miguel on 2015-05-28:
Oh ok. I dont just need to teleop. I am doing an autonomous 2D mapping robot so i will have to look into this.

Comment by miguel on 2015-06-02:
So this example code what units would the speed be in?

Comment by Humpelstilzchen on 2015-06-02:
default unit for ros is linear: m/s, angular: rad/s

Comment by kwiesz91 on 2015-10-26:
Is that suppose to be "+ cmd_vel.speed" at the end of the first line instead of just "+ cmd_vel"?

Comment by miguel on 2015-10-26:
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.

Comment by Humpelstilzchen on 2015-10-26:
kwiesz91: yes, fixed. Basically it is the usual two-wheel odometry equation solved for left and right motor.

Personally, I use this on an AVR so the main CPU doesn't need to calculate the odometry.

Comment by Jo_Han_Solo on 2017-10-26:
@Humpelstilzchen the distance you're talking about above with the 25.2cm, would that mean that he calculations you are doing would always be in (cm) measurements?

Comment by Humpelstilzchen on 2017-10-26:
I do them in m, because I find its always the best do stay with si-units. The equations should work with cm, if you divide the result with 100. Just make sure you always use the same units.

Comment by Jo_Han_Solo on 2017-10-29:
@Humpelstilzchen thanks for your reply, I ended up doing them in SI units already last week and they seem to work just fine as they are now.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.