Hi, I am using ros_enabled_model 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());
cmd_vel_sub=node->subscribe(so);
}
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;
}
Originally posted by anonymous on Gazebo Answers with karma: 11 on 2014-12-11
Post score: 0