# Revision history [back]

I don't know how your code exactly looks like or what exactly you are trying to do but in order to instantiate a real message from a shape shifter message, you need to know its type and and you need to have included the corresponding header files. For instance, to instantiate a geometry_msgs::Pose message:

void pose_subscriber(const boost::shared_ptr<const topic_tools::ShapeShifter> message) {
boost::shared_ptr<geometry_msgs::Pose> pose = message.instantiate<geometry_msgs::Pose>();
// Do stuff...
}

// The subscriber somewhere in your code...
ros::Subscriber subscriber = node_handle.subscribe<topic_tools::ShapeShifter>("pose_topic", 1, &pose_subscriber);


I don't know how your code exactly looks like or what exactly you are trying to do but in order to instantiate a real message from a shape shifter message, you need to know its type and and you need to have included include the corresponding header files. For instance, to instantiate a geometry_msgs::Pose message:

#include <geometry_msgs/Pose.h>

void pose_subscriber(const boost::shared_ptr<const topic_tools::ShapeShifter> message) {
boost::shared_ptr<geometry_msgs::Pose> pose = message.instantiate<geometry_msgs::Pose>();
// Do stuff...
}

// The subscriber somewhere in your code...
ros::Subscriber subscriber = node_handle.subscribe<topic_tools::ShapeShifter>("pose_topic", 1, &pose_subscriber);