Apollo 10.0
自动驾驶开放平台
navi_planning.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
18
19#include <algorithm>
20#include <list>
21#include <map>
22
23#include "google/protobuf/repeated_field.h"
24
25#include "cyber/common/file.h"
26#include "cyber/time/clock.h"
39
40namespace apollo {
41namespace planning {
42
50
52 last_publishable_trajectory_.reset(nullptr);
53 frame_.reset(nullptr);
54 injector_->frame_history()->Clear();
55 injector_->history()->Clear();
56 injector_->planning_context()->mutable_planning_status()->Clear();
57}
58
59std::string NaviPlanning::Name() const { return "navi_planning"; }
60
62 if (!CheckPlanningConfig(config)) {
63 return Status(ErrorCode::PLANNING_ERROR,
64 "planning config error: " + config.DebugString());
65 }
66
67 PlanningBase::Init(config);
68
69 // clear planning history
70 injector_->history()->Clear();
71
72 // clear planning status
73 injector_->planning_context()->mutable_planning_status()->Clear();
74
76 if (!planner_) {
77 return Status(
78 ErrorCode::PLANNING_ERROR,
79 "planning is not initialized with config : " + config_.DebugString());
80 }
81
83
84 return planner_->Init(injector_, FLAGS_planner_config_path);
85}
86
87Status NaviPlanning::InitFrame(const uint32_t sequence_num,
88 const TrajectoryPoint& planning_start_point,
89 const VehicleState& vehicle_state) {
90 frame_.reset(new Frame(sequence_num, local_view_, planning_start_point,
91 vehicle_state, reference_line_provider_.get()));
92
93 std::list<ReferenceLine> reference_lines;
94 std::list<hdmap::RouteSegments> segments;
95 if (!reference_line_provider_->GetReferenceLines(&reference_lines,
96 &segments)) {
97 const std::string msg = "Failed to create reference line";
98 AERROR << msg;
99 return Status(ErrorCode::PLANNING_ERROR, msg);
100 }
101
102 auto status = frame_->Init(
103 injector_->vehicle_state(), reference_lines, segments,
104 reference_line_provider_->FutureRouteWaypoints(), injector_->ego_info());
105
106 if (!status.ok()) {
107 AERROR << "failed to init frame:" << status.ToString();
108 return status;
109 }
110 return Status::OK();
111}
112
114 ADCTrajectory* const trajectory_pb) {
116 const double start_timestamp = Clock::NowInSeconds();
117
118 // recreate reference line provider in every cycle
119 hdmap_ = HDMapUtil::BaseMapPtr(*local_view.relative_map);
120 const ReferenceLineConfig* reference_line_config = nullptr;
121 if (config_.has_reference_line_config()) {
122 reference_line_config = &config_.reference_line_config();
123 }
124 // Prefer "std::make_unique" to direct use of "new".
125 // Refer to "https://herbsutter.com/gotw/_102/" for details.
126 reference_line_provider_ = std::make_unique<ReferenceLineProvider>(
127 injector_->vehicle_state(), reference_line_config,
129
130 // localization
131 ADEBUG << "Get localization: "
132 << local_view_.localization_estimate->DebugString();
133
134 // chassis
135 ADEBUG << "Get chassis: " << local_view_.chassis->DebugString();
136
137 Status status = injector_->vehicle_state()->Update(
139
140 auto vehicle_config =
141 ComputeVehicleConfigFromLocalization(*local_view_.localization_estimate);
142
143 if (last_vehicle_config_.is_valid_ && vehicle_config.is_valid_) {
144 auto x_diff_map = vehicle_config.x_ - last_vehicle_config_.x_;
145 auto y_diff_map = vehicle_config.y_ - last_vehicle_config_.y_;
146
147 auto cos_map_veh = std::cos(last_vehicle_config_.theta_);
148 auto sin_map_veh = std::sin(last_vehicle_config_.theta_);
149
150 auto x_diff_veh = cos_map_veh * x_diff_map + sin_map_veh * y_diff_map;
151 auto y_diff_veh = -sin_map_veh * x_diff_map + cos_map_veh * y_diff_map;
152
153 auto theta_diff = vehicle_config.theta_ - last_vehicle_config_.theta_;
154
156 x_diff_veh, y_diff_veh, theta_diff, last_publishable_trajectory_.get());
157 }
158 last_vehicle_config_ = vehicle_config;
159
160 VehicleState vehicle_state = injector_->vehicle_state()->vehicle_state();
161
162 // estimate (x, y) at current timestamp
163 // This estimate is only valid if the current time and vehicle state timestamp
164 // differs only a small amount (20ms). When the different is too large, the
165 // estimation is invalid.
166 DCHECK_GE(start_timestamp, vehicle_state.timestamp());
167 if (start_timestamp - vehicle_state.timestamp() <
168 FLAGS_message_latency_threshold) {
169 auto future_xy = injector_->vehicle_state()->EstimateFuturePosition(
170 start_timestamp - vehicle_state.timestamp());
171 vehicle_state.set_x(future_xy.x());
172 vehicle_state.set_y(future_xy.y());
173 vehicle_state.set_timestamp(start_timestamp);
174 }
175
176 auto* not_ready = trajectory_pb->mutable_decision()
177 ->mutable_main_decision()
178 ->mutable_not_ready();
179
180 if (!status.ok() || !util::IsVehicleStateValid(vehicle_state)) {
181 const std::string msg = "Update VehicleStateProvider failed";
182 AERROR << msg;
183 not_ready->set_reason(msg);
184 status.Save(trajectory_pb->mutable_header()->mutable_status());
185 // TODO(all): integrate reverse gear
186 trajectory_pb->set_gear(canbus::Chassis::GEAR_DRIVE);
187 FillPlanningPb(start_timestamp, trajectory_pb);
188 return;
189 }
190
191 const double planning_cycle_time = 1.0 / FLAGS_planning_loop_rate;
192
193 std::vector<TrajectoryPoint> stitching_trajectory;
194 std::string replan_reason;
196 *(local_view_.chassis), vehicle_state, start_timestamp,
197 planning_cycle_time, FLAGS_trajectory_stitching_preserved_length, true,
198 last_publishable_trajectory_.get(), &replan_reason,
200
201 const uint32_t frame_num = static_cast<uint32_t>(seq_num_++);
202 status = InitFrame(frame_num, stitching_trajectory.back(), vehicle_state);
203
204 if (!frame_) {
205 const std::string msg = "Failed to init frame";
206 AERROR << msg;
207 not_ready->set_reason(msg);
208 status.Save(trajectory_pb->mutable_header()->mutable_status());
209 // TODO(all): integrate reverse gear
210 trajectory_pb->set_gear(canbus::Chassis::GEAR_DRIVE);
211 FillPlanningPb(start_timestamp, trajectory_pb);
212 return;
213 }
214
215 injector_->ego_info()->Update(stitching_trajectory.back(), vehicle_state);
216
217 if (FLAGS_enable_record_debug) {
218 frame_->RecordInputDebug(trajectory_pb->mutable_debug());
219 }
220 trajectory_pb->mutable_latency_stats()->set_init_frame_time_ms(
221 Clock::NowInSeconds() - start_timestamp);
222 if (!status.ok()) {
223 AERROR << status.ToString();
224 if (FLAGS_publish_estop) {
225 // Because the function "Control::ProduceControlCommand()" checks the
226 // "estop" signal with the following line (Line 170 in control.cc):
227 // estop_ = estop_ || trajectory_.estop().is_estop();
228 // we should add more information to ensure the estop being triggered.
229 ADCTrajectory estop_trajectory;
230 EStop* estop = estop_trajectory.mutable_estop();
231 estop->set_is_estop(true);
232 estop->set_reason(status.error_message());
233 status.Save(estop_trajectory.mutable_header()->mutable_status());
234 // TODO(all): integrate reverse gear
235 trajectory_pb->set_gear(canbus::Chassis::GEAR_DRIVE);
236 FillPlanningPb(start_timestamp, &estop_trajectory);
237 } else {
238 trajectory_pb->mutable_decision()
239 ->mutable_main_decision()
240 ->mutable_not_ready()
241 ->set_reason(status.ToString());
242 status.Save(trajectory_pb->mutable_header()->mutable_status());
243 // TODO(all): integrate reverse gear
244 trajectory_pb->set_gear(canbus::Chassis::GEAR_DRIVE);
245 FillPlanningPb(start_timestamp, trajectory_pb);
246 }
247
248 frame_->set_current_frame_planned_trajectory(*trajectory_pb);
249 auto seq_num = frame_->SequenceNum();
250 injector_->frame_history()->Add(seq_num, std::move(frame_));
251
252 return;
253 }
254
255 // Use planning pad message to make driving decisions
256 if (FLAGS_enable_planning_pad_msg) {
257 const auto& pad_msg_driving_action = frame_->GetPadMsgDrivingAction();
258 ProcessPadMsg(pad_msg_driving_action);
259 }
260
261 for (auto& ref_line_info : *frame_->mutable_reference_line_info()) {
262 auto traffic_status =
263 traffic_decider_.Execute(frame_.get(), &ref_line_info);
264 if (!traffic_status.ok() || !ref_line_info.IsDrivable()) {
265 ref_line_info.SetDrivable(false);
266 AWARN << "Reference line " << ref_line_info.Lanes().Id()
267 << " traffic decider failed";
268 continue;
269 }
270 }
271
272 status = Plan(start_timestamp, stitching_trajectory, trajectory_pb);
273
274 const auto time_diff_ms = (Clock::NowInSeconds() - start_timestamp) * 1000;
275 ADEBUG << "total planning time spend: " << time_diff_ms << " ms.";
276
277 trajectory_pb->mutable_latency_stats()->set_total_time_ms(time_diff_ms);
278 ADEBUG << "Planning latency: "
279 << trajectory_pb->latency_stats().DebugString();
280
281 auto* ref_line_task =
282 trajectory_pb->mutable_latency_stats()->add_task_stats();
283 ref_line_task->set_time_ms(reference_line_provider_->LastTimeDelay() *
284 1000.0);
285 ref_line_task->set_name("ReferenceLineProvider");
286
287 if (!status.ok()) {
288 status.Save(trajectory_pb->mutable_header()->mutable_status());
289 AERROR << "Planning failed:" << status.ToString();
290 if (FLAGS_publish_estop) {
291 AERROR << "Planning failed and set estop";
292 // Because the function "Control::ProduceControlCommand()" checks the
293 // "estop" signal with the following line (Line 170 in control.cc):
294 // estop_ = estop_ || trajectory_.estop().is_estop();
295 // we should add more information to ensure the estop being triggered.
296 EStop* estop = trajectory_pb->mutable_estop();
297 estop->set_is_estop(true);
298 estop->set_reason(status.error_message());
299 }
300 }
301
302 trajectory_pb->set_is_replan(stitching_trajectory.size() == 1);
303 // TODO(all): integrate reverse gear
304 trajectory_pb->set_gear(canbus::Chassis::GEAR_DRIVE);
305 FillPlanningPb(start_timestamp, trajectory_pb);
306 ADEBUG << "Planning pb:" << trajectory_pb->header().DebugString();
307
308 auto seq_num = frame_->SequenceNum();
309 injector_->frame_history()->Add(seq_num, std::move(frame_));
310}
311
312void NaviPlanning::ProcessPadMsg(PadMessage::DrivingAction drvie_action) {
313 if (FLAGS_use_navigation_mode) {
314 std::map<std::string, uint32_t> lane_id_to_priority;
315 auto& ref_line_info_group = *frame_->mutable_reference_line_info();
316 if (drvie_action != PadMessage::NONE) {
317 using LaneInfoPair = std::pair<std::string, double>;
318 std::string current_lane_id;
319 switch (drvie_action) {
320 case PadMessage::FOLLOW: {
321 AINFO << "Received follow drive action";
322 std::string current_lane_id = GetCurrentLaneId();
323 if (!current_lane_id.empty()) {
324 target_lane_id_ = current_lane_id;
325 }
326 break;
327 }
329 AINFO << "Received change left lane drive action";
330 std::vector<LaneInfoPair> lane_info_group;
331 GetLeftNeighborLanesInfo(&lane_info_group);
332 if (!lane_info_group.empty()) {
333 target_lane_id_ = lane_info_group.front().first;
334 }
335 break;
336 }
338 AINFO << "Received change right lane drive action";
339 std::vector<LaneInfoPair> lane_info_group;
340 GetRightNeighborLanesInfo(&lane_info_group);
341 if (!lane_info_group.empty()) {
342 target_lane_id_ = lane_info_group.front().first;
343 }
344 break;
345 }
347 AINFO << "Received pull over drive action";
348 // to do
349 break;
350 }
351 case PadMessage::STOP: {
352 AINFO << "Received stop drive action";
353 // to do
354 break;
355 }
356 default: {
357 AWARN << "Received undefined drive action.";
358 break;
359 }
360 }
361 }
362
363 if (!target_lane_id_.empty()) {
364 static constexpr uint32_t KTargetRefLinePriority = 0;
365 static constexpr uint32_t kOtherRefLinePriority = 10;
366 for (auto& ref_line_info : ref_line_info_group) {
367 auto lane_id = ref_line_info.Lanes().Id();
368 ADEBUG << "lane_id : " << lane_id;
369 lane_id_to_priority[lane_id] = kOtherRefLinePriority;
370 if (lane_id == target_lane_id_) {
371 lane_id_to_priority[lane_id] = KTargetRefLinePriority;
372 ADEBUG << "target lane_id : " << lane_id;
373 }
374 }
375 frame_->UpdateReferenceLinePriority(lane_id_to_priority);
376 }
377 }
378
379 // other planner to do
380}
381
382std::string NaviPlanning::GetCurrentLaneId() {
383 auto& ref_line_info_group = *frame_->mutable_reference_line_info();
384 const auto& vehicle_state = frame_->vehicle_state();
385 common::math::Vec2d adc_position(vehicle_state.x(), vehicle_state.y());
386 std::string current_lane_id;
387 for (auto& ref_line_info : ref_line_info_group) {
388 auto lane_id = ref_line_info.Lanes().Id();
389 auto& ref_line = ref_line_info.reference_line();
390 if (ref_line.IsOnLane(adc_position)) {
391 current_lane_id = lane_id;
392 }
393 }
394 return current_lane_id;
395}
396
397void NaviPlanning::GetLeftNeighborLanesInfo(
398 std::vector<std::pair<std::string, double>>* const lane_info_group) {
399 auto& ref_line_info_group = *frame_->mutable_reference_line_info();
400 const auto& vehicle_state = frame_->vehicle_state();
401 for (auto& ref_line_info : ref_line_info_group) {
402 common::math::Vec2d adc_position(vehicle_state.x(), vehicle_state.y());
403 auto& ref_line = ref_line_info.reference_line();
404 if (ref_line.IsOnLane(adc_position)) {
405 continue;
406 }
407 auto lane_id = ref_line_info.Lanes().Id();
408 auto ref_point =
409 ref_line.GetReferencePoint(vehicle_state.x(), vehicle_state.y());
410 double y = ref_point.y();
411 // in FLU positive on the left
412 if (y > 0.0) {
413 lane_info_group->emplace_back(lane_id, y);
414 }
415 }
416 // sort neighbor lanes from near to far
417 using LaneInfoPair = std::pair<std::string, double>;
418 std::sort(lane_info_group->begin(), lane_info_group->end(),
419 [](const LaneInfoPair& left, const LaneInfoPair& right) {
420 return left.second < right.second;
421 });
422}
423
424void NaviPlanning::GetRightNeighborLanesInfo(
425 std::vector<std::pair<std::string, double>>* const lane_info_group) {
426 auto& ref_line_info_group = *frame_->mutable_reference_line_info();
427 const auto& vehicle_state = frame_->vehicle_state();
428 for (auto& ref_line_info : ref_line_info_group) {
429 common::math::Vec2d adc_position(vehicle_state.x(), vehicle_state.y());
430 auto& ref_line = ref_line_info.reference_line();
431 if (ref_line.IsOnLane(adc_position)) {
432 continue;
433 }
434 auto lane_id = ref_line_info.Lanes().Id();
435 auto ref_point =
436 ref_line.GetReferencePoint(vehicle_state.x(), vehicle_state.y());
437 double y = ref_point.y();
438 // in FLU negative on the right
439 if (y < 0.0) {
440 lane_info_group->emplace_back(lane_id, y);
441 }
442 }
443
444 // sort neighbor lanes from near to far
445 using LaneInfoPair = std::pair<std::string, double>;
446 std::sort(lane_info_group->begin(), lane_info_group->end(),
447 [](const LaneInfoPair& left, const LaneInfoPair& right) {
448 return left.second > right.second;
449 });
450}
451
452void NaviPlanning::ExportReferenceLineDebug(planning_internal::Debug* debug) {
453 if (!FLAGS_enable_record_debug) {
454 return;
455 }
456 for (auto& reference_line_info : *frame_->mutable_reference_line_info()) {
457 auto rl_debug = debug->mutable_planning_data()->add_reference_line();
458 rl_debug->set_id(reference_line_info.Lanes().Id());
459 rl_debug->set_length(reference_line_info.reference_line().Length());
460 rl_debug->set_cost(reference_line_info.Cost());
461 rl_debug->set_is_change_lane_path(reference_line_info.IsChangeLanePath());
462 rl_debug->set_is_drivable(reference_line_info.IsDrivable());
463 rl_debug->set_is_protected(reference_line_info.GetRightOfWayStatus() ==
465 }
466}
467
469 const double current_time_stamp,
470 const std::vector<TrajectoryPoint>& stitching_trajectory,
471 ADCTrajectory* const trajectory_pb) {
472 auto* ptr_debug = trajectory_pb->mutable_debug();
473 if (FLAGS_enable_record_debug) {
474 ptr_debug->mutable_planning_data()->mutable_init_point()->CopyFrom(
475 stitching_trajectory.back());
476 }
477
478 auto status =
479 planner_->Plan(stitching_trajectory.back(), frame_.get(), trajectory_pb);
480
481 ExportReferenceLineDebug(ptr_debug);
482
483 const auto* best_ref_info = frame_->FindDriveReferenceLineInfo();
484 if (!best_ref_info) {
485 const std::string msg = "planner failed to make a driving plan";
486 AERROR << msg;
489 }
490 return Status(ErrorCode::PLANNING_ERROR, msg);
491 }
492 ptr_debug->MergeFrom(best_ref_info->debug());
493 trajectory_pb->mutable_latency_stats()->MergeFrom(
494 best_ref_info->latency_stats());
495 // set right of way status
496 trajectory_pb->set_right_of_way_status(best_ref_info->GetRightOfWayStatus());
497 for (const auto& id : best_ref_info->TargetLaneId()) {
498 trajectory_pb->add_lane_id()->CopyFrom(id);
499 }
500
501 best_ref_info->ExportDecision(trajectory_pb->mutable_decision(),
502 injector_->planning_context());
503
504 // Add debug information.
505 if (FLAGS_enable_record_debug) {
506 auto* reference_line = ptr_debug->mutable_planning_data()->add_path();
507 reference_line->set_name("planning_reference_line");
508 const auto& reference_points =
509 best_ref_info->reference_line().reference_points();
510 double s = 0.0;
511 double prev_x = 0.0;
512 double prev_y = 0.0;
513 bool empty_path = true;
514 for (const auto& reference_point : reference_points) {
515 auto* path_point = reference_line->add_path_point();
516 path_point->set_x(reference_point.x());
517 path_point->set_y(reference_point.y());
518 path_point->set_theta(reference_point.heading());
519 path_point->set_kappa(reference_point.kappa());
520 path_point->set_dkappa(reference_point.dkappa());
521 if (empty_path) {
522 path_point->set_s(0.0);
523 empty_path = false;
524 } else {
525 double dx = reference_point.x() - prev_x;
526 double dy = reference_point.y() - prev_y;
527 s += std::hypot(dx, dy);
528 path_point->set_s(s);
529 }
530 prev_x = reference_point.x();
531 prev_y = reference_point.y();
532 }
533 }
534
536 current_time_stamp, best_ref_info->trajectory()));
537
538 ADEBUG << "current_time_stamp: " << current_time_stamp;
539
540 // Navi Planner doesn't need to stitch the last path planning
541 // trajectory.Otherwise, it will cause the Dreamview planning track to display
542 // flashing or bouncing
543 // TODO(Yifei): remove this if navi-planner doesn't need stitching
552 for (size_t i = 0; i < last_publishable_trajectory_->NumOfPoints(); ++i) {
553 if (last_publishable_trajectory_->TrajectoryPointAt(i).relative_time() >
554 FLAGS_trajectory_time_high_density_period) {
555 break;
556 }
557 ADEBUG << last_publishable_trajectory_->TrajectoryPointAt(i)
558 .ShortDebugString();
559 }
560
561 last_publishable_trajectory_->PopulateTrajectoryProtobuf(trajectory_pb);
562
563 best_ref_info->ExportEngageAdvice(trajectory_pb->mutable_engage_advice(),
564 injector_->planning_context());
565
566 return status;
567}
568
569/*void NaviPlanning::Stop() {
570 AWARN << "Planning Stop is called";
571 last_publishable_trajectory_.reset(nullptr);
572 frame_.reset(nullptr);
573 planner_.reset(nullptr);
574 frame_history_->Clear();
575 injector_->planning()->mutable_planning_status()->Clear();
576}*/
577
578NaviPlanning::VehicleConfig NaviPlanning::ComputeVehicleConfigFromLocalization(
579 const localization::LocalizationEstimate& localization) const {
580 NaviPlanning::VehicleConfig vehicle_config;
581
582 if (!localization.pose().has_position()) {
583 return vehicle_config;
584 }
585
586 vehicle_config.x_ = localization.pose().position().x();
587 vehicle_config.y_ = localization.pose().position().y();
588
589 const auto& orientation = localization.pose().orientation();
590
591 if (localization.pose().has_heading()) {
592 vehicle_config.theta_ = localization.pose().heading();
593 } else {
594 vehicle_config.theta_ = common::math::QuaternionToHeading(
595 orientation.qw(), orientation.qx(), orientation.qy(), orientation.qz());
596 }
597
598 vehicle_config.is_valid_ = true;
599 return vehicle_config;
600}
601
602bool NaviPlanning::CheckPlanningConfig(const PlanningConfig& config) {
603 // TODO(All): check other config params
604
605 return true;
606}
607
608} // namespace planning
609} // namespace apollo
A general class to denote the return status of an API call.
Definition status.h:43
bool ok() const
check whether the return status is OK.
Definition status.h:67
const std::string & error_message() const
returns the error message of the status, empty if the status is OK.
Definition status.h:91
std::string ToString() const
returns a string representation in a readable format.
Definition status.h:98
void Save(StatusPb *status_pb)
save the error_code and error message to protobuf
Definition status.h:109
static Status OK()
generate a success status.
Definition status.h:60
a singleton clock that can be used to get the current timestamp.
Definition clock.h:39
static double NowInSeconds()
gets the current time in second.
Definition clock.cc:56
static const HDMap * BaseMapPtr()
Frame holds all data for one planning cycle.
Definition frame.h:62
apollo::common::Status Init(const PlanningConfig &config) override
module initialization function
std::string Name() const override
Planning algorithm name.
void RunOnce(const LocalView &local_view, ADCTrajectory *const trajectory_pb) override
main logic of the planning module, runs periodically triggered by timer.
apollo::common::Status Plan(const double current_time_stamp, const std::vector< common::TrajectoryPoint > &stitching_trajectory, ADCTrajectory *const trajectory) override
Plan the trajectory given current vehicle state
virtual apollo::common::Status Init(const PlanningConfig &config)
std::unique_ptr< Frame > frame_
virtual void FillPlanningPb(const double timestamp, ADCTrajectory *const trajectory_pb)
std::unique_ptr< PublishableTrajectory > last_publishable_trajectory_
const hdmap::HDMap * hdmap_
std::shared_ptr< Planner > planner_
std::shared_ptr< DependencyInjector > injector_
apollo::common::Status Execute(Frame *frame, ReferenceLineInfo *reference_line_info)
bool Init(const std::shared_ptr< DependencyInjector > &injector)
static std::vector< common::TrajectoryPoint > ComputeStitchingTrajectory(const canbus::Chassis &vehicle_chassis, const common::VehicleState &vehicle_state, const double current_timestamp, const double planning_cycle_time, const size_t preserved_points_num, const bool replan_by_offset, const PublishableTrajectory *prev_trajectory, std::string *replan_reason, const control::ControlInteractiveMsg &control_interactive_msg)
static void TransformLastPublishedTrajectory(const double x_diff, const double y_diff, const double theta_diff, PublishableTrajectory *prev_trajectory)
Planning module main class.
#define ADEBUG
Definition log.h:41
#define AERROR
Definition log.h:44
#define AINFO
Definition log.h:42
#define AWARN
Definition log.h:43
double QuaternionToHeading(const double qw, const double qx, const double qy, const double qz)
Definition quaternion.h:56
bool IsVehicleStateValid(const VehicleState &vehicle_state)
Definition util.cc:35
class register implement
Definition arena_queue.h:37
Contains a number of helper functions related to quaternions.
Declaration of the class ReferenceLineProvider.
optional apollo::localization::Pose pose
optional apollo::common::Quaternion orientation
Definition pose.proto:31
optional double heading
Definition pose.proto:48
optional apollo::common::PointENU position
Definition pose.proto:26
optional LatencyStats latency_stats
optional apollo::common::Header header
std::shared_ptr< localization::LocalizationEstimate > localization_estimate
Definition local_view.h:43
std::shared_ptr< relative_map::MapMsg > relative_map
Definition local_view.h:45
std::shared_ptr< control::ControlInteractiveMsg > control_interactive_msg
Definition local_view.h:50
std::shared_ptr< canbus::Chassis > chassis
Definition local_view.h:42
optional ReferenceLineConfig reference_line_config
LocalView contains all necessary data as planning input