Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Cannot Declare Reference to tf2_msgs::TFMessage


I had a great callback function in a Gazebo plugin. I declared it with

void OnMsg(ConstVector3dPtr &msg)

and subscribed-to by my plugin's Load function with

subscriber = node->Subscribe("~/eb/vel_cmd", &MyPlugin::OnMsg, this);


Instead of subscribing to "~/eb/vel_cmd", I'm subscribing to "/tf", so I need to change the message type of the callback (MyPlugin::OnMsg) to tf2_msgs::TFMessage. I followed the convention of the question in the link below to create a constant pointer for a tf2_msgs::TFMessage message.

Following the positionCb callback declaration in that code, now my callback is declared with:

private: void OnMsg(const tf2_msgs::TFMessage::ConstPtr& &msg)

I'm getting all kinds of compiling errors, but the biggest problem appears to be "Cannot declare reference to tf2_msgs::TFMessage_<std::allocator<void> >::ConstPtr& {aka class boost::shared_ptr<const tf2_msgs::tfmessage_<std::allocator<void="">>&}' (picture below).

Any ideas on what I'm doing incorrectly?

Compiling Errors: image description