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

You are accessing a part of memory that doesn't exist. I change move_base the last week. The code were made to be initialize once, if you try to initialize again without destroy the objects, you will get Segmentation error. With you don't do that, the problem is the global variables, for example this parameters: runPlanner_=false; state_ = PLANNING; recovery_index_ = 0; recovery_trigger_ = PLANNING_R; you need to be careful with that. Most important, any time you want acess something of the planner_costmap_ros_ or controller_costmap_ros_, you need to do

planner_costmap_ros_->stop();
        controller_costmap_ros_->stop();

or pause (planner_costmap_ros_->pause();) depending what you want and then do planner_costmap_ros_->start(); to free the mutex.

They use the mutex to have threads, and to limit acess to objects that multiple threads try do acess, is like a traffic light, if is red none can acess, if green, a thread can ask acess and if obtain the acess, the traffic light become red, the thread to something, and then free the object, and turn traffic light to green.

When you see boost::unique_lock<boost::mutex> lock(planner_mutex_); and lock.unlock(); is what happening. I don't konw if this coment help you anything, but this was my experience.

You are accessing a part of memory that doesn't exist. I change move_base the last week. The code were made to be initialize once, if you try to initialize again without destroy the objects, you will get Segmentation error. With error.

If you don't do that, the problem is the global variables, for example this parameters: runPlanner_=false; state_ = PLANNING; recovery_index_ = 0; recovery_trigger_ = PLANNING_R; you need to be careful with that. Most important, any time you want acess something of the planner_costmap_ros_ or controller_costmap_ros_, you need to do

planner_costmap_ros_->stop();
        controller_costmap_ros_->stop();

or pause (planner_costmap_ros_->pause();) depending what you want and then do planner_costmap_ros_->start(); to free the mutex.

They use the mutex to have threads, and to limit acess to objects that multiple threads try do acess, is like a traffic light, if is red none can acess, if green, a thread can ask acess and if obtain the acess, the traffic light become red, the thread to something, and then free the object, and turn traffic light to green.

When you see boost::unique_lock<boost::mutex> lock(planner_mutex_); and lock.unlock(); is what happening. I don't konw if this coment help you anything, but this was my experience.

You are accessing a part of memory that doesn't exist. I change move_base the last week. The code were made to be initialize once, if you try to initialize again without destroy the objects, you will get Segmentation error.

If you don't do that, the problem is the global variables, for example this parameters: runPlanner_=false; state_ = PLANNING; recovery_index_ = 0; recovery_trigger_ = PLANNING_R; you need to be careful with that. Most important, any time you want acess something of the planner_costmap_ros_ or controller_costmap_ros_, you need to do

planner_costmap_ros_->stop();
        controller_costmap_ros_->stop();

or pause (planner_costmap_ros_->pause();) depending what you want and then do planner_costmap_ros_->start(); to free the mutex.

They use the mutex to have threads, and to limit acess to objects that multiple threads try do acess, is like a traffic light, if is red none can acess, if green, a thread can ask acess and if obtain the acess, the traffic light become red, the thread to something, and then free the object, and turn traffic light to green.

When you see boost::unique_lock<boost::mutex> lock(planner_mutex_); and lock.unlock(); is what happening. I don't konw if this coment help you anything, but this was my experience.

Good luck, I lost almost two weeks on move_base. 1 week to understand why the segmentation error, the other doing my code.