Apollo 10.0
自动驾驶开放平台
point_factory.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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
17#pragma once
18
20#include "modules/common_msgs/basic_msgs/geometry.pb.h"
21#include "modules/common_msgs/basic_msgs/pnc_point.pb.h"
22
23namespace apollo {
24namespace common {
25namespace util {
26
28 public:
29 template <typename XY>
30 static inline math::Vec2d ToVec2d(const XY& xy) {
31 return math::Vec2d(xy.x(), xy.y());
32 }
33
34 static inline SLPoint ToSLPoint(const double s, const double l) {
35 SLPoint sl;
36 sl.set_s(s);
37 sl.set_l(l);
38 return sl;
39 }
40
41 static inline PointENU ToPointENU(const double x, const double y,
42 const double z = 0) {
43 PointENU point_enu;
44 point_enu.set_x(x);
45 point_enu.set_y(y);
46 point_enu.set_z(z);
47 return point_enu;
48 }
49
50 template <typename XYZ>
51 static inline PointENU ToPointENU(const XYZ& xyz) {
52 return ToPointENU(xyz.x(), xyz.y(), xyz.z());
53 }
54
55 static inline SpeedPoint ToSpeedPoint(const double s, const double t,
56 const double v = 0, const double a = 0,
57 const double da = 0) {
58 SpeedPoint speed_point;
59 speed_point.set_s(s);
60 speed_point.set_t(t);
61 speed_point.set_v(v);
62 speed_point.set_a(a);
63 speed_point.set_da(da);
64 return speed_point;
65 }
66
67 static inline PathPoint ToPathPoint(const double x, const double y,
68 const double z = 0, const double s = 0,
69 const double theta = 0,
70 const double kappa = 0,
71 const double dkappa = 0,
72 const double ddkappa = 0) {
73 PathPoint path_point;
74 path_point.set_x(x);
75 path_point.set_y(y);
76 path_point.set_z(z);
77 path_point.set_s(s);
78 path_point.set_theta(theta);
79 path_point.set_kappa(kappa);
80 path_point.set_dkappa(dkappa);
81 path_point.set_ddkappa(ddkappa);
82 return path_point;
83 }
84};
85
86} // namespace util
87} // namespace common
88} // namespace apollo
Implements a class of 2-dimensional vectors.
Definition vec2d.h:42
static math::Vec2d ToVec2d(const XY &xy)
static PointENU ToPointENU(const XYZ &xyz)
static PointENU ToPointENU(const double x, const double y, const double z=0)
static SLPoint ToSLPoint(const double s, const double l)
static SpeedPoint ToSpeedPoint(const double s, const double t, const double v=0, const double a=0, const double da=0)
static PathPoint ToPathPoint(const double x, const double y, const double z=0, const double s=0, const double theta=0, const double kappa=0, const double dkappa=0, const double ddkappa=0)
class register implement
Definition arena_queue.h:37
Defines the Vec2d class.