0
$\begingroup$

Rosanswers logo

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="libgazebo_ros_p3d.so">
    <alwaysOn>true</alwaysOn>
    <updateRate>100.0</updateRate>
    <bodyName>imu_link</bodyName>
    <topicName>ground_truth_pose</topicName>
    <gaussianNoise>0.0</gaussianNoise>
    <frameName>map</frameName>
    <interface:position name="my_box_p3d_position_iface" />
  </controller:gazebo_ros_p3d>

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);

  ros::spin();

  return 0;
}

But where is my mistake? thanks,regards


Originally posted by hmmm on ROS Answers with karma: 37 on 2012-01-11

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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

Originally posted by Stefan Kohlbrecher with karma: 24361 on 2012-01-11

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.