Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

no known conversion ConstPosePtr togazebo::msgs::Pose&

Hey there,

I'm trying to make a callback function for a subsriber to a gztopic on which a gazebo::msgs::Pose message is being published. I'd like to convert the message to a ignition::math::Pose3d. I'm using the following code:

subsriber:

  this->subpose = this->node->Subscribe("~/latchbeam/pose_tether_rov",
     &tetherROV_plugin::OnMsgPose, this);

callback:

private: void OnMsgPose(ConstPosePtr &_msg) {

  pose_LB_attach = gazebo::msgs::ConvertIgn(_msg);

}

I get the following error:

/home/hackerman/git/twin/gazebo_plugins/large_seakit_plugins/tetherROV_plugin/tetherROV_plugin.cc: In member function ‘void gazebo::tetherROV_plugin::OnMsgPose(ConstPosePtr&)’:
/home/hackerman/git/twin/gazebo_plugins/large_seakit_plugins/tetherROV_plugin/tetherROV_plugin.cc:253:53: error: no matching function for call to ‘ConvertIgn(ConstPosePtr&)’
       pose_LB_attach = gazebo::msgs::ConvertIgn(_msg);
                                                     ^
In file included from /usr/include/gazebo-9/gazebo/gazebo_core.hh:20:0,
                 from /usr/include/gazebo-9/gazebo/gazebo.hh:20,
                 from /home/hackerman/git/twin/gazebo_plugins/large_seakit_plugins/tetherROV_plugin/tetherROV_plugin.cc:8:
/usr/include/gazebo-9/gazebo/msgs/msgs.hh:243:30: note: candidate: ignition::math::v4::Vector3d gazebo::msgs::ConvertIgn(const gazebo::msgs::Vector3d&)
     ignition::math::Vector3d ConvertIgn(const msgs::Vector3d &_v);
                              ^~~~~~~~~~
/usr/include/gazebo-9/gazebo/msgs/msgs.hh:243:30: note:   no known conversion for argument 1 from ‘ConstPosePtr {aka const boost::shared_ptr<const gazebo::msgs::Pose>}’ to ‘const gazebo::msgs::Vector3d&’
/usr/include/gazebo-9/gazebo/msgs/msgs.hh:249:30: note: candidate: ignition::math::v4::Vector2d gazebo::msgs::ConvertIgn(const gazebo::msgs::Vector2d&)
     ignition::math::Vector2d ConvertIgn(const msgs::Vector2d &_v);
                              ^~~~~~~~~~
/usr/include/gazebo-9/gazebo/msgs/msgs.hh:249:30: note:   no known conversion for argument 1 from ‘ConstPosePtr {aka const boost::shared_ptr<const gazebo::msgs::Pose>}’ to ‘const gazebo::msgs::Vector2d&’
/usr/include/gazebo-9/gazebo/msgs/msgs.hh:255:33: note: candidate: ignition::math::v4::Quaterniond gazebo::msgs::ConvertIgn(const gazebo::msgs::Quaternion&)
     ignition::math::Quaterniond ConvertIgn(const msgs::Quaternion &_q);
                                 ^~~~~~~~~~
/usr/include/gazebo-9/gazebo/msgs/msgs.hh:255:33: note:   no known conversion for argument 1 from ‘ConstPosePtr {aka const boost::shared_ptr<const gazebo::msgs::Pose>}’ to ‘const gazebo::msgs::Quaternion&’
/usr/include/gazebo-9/gazebo/msgs/msgs.hh:261:28: note: candidate: ignition::math::v4::Pose3d gazebo::msgs::ConvertIgn(const gazebo::msgs::Pose&)
     ignition::math::Pose3d ConvertIgn(const msgs::Pose &_p);
                            ^~~~~~~~~~
/usr/include/gazebo-9/gazebo/msgs/msgs.hh:261:28: note:   no known conversion for argument 1 from ‘ConstPosePtr {aka const boost::shared_ptr<const gazebo::msgs::Pose>}’ to ‘const gazebo::msgs::Pose&’
/usr/include/gazebo-9/gazebo/msgs/msgs.hh:291:28: note: candidate: ignition::math::v4::Planed gazebo::msgs::ConvertIgn(const gazebo::msgs::PlaneGeom&)
     ignition::math::Planed ConvertIgn(const msgs::PlaneGeom &_p);
                            ^~~~~~~~~~
/usr/include/gazebo-9/gazebo/msgs/msgs.hh:291:28: note:   no known conversion for argument 1 from ‘ConstPosePtr {aka const boost::shared_ptr<const gazebo::msgs::Pose>}’ to ‘const gazebo::msgs::PlaneGeom&’
CMakeFiles/tetherROV_plugin.dir/build.make:62: recipe for target 'CMakeFiles/tetherROV_plugin.dir/tetherROV_plugin.cc.o' failed
make[2]: *** [CMakeFiles/tetherROV_plugin.dir/tetherROV_plugin.cc.o] Error 1
CMakeFiles/Makefile2:291: recipe for target 'CMakeFiles/tetherROV_plugin.dir/all' failed
make[1]: *** [CMakeFiles/tetherROV_plugin.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I probably misinterpreted the documentation:

http://osrf-distributions.s3.amazonaws.com/gazebo/api/7.1.0/group__gazebo__msgs.html#gaa94e05a05544a276ae6168f20f0ebf8a

How do I correctly convert the message to an ignition::math::Pose3d message?

Cheers,

Julius