Robotics StackExchange | Archived questions

How to get instantaneous velocity value when using gazebo ros_diff_drive plugin

I am using the following gazebo plugin to model a diff drive mobile robot in gazebo and then doing a PID for velocity control of the mobile robot.

I understand that in order to do a PID controller for the movement, i need to sense the current velocity of the robot. and get the error between that and the reference velocity.

Problem is then how do I get the current velocity?

<gazebo>
    <plugin name="next_controller" filename="libgazebo_ros_diff_drive.so">
      <commandTopic>cmd_vel</commandTopic>
      <odometryTopic>odom</odometryTopic>
      <odometryFrame>odom</odometryFrame>
      <robotBaseFrame>base_link</robotBaseFrame>
      <publishWheelTF>false</publishWheelTF>
      <publishWheelJointState>true</publishWheelJointState>
      <legacyMode>false</legacyMode>
      <updateRate>100</updateRate>
      <leftJoint>wheel_left_joint</leftJoint>
      <rightJoint>wheel_right_joint</rightJoint>
      <wheelSeparation>0.343</wheelSeparation>
      <wheelDiameter>0.164</wheelDiameter>
      <wheelAcceleration>1</wheelAcceleration>
      <wheelTorque>10</wheelTorque>
    </plugin>
</gazebo>

Asked by someonekarl on 2018-11-30 00:31:41 UTC

Comments

Answers