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

cmd_vel linear and angular relationship

asked 2014-11-17 15:28:10 -0600

MarkyMark2012 gravatar image

Hi All,

I'm using rqt robot steering to output cmd_vel message which I subscribe to and they control the power of the motors.

Linear is fine and +/-100% is controlling the motors fed and reverse okay. How should I combine that with the rotational input such that the effect is to increase or decrease the rate of turn? Just something simple is fine, this is a 2 wheeled robot.

The examples I keep finding on the internet seem to be simple key based designs. i.e. F=Fwd/L=Left etc...

Many Thanks

Mark

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
4

answered 2014-11-17 19:32:43 -0600

kramer gravatar image

updated 2014-11-18 01:53:23 -0600

I think the following is what you're looking for. I'm not familiar with rqt's robot steering, so I'm assuming you're using geometry_msgs/Twist messages. If so, and assuming a differential drive robot, the usual method requires knowledge of the wheel separation (i.e., axle length) and wheel diameters.

void twistCb(geometry_msgs::TwistConstPtr &msg) {
  transVelocity = msg->linear.x;
  rotVelocity = msg->angular.z;
  double velDiff = (wheelSep * rotVelocity) / 2.0;
  double leftPower = (transVelocity + velDiff) / wheelRadius;
  double rightPower = (transVelocity - velDiff) / wheelRadius;
}
edit flag offensive delete link more

Comments

Thanks Kramer - steering passes through rad/s so I can convert that m/s (v = ωr)

MarkyMark2012 gravatar image MarkyMark2012  ( 2014-11-18 03:51:40 -0600 )edit
0

answered 2014-11-17 15:43:43 -0600

MarkyMark2012 gravatar image

Actually if I add of subtract (left or right) cos of the angle that should work yes?

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2014-11-17 15:28:10 -0600

Seen: 2,521 times

Last updated: Nov 18 '14