Machine with four wheels, how can I find the velocity of the left and ride side of the machine independently?

asked 2018-07-27 08:57:43 -0500

MRhinelander gravatar image

updated 2018-07-27 10:05:06 -0500

I have a four wheeled differential driving machine. I am writing a plugin that requires turn rate. Is there a way to find the velocity of a specific wheel in a machine?

Here is my Turn Rate Method.

    int32_t calcTurnRate()
    {
        //Define pointers to front left and front right wheels
        gazebo::physics::LinkPtr RWheel = this->model->GetChildLink(
                "base_link::Rwheel_chassis::front_right_wheel");
        gazebo::physics::LinkPtr LWheel = this->model->GetChildLink(
                "base_link::Lwheel_chassis::front_left_wheel");

        //Components of Wheel Velocities
        int32_t RVel = RWheel->GetRelativeLinearVel().x;
        int32_t LVel = LWheel->GetRelativeLinearVel().x;

        //return turn rate
        return (RVel- LVel) * (WHEELBASE / 2);
    }
edit retag flag offensive close merge delete