Gazebo | Ignition | Community
Ask Your Question

Apply angular velocity to wheel via plugin

asked 2016-07-23 10:07:18 -0500

Hanteus gravatar image

Hi, I'm trying to implement a skid steer plugin (I can't use the already implemented one), but I have some problems. I was able to apply a linear velocity to the whole model using:

this->model = _parent;
model->SetLinearVel(math::Vector3(.03, 0, 0));

but I wasn't able to select one of the wheels (also which is the type of a link element?) nor to apply an angular velocity to it. I've tried with this:

left_front_wheel = _parent->GetEntityByName("left_front_wheel");

This is the SDF of one of the wheels:

        <joint type="revolute" name="right_back_wheel_hinge">
        <pose>0 0 0 0 0 0</pose>
            <xyz>0 1 0</xyz>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-24 10:27:26 -0500

Hanteus gravatar image

updated 2016-07-25 03:40:54 -0500

I was able to do it with the following lines of code:

private: physics::JointPtr leftFrontWheelJ,oint;

this->model = parent;
leftFrontWheelJoint = this->model->GetJoint("left_front_wheel_hinge");
leftFrontWheelJoint->SetVelocity(0, .1);

The parameters of SetVelocity are the index of the axis on which you want to apply the velocity and the velocity itself (I write this for people who may have my same problem).

edit flag offensive delete link more


Have a look at It is a plugin that applies each of the two wheels of a differential drive robot a velocity received on vel_cmd topic. The code has two standalone programs to test if it works. You can also check the model where it was tested. Cheers!

guido_sanchez gravatar imageguido_sanchez ( 2016-11-16 08:17:54 -0500 )edit

Question Tools

1 follower


Asked: 2016-07-23 10:07:18 -0500

Seen: 1,017 times

Last updated: Nov 16 '16