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.
j2735_types.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__J2735_TYPES_HPP_
16#define CARMA_COOPERATIVE_PERCEPTION__J2735_TYPES_HPP_
17
18#include <units.h>
19
20#include <carma_v2x_msgs/msg/acceleration_set4_way.hpp>
21#include <carma_v2x_msgs/msg/heading.hpp>
22#include <carma_v2x_msgs/msg/position3_d.hpp>
23#include <carma_v2x_msgs/msg/speed.hpp>
24#include <j2735_v2x_msgs/msg/acceleration_set4_way.hpp>
25#include <j2735_v2x_msgs/msg/d_date_time.hpp>
26#include <j2735_v2x_msgs/msg/heading.hpp>
27#include <j2735_v2x_msgs/msg/position3_d.hpp>
28#include <j2735_v2x_msgs/msg/speed.hpp>
29#include <optional>
30
33
35{
37{
38 std::optional<units::time::year_t> year{std::nullopt};
39 std::optional<Month> month{std::nullopt};
40 std::optional<units::time::day_t> day{std::nullopt};
41 std::optional<units::time::hour_t> hour{std::nullopt};
42 std::optional<units::time::minute_t> minute{std::nullopt};
43 std::optional<units::time::second_t> second{std::nullopt};
44 std::optional<units::time::minute_t> time_zone_offset{std::nullopt};
45
46 [[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::DDateTime & msg) -> DDateTime;
47};
48
50{
51 units::acceleration::centi_meters_per_second_squared_t longitudinal;
52 units::acceleration::centi_meters_per_second_squared_t lateral;
53 units::acceleration::two_centi_standard_gravities_t vert;
54 units::angular_velocity::centi_degrees_per_second_t yaw_rate;
55
56 [[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::AccelerationSet4Way & msg)
58
59 [[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::AccelerationSet4Way & msg)
61};
62
64{
65 units::angle::deci_micro_degrees_t latitude{0.0};
66 units::angle::deci_micro_degrees_t longitude{0.0};
67 std::optional<units::length::deca_centimeters_t> elevation;
68
69 [[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::Position3D & msg) -> Position3D;
70
71 [[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::Position3D & msg) -> Position3D;
72};
73
74struct Heading
75{
76 units::angle::eighth_deci_degrees_t heading;
77
78 [[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::Heading & heading) -> Heading;
79
80 [[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::Heading & heading) -> Heading;
81};
82
83struct Speed
84{
85 units::velocity::two_centi_meters_per_second_t speed;
86
87 [[nodiscard]] static auto from_msg(const j2735_v2x_msgs::msg::Speed & speed) -> Speed;
88
89 [[nodiscard]] static auto from_msg(const carma_v2x_msgs::msg::Speed & speed) -> Speed;
90};
91
92} // namespace carma_cooperative_perception
93
94#endif // CARMA_COOPERATIVE_PERCEPTION__J2735_TYPES_HPP_
static auto from_msg(const j2735_v2x_msgs::msg::AccelerationSet4Way &msg) -> AccelerationSet4Way
Definition: j2735_types.cpp:55
units::acceleration::centi_meters_per_second_squared_t lateral
Definition: j2735_types.hpp:52
units::acceleration::centi_meters_per_second_squared_t longitudinal
Definition: j2735_types.hpp:51
units::angular_velocity::centi_degrees_per_second_t yaw_rate
Definition: j2735_types.hpp:54
units::acceleration::two_centi_standard_gravities_t vert
Definition: j2735_types.hpp:53
std::optional< units::time::hour_t > hour
Definition: j2735_types.hpp:41
std::optional< units::time::day_t > day
Definition: j2735_types.hpp:40
std::optional< units::time::minute_t > minute
Definition: j2735_types.hpp:42
static auto from_msg(const j2735_v2x_msgs::msg::DDateTime &msg) -> DDateTime
Definition: j2735_types.cpp:19
std::optional< units::time::year_t > year
Definition: j2735_types.hpp:38
std::optional< units::time::second_t > second
Definition: j2735_types.hpp:43
std::optional< units::time::minute_t > time_zone_offset
Definition: j2735_types.hpp:44
static auto from_msg(const j2735_v2x_msgs::msg::Heading &heading) -> Heading
units::angle::eighth_deci_degrees_t heading
Definition: j2735_types.hpp:76
units::angle::deci_micro_degrees_t latitude
Definition: j2735_types.hpp:65
static auto from_msg(const j2735_v2x_msgs::msg::Position3D &msg) -> Position3D
Definition: j2735_types.cpp:75
units::angle::deci_micro_degrees_t longitude
Definition: j2735_types.hpp:66
std::optional< units::length::deca_centimeters_t > elevation
Definition: j2735_types.hpp:67
units::velocity::two_centi_meters_per_second_t speed
Definition: j2735_types.hpp:85
static auto from_msg(const j2735_v2x_msgs::msg::Speed &speed) -> Speed