Apollo
10.0
自动驾驶开放平台
util.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
17
#include "
modules/common/util/util.h
"
18
19
#include <cmath>
20
#include <vector>
21
22
namespace
apollo
{
23
namespace
common {
24
namespace
util {
25
26
PointENU
operator+(
const
PointENU
enu,
const
math::Vec2d
& xy) {
27
PointENU
point;
28
point.set_x(enu.
x
() + xy.
x
());
29
point.set_y(enu.
y
() + xy.
y
());
30
point.set_z(enu.
z
());
31
return
point;
32
}
33
34
PathPoint
GetWeightedAverageOfTwoPathPoints
(
const
PathPoint
& p1,
35
const
PathPoint
& p2,
36
const
double
w1,
const
double
w2) {
37
PathPoint
p;
38
p.set_x(p1.
x
() * w1 + p2.
x
() * w2);
39
p.set_y(p1.
y
() * w1 + p2.
y
() * w2);
40
p.set_z(p1.
z
() * w1 + p2.
z
() * w2);
41
p.set_theta(p1.
theta
() * w1 + p2.
theta
() * w2);
42
p.set_kappa(p1.
kappa
() * w1 + p2.
kappa
() * w2);
43
p.set_dkappa(p1.
dkappa
() * w1 + p2.
dkappa
() * w2);
44
p.set_ddkappa(p1.
ddkappa
() * w1 + p2.
ddkappa
() * w2);
45
p.set_s(p1.
s
() * w1 + p2.
s
() * w2);
46
return
p;
47
}
48
49
}
// namespace util
50
}
// namespace common
51
}
// namespace apollo
apollo::common::math::Vec2d
Implements a class of 2-dimensional vectors.
Definition
vec2d.h:42
apollo::common::math::Vec2d::y
double y() const
Getter for y component
Definition
vec2d.h:57
apollo::common::math::Vec2d::x
double x() const
Getter for x component
Definition
vec2d.h:54
util.h
Some util functions.
apollo::common::util::GetWeightedAverageOfTwoPathPoints
PathPoint GetWeightedAverageOfTwoPathPoints(const PathPoint &p1, const PathPoint &p2, const double w1, const double w2)
Definition
util.cc:34
apollo
class register implement
Definition
arena_queue.h:37
apollo::common::PathPoint
Definition
pnc_point.proto:31
apollo::common::PathPoint::y
optional double y
Definition
pnc_point.proto:34
apollo::common::PathPoint::kappa
optional double kappa
Definition
pnc_point.proto:40
apollo::common::PathPoint::dkappa
optional double dkappa
Definition
pnc_point.proto:45
apollo::common::PathPoint::x
optional double x
Definition
pnc_point.proto:33
apollo::common::PathPoint::theta
optional double theta
Definition
pnc_point.proto:38
apollo::common::PathPoint::s
optional double s
Definition
pnc_point.proto:42
apollo::common::PathPoint::ddkappa
optional double ddkappa
Definition
pnc_point.proto:47
apollo::common::PathPoint::z
optional double z
Definition
pnc_point.proto:35
apollo::common::PointENU
Definition
geometry.proto:14
apollo::common::PointENU::z
optional double z
Definition
geometry.proto:17
apollo::common::PointENU::y
optional double y
Definition
geometry.proto:16
apollo::common::PointENU::x
optional double x
Definition
geometry.proto:15
modules
common
util
util.cc