Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
geodetic.hpp
Go to the documentation of this file.
1// Copyright 2023 Leidos
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef CARMA_COOPERATIVE_PERCEPTION__GEODETIC_HPP_
16#define CARMA_COOPERATIVE_PERCEPTION__GEODETIC_HPP_
17
23#include <units.h>
24
26
28{
33{
34 units::angle::degree_t latitude;
35 units::angle::degree_t longitude;
36 units::length::meter_t elevation;
37};
38
40{
41 units::length::meter_t easting;
42 units::length::meter_t northing;
43 units::length::meter_t elevation;
44};
45
50{
52 units::length::meter_t easting;
53 units::length::meter_t northing;
54 units::length::meter_t elevation;
55};
56
61{
62 units::length::meter_t easting;
63 units::length::meter_t northing;
64 units::length::meter_t elevation;
65};
66
75inline constexpr auto operator+=(UtmCoordinate & coordinate, const UtmDisplacement & displacement)
76 -> UtmCoordinate &
77{
78 coordinate.easting += displacement.easting;
79 coordinate.northing += displacement.northing;
80 coordinate.elevation += displacement.elevation;
81
82 return coordinate;
83}
84
93inline constexpr auto operator+(UtmCoordinate coordinate, const UtmDisplacement & displacement)
95{
96 return coordinate += displacement;
97}
98
107inline constexpr auto operator+(const UtmDisplacement & displacement, UtmCoordinate coordinate)
109{
110 return coordinate += displacement;
111}
112
121inline constexpr auto operator-=(UtmCoordinate & coordinate, const UtmDisplacement & displacement)
122 -> UtmCoordinate &
123{
124 coordinate.easting += displacement.easting;
125 coordinate.northing += displacement.northing;
126 coordinate.elevation += displacement.elevation;
127
128 return coordinate;
129}
130
139inline constexpr auto operator-(UtmCoordinate coordinate, const UtmDisplacement & displacement)
141{
142 return coordinate -= displacement;
143}
144
153inline constexpr auto operator-(const UtmDisplacement & displacement, UtmCoordinate coordinate)
155{
156 return coordinate -= displacement;
157}
158
169auto calculate_utm_zone(const Wgs84Coordinate & coordinate) -> UtmZone;
170
171auto project_to_carma_map(const Wgs84Coordinate & coordinate, std::string_view proj_string)
172 -> MapCoordinate;
173
181auto project_to_utm(const Wgs84Coordinate & coordinate) -> UtmCoordinate;
182
194auto calculate_grid_convergence(const Wgs84Coordinate & position, const UtmZone & zone)
195 -> units::angle::degree_t;
196
197auto calculate_grid_convergence(const Wgs84Coordinate & position, std::string_view georeference)
198 -> units::angle::degree_t;
199
200} // namespace carma_cooperative_perception
201
202#endif // CARMA_COOPERATIVE_PERCEPTION__GEODETIC_HPP_
auto calculate_grid_convergence(const Wgs84Coordinate &position, const UtmZone &zone) -> units::angle::degree_t
Calculate grid convergence at a given position.
Definition: geodetic.cpp:154
constexpr auto operator-=(UtmCoordinate &coordinate, const UtmDisplacement &displacement) -> UtmCoordinate &
Subtraction-assignment operator overload.
Definition: geodetic.hpp:121
auto project_to_carma_map(const Wgs84Coordinate &coordinate, std::string_view proj_string) -> MapCoordinate
Definition: geodetic.cpp:55
constexpr auto operator+=(UtmCoordinate &coordinate, const UtmDisplacement &displacement) -> UtmCoordinate &
Addition-assignment operator overload.
Definition: geodetic.hpp:75
constexpr auto operator+(UtmCoordinate coordinate, const UtmDisplacement &displacement) -> UtmCoordinate
Addition operator overload.
Definition: geodetic.hpp:93
constexpr auto operator-(UtmCoordinate coordinate, const UtmDisplacement &displacement) -> UtmCoordinate
Subtraction operator overload.
Definition: geodetic.hpp:139
auto calculate_utm_zone(const Wgs84Coordinate &coordinate) -> UtmZone
Get the UTM zone number from a WGS-84 coordinate.
Definition: geodetic.cpp:27
auto project_to_utm(const Wgs84Coordinate &coordinate) -> UtmCoordinate
Projects a Wgs84Coordinate to its corresponding UTM zone.
Definition: geodetic.cpp:87
Represents a position using UTM coordinates.
Definition: geodetic.hpp:50
Represent a displacement from a UTM coordinate.
Definition: geodetic.hpp:61
Represents a position using WGS-84 coordinates.
Definition: geodetic.hpp:33