Apollo 11.0
自动驾驶开放平台
publishable_trajectory.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 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
22
23#include "cyber/common/log.h"
24
25namespace apollo {
26namespace planning {
27
29 const double header_time,
30 const DiscretizedTrajectory& discretized_trajectory)
31 : DiscretizedTrajectory(discretized_trajectory),
32 header_time_(header_time) {}
33
35 : DiscretizedTrajectory(trajectory_pb),
36 header_time_(trajectory_pb.header().timestamp_sec()) {}
37
38double PublishableTrajectory::header_time() const { return header_time_; }
39
41 ADCTrajectory* trajectory_pb) const {
42 CHECK_NOTNULL(trajectory_pb);
43 trajectory_pb->mutable_header()->set_timestamp_sec(header_time_);
44 trajectory_pb->mutable_trajectory_point()->CopyFrom({begin(), end()});
45 if (!empty()) {
46 const auto& last_tp = back();
47 trajectory_pb->set_total_path_length(last_tp.path_point().s());
48 trajectory_pb->set_total_path_time(last_tp.relative_time());
49 }
50 AINFO << "IsReversed" << IsReversed();
51 if (IsReversed()) {
52 trajectory_pb->set_gear(canbus::Chassis::GEAR_REVERSE);
53 } else {
54 trajectory_pb->set_gear(canbus::Chassis::GEAR_DRIVE);
55 }
56}
57
58} // namespace planning
59} // namespace apollo
void PopulateTrajectoryProtobuf(ADCTrajectory *trajectory_pb) const
Planning module main class.
#define AINFO
Definition log.h:42
class register implement
Definition arena_queue.h:37