0
$\begingroup$

Rosanswers logo

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


Originally posted by MarkyMark2012 on ROS Answers with karma: 1834 on 2014-11-17

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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;
}

Originally posted by kramer with karma: 1470 on 2014-11-17

This answer was ACCEPTED on the original site

Post score: 4


Original comments

Comment by MarkyMark2012 on 2014-11-18:
Thanks Kramer - steering passes through rad/s so I can convert that m/s (v = ωr)

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.