46 initialized_(false), remove_limit_thread_(NULL), limit_set_(false){}
68 std::string planner_namespace;
69 private_nh_.
param(
"planner_namespace", planner_namespace, std::string(
"DWAPlannerROS"));
79 ROS_ERROR(
"This recovery behavior has not been initialized, doing nothing.");
82 ROS_WARN(
"Move slow and clear recovery behavior started.");
83 geometry_msgs::PoseStamped global_pose, local_pose;
87 std::vector<geometry_msgs::Point> global_poly, local_poly;
88 geometry_msgs::Point pt;
90 for(
int i = -1; i <= 1; i+=2)
94 global_poly.push_back(pt);
98 global_poly.push_back(pt);
102 local_poly.push_back(pt);
106 local_poly.push_back(pt);
113 if(plugin->getName().find(
"obstacles")!=std::string::npos){
123 if(plugin->getName().find(
"obstacles")!=std::string::npos){
131 boost::mutex::scoped_lock l(
mutex_);
158 geometry_msgs::PoseStamped global_pose;
160 double x1 = global_pose.pose.position.x;
161 double y1 = global_pose.pose.position.y;
166 return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
173 ROS_INFO(
"Moved far enough, removing speed limit.");
188 boost::mutex::scoped_lock l(
mutex_);
197 dynamic_reconfigure::Reconfigure vel_reconfigure;
198 dynamic_reconfigure::DoubleParameter new_trans;
200 new_trans.value = trans_speed;
201 vel_reconfigure.request.config.doubles.push_back(new_trans);
207 ROS_ERROR(
"Something went wrong in the service call to dynamic_reconfigure");
211 dynamic_reconfigure::Reconfigure rot_reconfigure;
212 dynamic_reconfigure::DoubleParameter new_rot;
214 new_rot.value = rot_speed;
215 rot_reconfigure.request.config.doubles.push_back(new_rot);
221 ROS_ERROR(
"Something went wrong in the service call to dynamic_reconfigure");
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
costmap_2d::Costmap2DROS * local_costmap_
ros::NodeHandle private_nh_
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
ros::Timer distance_check_timer_
bool call(MReq &req, MRes &res)
double limited_rot_speed_
std::vector< boost::shared_ptr< Layer > > * getPlugins()
static const unsigned char FREE_SPACE
double limited_trans_speed_
void setRobotSpeed(double trans_speed, double rot_speed)
ros::NodeHandle planner_nh_
void distanceCheck(const ros::TimerEvent &e)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
void initialize(std::string n, tf2_ros::Buffer *tf, costmap_2d::Costmap2DROS *global_costmap, costmap_2d::Costmap2DROS *local_costmap)
Initialize the parameters of the behavior.
std::string max_rot_param_name_
bool getParam(const std::string &key, std::string &s) const
costmap_2d::Costmap2DROS * global_costmap_
void runBehavior()
Run the behavior.
geometry_msgs::PoseStamped speed_limit_pose_
bool getRobotPose(geometry_msgs::PoseStamped &global_pose) const
double clearing_distance_
ros::ServiceClient planner_dynamic_reconfigure_service_
#define ROS_INFO_STREAM(args)
const std::string & getNamespace() const
std::string max_trans_param_name_
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
LayeredCostmap * getLayeredCostmap()
boost::thread * remove_limit_thread_