Gazebo | Ignition | Community
Ask Your Question

Plugin to subscribe to nav_msgs/Odometry messages

asked 2016-08-17 14:28:01 -0500

blastpower5 gravatar image

Hi guys,

I am trying to control the movement of a robot inside Gazebo by publishing Odometry messages. I have already written the publisher, but now I'm looking for a way for the robot to subscribe to the topic and follow the commands. I'm not sure if I should be using a plugin (which I haven't found yet) or writing my own subscriber. If I am supposed to write my own subscriber, how should I link it to the robot in Gazebo to control it.

Any help is appreciated, thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-08-20 06:29:57 -0500

Hanteus gravatar image

Hi, you have two options, you can use one of the plugins provided by GAZEBO or create a custom one. In the first case, depending on the kinematic that you want, you can use one of the plugin you can find HERE.

In the second case follow THIS tutorial if you publish from ROS or THIS one if you publish from GAZEBO (it's for a transport message but you can easly change it).

I'll also leave here this piece of plugin I'm working on since I had an hard time figuring out how to move the wheels and I think that it could come you handy if you choose the second option:

    // Pointers to the joints of the wheels
    physics::JointPtr leftFrontWheelJoint, rightFrontWheelJoint, leftBackWheelJoint, rightBackWheelJoint;
    // Store the pointer to the joints of the wheels
    leftFrontWheelJoint = this->model->GetJoint("left_front_wheel_hinge");
    // Set the velocity (the first parameter specify the axis of the rotation)
    leftFrontWheelJoint->SetVelocity(0, leftFrontWheelVelocity);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-08-17 14:28:01 -0500

Seen: 922 times

Last updated: Aug 20 '16