34 start_received_(false), goal_received_(false),
62 if (goal_pose->header.frame_id !=
map_->getFrameID()){
63 ROS_WARN(
"Goal pose frame id \"%s\" different from map frame id \"%s\"", goal_pose->header.frame_id.c_str(),
map_->getFrameID().c_str());
77 if (start_pose->header.frame_id !=
map_->getFrameID()){
78 ROS_WARN(
"Start pose frame id \"%s\" different from map frame id \"%s\"", start_pose->header.frame_id.c_str(),
map_->getFrameID().c_str());
117 unsigned start_x, start_y, goal_x, goal_y;
119 ROS_ERROR(
"Start coordinates out of map bounds");
123 ROS_ERROR(
"Goal coordinates out of map bounds");
127 if (
map_->isOccupiedAtCell(start_x, start_y)){
131 if (
map_->isOccupiedAtCell(goal_x, goal_y)){
139 if (start_id < 0 || planner_->set_start(start_id) == 0){
144 if (goal_id < 0 || planner_->set_goal(goal_id) == 0){
152 std::vector<int> solution_stateIDs;
157 ROS_DEBUG(
"Solution found. Costs: %d; final eps: %f", solution_cost,
planner_->get_final_epsilon());
164 path_costs_ = double(solution_cost) / ENVNAV2D_COSTMULT *
map_->getResolution();
167 path_.poses.reserve(solution_stateIDs.size());
168 path_.header.frame_id =
map_->getFrameID();
171 geometry_msgs::PoseStamped pose;
172 pose.header =
path_.header;
173 for (
size_t i = 0; i < solution_stateIDs.size(); i++) {
178 map_->mapToWorld(mx,my,wx,wy);
181 pose.pose.position.x = wx;
182 pose.pose.position.y = wy;
183 pose.pose.position.z = 0.0;
184 path_.poses.push_back(pose);
208 for(
unsigned int j = 0; j <
map_->getInfo().height; ++j){
209 for(
unsigned int i = 0; i <
map_->getInfo().width; ++i){
210 if (
map_->isOccupiedAtCell(i,j))
void publish(const boost::shared_ptr< M > &message) const
void goalCallback(const geometry_msgs::PoseStampedConstPtr &goal)
Set goal and plan when start was already set.
geometry_msgs::Pose goal_pose_
bool search_until_first_solution_
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
void setPlanner()
(re)sets the planner
static const unsigned char OBSTACLE_COST
void mapCallback(const nav_msgs::OccupancyGridConstPtr &occupancy_map)
calls updateMap()
std::string planner_type_
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
bool updateMap(gridmap_2d::GridMap2DPtr map)
Setup the internal map representation and initialize the SBPL planning environment.
boost::shared_ptr< EnvironmentNAV2D > planner_environment_
boost::shared_ptr< SBPLPlanner > planner_
void startCallback(const geometry_msgs::PoseWithCovarianceStampedConstPtr &start)
Set start and plan when goal was already set.
geometry_msgs::Pose start_pose_
gridmap_2d::GridMap2DPtr map_