Skip to content

Commit

Permalink
feat(mission_planner): add route updater (#3334)
Browse files Browse the repository at this point in the history
  • Loading branch information
purewater0901 authored Apr 10, 2023
1 parent 90ac960 commit fbe8870
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class PlannerPlugin
virtual bool ready() const = 0;
virtual LaneletRoute plan(const RoutePoints & points) = 0;
virtual MarkerArray visualize(const LaneletRoute & route) const = 0;
virtual void updateRoute(const LaneletRoute & route) = 0;
virtual void clearRoute() = 0;
};

} // namespace mission_planner
Expand Down
11 changes: 11 additions & 0 deletions planning/mission_planner/src/lanelet2_plugins/default_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ PlannerPlugin::LaneletRoute DefaultPlanner::plan(const RoutePoints & points)
const auto local_route_sections = route_handler_.createMapSegments(path_lanelets);
route_sections = combine_consecutive_route_sections(route_sections, local_route_sections);
}
route_handler_.setRouteLanelets(all_route_lanelets);

auto goal_pose = points.back();
if (param_.enable_correct_goal_pose) {
Expand Down Expand Up @@ -452,6 +453,16 @@ geometry_msgs::msg::Pose DefaultPlanner::refine_goal_height(
return refined_goal;
}

void DefaultPlanner::updateRoute(const PlannerPlugin::LaneletRoute & route)
{
route_handler_.setRoute(route);
}

void DefaultPlanner::clearRoute()
{
route_handler_.clearRoute();
}

} // namespace mission_planner::lanelet2

#include <pluginlib/class_list_macros.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class DefaultPlanner : public mission_planner::PlannerPlugin
const double search_margin = 2.0);
bool is_goal_valid(const geometry_msgs::msg::Pose & goal, lanelet::ConstLanelets path_lanelets);
Pose refine_goal_height(const Pose & goal, const RouteSections & route_sections);
void updateRoute(const PlannerPlugin::LaneletRoute & route);
void clearRoute();
};

} // namespace mission_planner::lanelet2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ PoseStamped MissionPlanner::transform_pose(const PoseStamped & input)
void MissionPlanner::change_route()
{
arrival_checker_.set_goal();
planner_->clearRoute();
// TODO(Takagi, Isamu): publish an empty route here
}

Expand All @@ -134,6 +135,7 @@ void MissionPlanner::change_route(const LaneletRoute & route)
arrival_checker_.set_goal(goal);
pub_route_->publish(route);
pub_marker_->publish(planner_->visualize(route));
planner_->updateRoute(route);
}

void MissionPlanner::change_state(RouteState::Message::_state_type state)
Expand Down

0 comments on commit fbe8870

Please sign in to comment.