ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I got exactly the same problem but with hydro. Still haven't found a solution,

I got had exactly the same problem. Basically until move_base receives its first goal the status_list[] is empty. Thus, when you try to access it creates a memory problem but with hydro. Still haven't found as status_list[] is empty/not allocated. You can use the vector.empty() function that returns 1 if the vector is empty...for example status_list.empty() will return 1 if a solution,goal was not given to move_base.

Here is my example code on how to protect your callback:

void StatusPublisher::navStatusCallBack(const actionlib_msgs::GoalStatusArray::ConstPtr& status)
{
 if (!status->status_list.empty())
   {
     actionlib_msgs::GoalStatus goalStatus = status->status_list[0];
  testing_pub.publish(goalStatus);
   }