42 std::shared_ptr<OSLight> *os_light) {
43 if (
nullptr == os_light) {
46 auto res = std::make_shared<OSLight>();
50 if (!obu_light.has_header()) {
53 if (obu_light.
header().has_timestamp_sec()) {
54 res->mutable_header()->set_timestamp_sec(
57 if (obu_light.
header().has_module_name()) {
60 if (0 == obu_light.road_traffic_light_size()) {
63 bool flag_has_data =
false;
64 for (
int idx_road = 0; idx_road < obu_light.road_traffic_light_size();
69 switch (obu_road_light1.road_direction()) {
87 for (
int idx_lane = 0; idx_lane < obu_road_light1.lane_traffic_light_size();
89 const auto &obu_lane_light1 =
90 obu_road_light1.lane_traffic_light(idx_lane);
91 if (!obu_lane_light1.has_gps_x_m() || !obu_lane_light1.has_gps_y_m()) {
92 AWARN <<
"Invalid lane_traffic_light: [" << idx_road <<
"][" << idx_lane
93 <<
"]: no gps info here.";
97 auto *res_light1 = res->add_road_traffic_light();
98 res_light1->set_gps_x_m(obu_lane_light1.gps_x_m());
99 res_light1->set_gps_y_m(obu_lane_light1.gps_y_m());
100 res_light1->set_road_attribute(tl_attr);
102 for (
int j = 0; j < obu_lane_light1.single_traffic_light_size(); j++) {
103 auto *res_single1 = res_light1->add_single_traffic_light();
104 const auto &obu_single1 = obu_lane_light1.single_traffic_light(j);
105 if (obu_single1.has_id()) {
106 res_single1->set_id(obu_single1.id());
108 if (obu_single1.has_color_remaining_time_s()) {
109 res_single1->set_color_remaining_time_s(
110 obu_single1.color_remaining_time_s());
112 if (obu_single1.has_next_remaining_time()) {
113 res_single1->set_next_remaining_time_s(
114 obu_single1.next_remaining_time());
116 if (obu_single1.has_right_turn_light()) {
117 res_single1->set_right_turn_light(obu_single1.right_turn_light());
119 if (obu_single1.has_color()) {
120 res_single1->set_color(obu_single1.color());
122 if (obu_single1.has_next_color()) {
123 res_single1->set_next_color(obu_single1.next_color());
125 if (obu_single1.has_traffic_light_type()) {
126 res_single1->add_traffic_light_type(
133 return flag_has_data;
137 std::shared_ptr<OSRsi> *os_rsi) {
138 if (
nullptr == obu_rsi) {
141 if (
nullptr == os_rsi) {
144 auto res = std::make_shared<OSRsi>();
145 if (
nullptr == res) {
148 if (!obu_rsi->has_alter_type()) {
151 res->set_radius(obu_rsi->
radius());
153 if (obu_rsi->has_header()) {
154 auto header = res->mutable_header();
157 header->set_module_name(
"v2x");
163 for (
int index = 0; index < obu_rsi->points_size(); index++) {
164 auto point = res->add_points();
165 point->set_x(obu_rsi->
points(index).
x());
166 point->set_y(obu_rsi->
points(index).
y());
167 res->set_speed(std::atof(obu_rsi->
description().c_str()));
175 for (
int index = 0; index < obu_rsi->points_size(); index++) {
176 auto point = res->add_points();
177 point->set_x(obu_rsi->
points(index).
x());
178 point->set_y(obu_rsi->
points(index).
y());
188 auto point = res->add_points();
189 point->set_x(obu_rsi->
points(0).
x());
190 point->set_y(obu_rsi->
points(0).
y());
195 auto point = res->add_points();
196 point->set_x(obu_rsi->
points(0).
x());
197 point->set_y(obu_rsi->
points(0).
y());
198 res->set_speed(std::atof(obu_rsi->
description().c_str()));
210 std::shared_ptr<ObuJunction> *obu_junction) {
211 if (
nullptr == obu_junction) {
214 auto res = std::make_shared<ObuJunction>();
215 if (
nullptr == res) {
218 res->mutable_id()->set_id(hd_junction->id().id());
219 for (
const auto &point : hd_junction->polygon().points()) {
220 auto res_point = res->mutable_polygon()->add_point();
221 res_point->set_x(point.x());
222 res_point->set_y(point.y());