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

Revision history [back]

click to hide/show revision 1
initial version

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., axis 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;
}

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., axis 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;
}