Gazebo | Ignition | Community
Ask Your Question

Not subscribing cmd_vel/geometry_msgs/Twist

asked 2014-12-11 04:32:05 -0500

anonymous gravatar image

updated 2014-12-11 06:31:31 -0500

AndreiHaidu gravatar image

Hi, I am using rosenabledmodel plugin with ros groovy . With the help of ros I am publishing cmd_vel geometry_msgs/Twist. I am able to publish the cmd_vel but on gazebo side subscriber is not working . Can anybody plz explain why it is not subscribing. Here is my code

public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)                
 node=new ros::NodeHandle("~");
 ros::SubscribeOptions so=ros::SubscribeOptions::create<geometry_msgs::Twist>("/cmd_vel", 1,boost::bind(&ModelPush::ROSCallback_Vel, this, _1),ros::VoidPtr(),node->getCallbackQueue());



void ROSCallback_Vel(const geometry_msgs::Twist::ConstPtr &msg)

 ROS_INFO("I heard");

 ROS_INFO("I received odom: [%lf,%lf,%lf,%lf,%lf, %lf]",msg->linear.x,msg->linear.y,msg->linear.z,msg->angular.x,msg->angular.y,msg->angular.z);

 double velocity=msg->linear.x;

 double angularVelocity=msg->angular.z;
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-12-11 06:35:47 -0500

AndreiHaidu gravatar image


you might need to call


in the update loop. Or use and asynchronous spinner. Here are some spinning tutorials.

Cheers, Andrei

edit flag offensive delete link more


Ya its working now. Thanks!.

anonymous gravatar imageanonymous ( 2014-12-11 23:22:40 -0500 )edit

When you say update loop, you mean the 'on update' function that is attached to ConnectWorldUpdateBegin?

JuliusS gravatar imageJuliusS ( 2016-07-08 11:51:49 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2014-12-11 04:32:05 -0500

Seen: 2,209 times

Last updated: Dec 11 '14