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

asked 2021-04-19 10:02:57 -0500

Julius Hendrix gravatar image

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 ...
(more)
edit retag flag offensive close merge delete

Comments

could please set up a little github repo with the code and building mechanism ready to build and run that demostrate the compilation problem?

Jose Luis Rivero gravatar imageJose Luis Rivero ( 2021-04-19 12:37:49 -0500 )edit

This subscriber is a part of a larger plugin, but I could make a smaller model plugin with only a subscriber in there. However, I don't quite know how I would but the building mechanism on the github, but I'm using the method described in this tutorial for compiling the model plugin:

Model Plugins

I'm using Gazebo 9 with ROS Melodic.

Cheers,

Julius

Julius Hendrix gravatar imageJulius Hendrix ( 2021-04-23 09:18:46 -0500 )edit