ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

subscribing to data from gazebo plugin

asked 2012-01-11 10:27:57 -0500

hmmm gravatar image

updated 2012-01-12 01:58:58 -0500

hello,i would like to subscribe the hight information and the orientation information of the plugin,that is included within the urdf-file. here the included part :

  <controller:gazebo_ros_p3d name="quadro_groundtruth_sim" plugin="">
    <interface:position name="my_box_p3d_position_iface" />

how can i subscribe this hight information and the orientation information within a node? i tried following.But i don't know how to proceed.

#include "ros/ros.h"
#include "std_msgs/String.h"
#include "gazebo_ros_p3d.h"      // is that the header i have to include???

void chatterCallback(const std_msgs::String::ConstPtr& msg)
  ROS_INFO("I heard: [%s]", msg->data.c_str());

int main(int argc, char **argv)

  ros::init(argc, argv, "listener");      
  ros::NodeHandle n;
  ros::Subscriber sub = n.subscribe("ground_truth_pose", 1000, chatterCallback);


  return 0;

But where is my mistake? thanks,regards

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-01-11 18:08:58 -0500

I strongly suggest you take a in-depth look at the beginner tutorials, especially Understanding ROS Topics and Writing a Simple Publisher and Subscriber (C++) ones.

I can spot at least two mistakes:

  • The subscriber callback has to based on the correct type (not std_msgs:String but nav_msgs/Odometry)
  • You have to include the corresponding message header, not gazebo_ros_p3d
edit flag offensive delete link more

answered 2012-01-12 00:49:06 -0500

DimitriProsser gravatar image

The header file that you're looking for is:

#include <nav_msgs/Odometry.h>
edit flag offensive delete link more

Question Tools


Asked: 2012-01-11 10:27:57 -0500

Seen: 1,141 times

Last updated: Jan 12 '12