Subscribing to nav_msgs::Path message
Hi everyone,
I am trying to subscribe to a message of type nav_msgs::Path. Following is the callback function:
nav_msgs::Path gPlan;
void planCallback(nav_msgs::Path::ConstPtr& msg)
{
int i=0;
for(std::vector<geometry_msgs::PoseStamped>::const_iterator it= msg->poses.begin(); it!= msg->poses.end(); ++it)
{
gPlan.poses[i] = *it;
i++;
}
}
The subscriber has been defined as:
ros::Subscriber planSub = n.subscribe("global_plan", 1000, planCallback);
The error I am getting is as follows:
In file included from /opt/ros/indigo/include/ros/serialization.h:37:0,
from /opt/ros/indigo/include/ros/publisher.h:34,
from /opt/ros/indigo/include/ros/node_handle.h:32,
from /opt/ros/indigo/include/ros/ros.h:45,
from /home/lead/catkin_ws_autoware/src/PPpublisher/src/purepursuitPub.cpp:1:
/opt/ros/indigo/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::MD5Sum<M>::value() [with M = boost::shared_ptr<const nav_msgs::Path_<std::allocator<void> > >]’:
/opt/ros/indigo/include/ros/message_traits.h:228:103: required from ‘const char* ros::message_traits::md5sum() [with M = boost::shared_ptr<const nav_msgs::Path_<std::allocator<void> > >]’
/opt/ros/indigo/include/ros/subscribe_options.h:89:50: required from ‘void ros::SubscribeOptions::initByFullCallbackType(const string&, uint32_t, const boost::function<void(P)>&, const boost::function<boost::shared_ptr<typename ros::ParameterAdapter<P>::Message>()>&) [with P = boost::shared_ptr<const nav_msgs::Path_<std::allocator<void> > >&; std::string = std::basic_string<char>; uint32_t = unsigned int; typename ros::ParameterAdapter<P>::Message = boost::shared_ptr<const nav_msgs::Path_<std::allocator<void> > >]’
/opt/ros/indigo/include/ros/node_handle.h:658:5: required from ‘ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (*)(M), const ros::TransportHints&) [with M = boost::shared_ptr<const nav_msgs::Path_<std::allocator<void> > >&; std::string = std::basic_string<char>; uint32_t = unsigned int]’
/home/lead/catkin_ws_autoware/src/PPpublisher/src/purepursuitPub.cpp:71:74: required from here
/opt/ros/indigo/include/ros/message_traits.h:121:29: error: ‘__s_getMD5Sum’ is not a member of ‘boost::shared_ptr<const nav_msgs::Path_<std::allocator<void> > >’
return M::__s_getMD5Sum().c_str();
^
/opt/ros/indigo/include/ros/message_traits.h: In instantiation of ‘static const char* ros::message_traits::DataType<M>::value() [with M = boost::shared_ptr<const nav_msgs::Path_<std::allocator<void> > >]’:
/opt/ros/indigo/include/ros/message_traits.h:237:105: required from ‘const char* ros::message_traits::datatype() [with M = boost::shared_ptr<const nav_msgs::Path_<std::allocator<void> > >]’
/opt/ros/indigo/include/ros/subscribe_options.h:90:54: required from ‘void ros::SubscribeOptions::initByFullCallbackType(const string&, uint32_t, const boost::function<void(P)>&, const boost::function<boost::shared_ptr<typename ros::ParameterAdapter<P>::Message>()>&) [with P = boost::shared_ptr<const nav_msgs::Path_<std::allocator<void> > >&; std::string = std::basic_string<char>; uint32_t = unsigned int; typename ros::ParameterAdapter<P>::Message = boost::shared_ptr<const nav_msgs::Path_<std::allocator<void> > >]’
/opt/ros/indigo/include/ros/node_handle.h:658:5: required from ‘ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (*)(M), const ros::TransportHints&) [with M = boost::shared_ptr<const nav_msgs::Path_<std::allocator<void> > >&; std::string = std::basic_string<char>; uint32_t = unsigned int]’
/home/lead/catkin_ws_autoware/src/PPpublisher/src/purepursuitPub.cpp:71:74: required from here
/opt/ros/indigo ...