21namespace task_manager {
23using common::math::Vec2d;
27 AINFO << ego.
x() <<
" " << ego.
y() <<
" " << target.
x() <<
" " << target.
y();
28 Vec2d tar2ego(ego.
x() - target.
x(), ego.
y() - target.
y());
31 return dis < 1e-6 && std::fabs(dis) < distance && tar2ego.
Length() < distance;
41 begin_point_.set_heading(pose.
heading());
43 is_allowed_to_route_ =
true;
47 AINFO <<
"New cycle routing task: cycle " << cycle_ <<
", begin point "
48 << begin_point_.
x() <<
" " << begin_point_.
y() <<
", end point "
49 << end_point_.
x() <<
" " << end_point_.
y();
57 AINFO <<
"GetNewRouting: localization_pose: " << pose.
position().
x() <<
" "
58 << pose.
position().
y() <<
", begin point " << begin_point_.
x() <<
" "
59 << begin_point_.
y() <<
", end point " << end_point_.
x() <<
" "
60 << end_point_.
y() <<
", threshold "
61 << FLAGS_task_manager_threshold_for_destination_check
62 <<
", allowed_to_send_routing_request " << is_allowed_to_route_;
64 if (is_allowed_to_route_) {
67 FLAGS_task_manager_threshold_for_destination_check)) {
68 AINFO <<
"GetNewRouting: reach begin point."
69 <<
"Remaining cycles: " << cycle_;
70 lane_follow_command->CopyFrom(original_lane_follow_command_);
71 auto cur_point = lane_follow_command->mutable_way_point(0);
72 is_allowed_to_route_ =
false;
78 FLAGS_task_manager_threshold_for_destination_check)) {
79 AINFO <<
"GetNewRouting: reach end point. "
80 <<
"Remaining cycles: " << cycle_;
81 lane_follow_command->clear_way_point();
82 auto cur_point = lane_follow_command->add_way_point();
86 cur_point->set_heading(pose.
heading());
87 auto end_pose = lane_follow_command->mutable_end_pose();
88 end_pose->CopyFrom(begin_point_);
90 is_allowed_to_route_ =
true;
A general class to denote the return status of an API call.
static Status OK()
generate a success status.
Implements a class of 2-dimensional vectors.
static Vec2d CreateUnitVec2d(const double angle)
Creates a unit-vector with a given angle to the positive x semi-axis
double InnerProd(const Vec2d &other) const
Returns the inner product between these two Vec2d.
double Length() const
Gets the length of the vector
common::Status Init(const localization::Pose &pose, const task_manager::CycleRoutingTask &cycle_routing_task)
module initialization function
bool GetNewRouting(const localization::Pose &pose, external_command::LaneFollowCommand *lane_follow_command)
Get new routing if the vehicle reaches the begin/end point
bool CheckPointDistanceInThreshold(external_command::Pose target, common::PointENU ego, double distance)
optional apollo::common::PointENU position
optional apollo::external_command::LaneFollowCommand lane_follow_command