20 namespace std_ph = std::placeholders;
23 : carma_ros2_utils::CarmaLifecycleNode(options)
44 auto error = update_params<std::string>({{
"url",
config_.
url},
51 rcl_interfaces::msg::SetParametersResult result;
53 result.successful = !error;
60 RCLCPP_DEBUG_STREAM(this->get_logger(),
"CarmaCloudClient trying to configure");
64 get_parameter<std::string>(
"url",
config_.
url);
77 tcr_sub_ = create_subscription<carma_v2x_msgs::msg::TrafficControlRequest>(
"outgoing_geofence_request", 10,
79 tcm_pub_ = create_publisher<j2735_v2x_msgs::msg::TrafficControlMessage>(
"incoming_j2735_geofence_control", 1);
83 return CallbackReturn::SUCCESS;
88 carma_v2x_msgs::msg::TrafficControlRequest request_msg(*msg.get());
96 RCLCPP_DEBUG_STREAM( get_logger(),
"tcr_sub_ callback called ");
101 j2735_v2x_msgs::msg::TrafficControlRequest j2735_tcr;
105 RCLCPP_DEBUG_STREAM( get_logger(),
"converted: ");
108 char reqid[j2735_tcr.tcr_v01.reqid.id.size() * hexlen + 1];
109 for (
int i = 0;
i < j2735_tcr.tcr_v01.reqid.id.size();
i++)
111 sprintf(reqid+(
i*hexlen),
"%.2X", j2735_tcr.tcr_v01.reqid.id[
i]);
114 RCLCPP_DEBUG_STREAM( get_logger(),
"reqid: " << reqid);
116 long int reqseq = j2735_tcr.tcr_v01.reqseq;
117 RCLCPP_DEBUG_STREAM( get_logger(),
"reqseq: " << reqseq);
119 long int scale = j2735_tcr.tcr_v01.scale;
120 RCLCPP_DEBUG_STREAM( get_logger(),
"scale: " << scale);
122 int totBounds = j2735_tcr.tcr_v01.bounds.size();
124 char bounds_str[5000];
125 strcpy(bounds_str,
"");
133 uint32_t oldest = tm;
134 long lat = j2735_tcr.tcr_v01.bounds[cnt].reflat;
135 long longg = j2735_tcr.tcr_v01.bounds[cnt].reflon;
138 long dtx0 = j2735_tcr.tcr_v01.bounds[cnt].offsets[0].deltax;
139 long dty0 = j2735_tcr.tcr_v01.bounds[cnt].offsets[0].deltay;
140 long dtx1 = j2735_tcr.tcr_v01.bounds[cnt].offsets[1].deltax;
141 long dty1 = j2735_tcr.tcr_v01.bounds[cnt].offsets[1].deltay;
142 long dtx2 = j2735_tcr.tcr_v01.bounds[cnt].offsets[2].deltax;
143 long dty2 = j2735_tcr.tcr_v01.bounds[cnt].offsets[2].deltay;
145 int x = std::sprintf(bounds_str+strlen(bounds_str),
"<bounds><TrafficControlBounds><oldest>%ld</oldest><reflon>%ld</reflon><reflat>%ld</reflat><offsets><OffsetPoint><deltax>%ld</deltax><deltay>%ld</deltay></OffsetPoint><OffsetPoint><deltax>%ld</deltax><deltay>%ld</deltay></OffsetPoint><OffsetPoint><deltax>%ld</deltax><deltay>%ld</deltay></OffsetPoint></offsets></TrafficControlBounds></bounds>",oldest,longg,lat,dtx0,dty0,dtx1,dty1,dtx2,dty2);
160 sprintf(xml_str,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><TrafficControlRequest port=\"%s\" list=\"%s\"><reqid>%s</reqid><reqseq>%ld</reqseq><scale>%ld</scale>%s</TrafficControlRequest>",port, list, reqid, reqseq,scale,bounds_str);
162 RCLCPP_DEBUG_STREAM( get_logger(),
"xml_str: " << xml_str);
166 int CarmaCloudClient::CloudSend(
const std::string &local_msg,
const std::string& local_url,
const std::string& local_base,
const std::string& local_method)
170 std::string urlfull = local_url +
config_.
port + local_base;
171 RCLCPP_DEBUG_STREAM( get_logger(),
"full url: " << urlfull);
172 req = curl_easy_init();
174 curl_easy_setopt(req, CURLOPT_URL, urlfull.c_str());
176 if(strcmp(local_method.c_str(),
"POST")==0)
178 curl_easy_setopt(req, CURLOPT_POSTFIELDS, local_msg.c_str());
179 curl_easy_setopt(req, CURLOPT_TIMEOUT_MS, 1000L);
180 res = curl_easy_perform(req);
183 RCLCPP_ERROR_STREAM( get_logger(),
"curl send failed: " << curl_easy_strerror(res));
187 curl_easy_cleanup(req);
195 std::thread t([
this, &local_msg, &local_url, &local_base, &local_method](){
196 CloudSend(local_msg, local_url, local_base, local_method);
204 strm.zalloc =
nullptr;
205 strm.zfree =
nullptr;
206 strm.opaque =
nullptr;
207 strm.avail_in = compressedBytes.size();
208 strm.next_in = (Byte *)compressedBytes.data();
210 auto err = inflateInit2(&strm, MAX_WBITS + 16);
213 const int BUFFER_SIZE = 4092;
220 char buffer[BUFFER_SIZE] = {0};
221 strm.avail_out = BUFFER_SIZE;
222 strm.next_out = (Byte *)buffer;
224 isDone = inflate(&strm, Z_FINISH);
225 outBuf.append(buffer);
226 }
while (Z_STREAM_END != isDone);
230 RCLCPP_DEBUG_STREAM( get_logger(),
"Error initalize stream. Err code = " << err);
240 while(socket->bytesAvailable()>0)
242 auto readBytes = socket->readAll();
250 st.append(readBytes);
254 QByteArray array = st.toLocal8Bit();
256 char* _cloudUpdate = array.data();
259 std::string tcm_string = _cloudUpdate;
261 RCLCPP_DEBUG_STREAM( get_logger(),
"Received TCM from cloud");
262 RCLCPP_DEBUG_STREAM( get_logger(),
"TCM in XML format: " << tcm_string);
263 if(tcm_string.length() == 0)
265 RCLCPP_DEBUG_STREAM( get_logger(),
"Received TCM length is zero, and skipped.");
269 boost::property_tree::ptree list_tree;
270 std :: stringstream ss;
272 read_xml(ss, list_tree);
275 auto child_tcm_list = list_tree.get_child_optional(
"TrafficControlMessageList");
279 auto child_tree = list_tree.get_child(
"TrafficControlMessage");
280 j2735_v2x_msgs::msg::TrafficControlMessage parsed_tcm =
parseTCMXML(child_tree);
285 auto tcm_list = child_tcm_list.get();
287 BOOST_FOREACH(
auto &node, list_tree.get_child(
"TrafficControlMessageList"))
289 j2735_v2x_msgs::msg::TrafficControlMessage parsed_tcm =
parseTCMXML(node.second);
300 j2735_v2x_msgs::msg::TrafficControlMessage tcm;
302 auto child_tcmv01 = tree.get_child_optional(
"tcmV01");
305 tcm.choice = j2735_v2x_msgs::msg::TrafficControlMessage::RESERVED;
308 else tcm.choice = j2735_v2x_msgs::msg::TrafficControlMessage::TCMV01;
310 std::string reqid_string = tree.get<std::string>(
"tcmV01.reqid");
311 j2735_v2x_msgs::msg::Id64b output;
312 for (std::size_t
i = 0;
i != reqid_string.size() / 2; ++
i)
317 tcm.tcm_v01.reqseq = tree.get<uint8_t>(
"tcmV01.reqseq");
318 tcm.tcm_v01.msgtot = tree.get<uint16_t>(
"tcmV01.msgtot");
319 tcm.tcm_v01.msgnum = tree.get<uint16_t>(
"tcmV01.msgnum");
321 std::string id_string = tree.get<std::string>(
"tcmV01.id");
322 for (std::size_t
i = 0;
i != id_string.size() / 2; ++
i)
327 tcm.tcm_v01.updated = tree.get<uint64_t>(
"tcmV01.updated");
329 auto tree_package = tree.get_child_optional(
"tcmV01.package");
332 tcm.tcm_v01.package_exists =
false;
336 tcm.tcm_v01.package_exists =
true;
340 auto tree_params = tree.get_child_optional(
"tcmV01.params");
343 tcm.tcm_v01.params_exists =
false;
347 tcm.tcm_v01.params_exists =
true;
351 auto tree_geometry = tree.get_child_optional(
"tcmV01.geometry");
354 tcm.tcm_v01.geometry_exists =
false;
358 tcm.tcm_v01.geometry_exists =
true;
370 char *placeholderX[1]={0};
372 QCoreApplication a(placeholderC,placeholderX);
374 QHostAddress address = QHostAddress(QString::fromStdString (
config_.
webip));
377 QSharedPointer<OpenAPI::OAIApiRequestHandler> handler(
new OpenAPI::OAIApiRequestHandler());
378 handler = QSharedPointer<OpenAPI::OAIApiRequestHandler> (
new OpenAPI::OAIApiRequestHandler());
379 auto router = QSharedPointer<OpenAPI::OAIApiRouter>::create();
380 router->setUpRoutes();
382 QObject::connect(handler.data(), &OpenAPI::OAIApiRequestHandler::requestReceived, [&](QHttpEngine::Socket *socket) {
386 QObject::connect(handler.data(), &OpenAPI::OAIApiRequestHandler::requestReceived, [&](QHttpEngine::Socket *socket) {
387 router->processRequest(socket);
389 QHttpEngine::Server server(handler.data());
391 if (!server.listen(address, port)) {
392 qCritical(
"Unable to listen on the specified port.");
396 RCLCPP_DEBUG_STREAM(this->get_logger(),
"CarmaCloudClient :: Started web service");
403 j2735_v2x_msgs::msg::TrafficControlPackage tcm_pkg;
405 auto tree_label = tree.get_child_optional(
"label");
408 tcm_pkg.label_exists =
false;
412 tcm_pkg.label_exists =
true;
413 tcm_pkg.label = tree.get<std::string>(
"label");
416 std::string tcids_string = tree.get<std::string>(
"tcids");
424 j2735_v2x_msgs::msg::TrafficControlSchedule tcm_schedule;
425 tcm_schedule.start = tree.get<uint64_t>(
"schedule.start");
427 auto child_end = tree.get_child_optional(
"schedule.end");
430 tcm_schedule.end_exists =
false;
434 tcm_schedule.end_exists =
true;
435 tcm_schedule.end = tree.get<uint64_t>(
"schedule.end");
438 auto child_dow = tree.get_child_optional(
"schedule.dow");
441 tcm_schedule.dow_exists =
false;
445 tcm_schedule.dow_exists =
true;
446 std::string dow_string = tree.get<std::string>(
"schedule.dow");
447 for (
size_t i=0;
i<dow_string.size();
i++)
449 tcm_schedule.dow.dow[
i] = dow_string[
i] -
'0';
452 auto child_between = tree.get_child_optional(
"schedule.between");
455 tcm_schedule.between_exists =
false;
459 tcm_schedule.between_exists =
true;
460 auto child_tree = child_between.get();
462 for (
auto& item : tree.get_child(
"schedule.between"))
464 j2735_v2x_msgs::msg::DailySchedule daily;
465 for (
auto& which : item.second)
467 if (which.first ==
"begin")
469 daily.begin = which.second.get_value<uint16_t>();
471 else if (which.first ==
"duration")
473 daily.duration = which.second.get_value<uint16_t>();
476 tcm_schedule.between.push_back(daily);
479 auto child_repeat = tree.get_child_optional(
"schedule.repeat");
483 tcm_schedule.repeat_exists =
false;
487 tcm_schedule.repeat_exists =
true;
488 tcm_schedule.repeat.offset = child_repeat.get().get<uint16_t>(
"offset");
489 tcm_schedule.repeat.period = child_repeat.get().get<uint16_t>(
"period");
490 tcm_schedule.repeat.span = child_repeat.get().get<uint16_t>(
"span");
498 j2735_v2x_msgs::msg::TrafficControlDetail tcm_detail;
500 auto detail_tree = tree.get_child(
"detail");
503 auto closed_tree = detail_tree.get_child_optional(
"closed" );
506 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::CLOSED_CHOICE;
508 auto open = closed_tree.get().get_child_optional(
"open");
511 tcm_detail.closed = j2735_v2x_msgs::msg::TrafficControlDetail::OPEN;
514 auto notopen = closed_tree.get().get_child_optional(
"notopen");
517 tcm_detail.closed = j2735_v2x_msgs::msg::TrafficControlDetail::CLOSED;
520 auto taperleft = closed_tree.get().get_child_optional(
"taperleft");
523 tcm_detail.closed = j2735_v2x_msgs::msg::TrafficControlDetail::TAPERLEFT;
526 auto taperright = closed_tree.get().get_child_optional(
"taperright");
529 tcm_detail.closed = j2735_v2x_msgs::msg::TrafficControlDetail::TAPERRIGHT;
532 auto openleft = closed_tree.get().get_child_optional(
"openleft");
535 tcm_detail.closed = j2735_v2x_msgs::msg::TrafficControlDetail::OPENLEFT;
538 auto openright = closed_tree.get().get_child_optional(
"openright");
541 tcm_detail.closed = j2735_v2x_msgs::msg::TrafficControlDetail::OPENRIGHT;
546 auto child_dir= detail_tree.get_child_optional(
"direction" );
549 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::DIRECTION_CHOICE;
551 auto direction = child_dir.get().get_child_optional(
"reverse");
554 tcm_detail.direction = j2735_v2x_msgs::msg::TrafficControlDetail::REVERSE;
556 else tcm_detail.direction = j2735_v2x_msgs::msg::TrafficControlDetail::FORWARD;
560 auto child_chains = detail_tree.get_child_optional(
"chains" );
563 tcm_detail.chains = j2735_v2x_msgs::msg::TrafficControlDetail::CHAINS_CHOICE;
564 auto no = child_chains.get().get_child_optional(
"no");
567 tcm_detail.chains = j2735_v2x_msgs::msg::TrafficControlDetail::NO;
569 auto permitted = child_chains.get().get_child_optional(
"permitted");
572 tcm_detail.chains = j2735_v2x_msgs::msg::TrafficControlDetail::PERMITTED;
574 auto required = child_chains.get().get_child_optional(
"required");
577 tcm_detail.chains = j2735_v2x_msgs::msg::TrafficControlDetail::REQUIRED;
581 auto child_mins = tree.get_child_optional(
"detail.minspeed" );
584 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::MINSPEED_CHOICE;
585 tcm_detail.minspeed = tree.get<
float>(
"detail.minspeed");
588 auto child_maxs = tree.get_child_optional(
"detail.maxspeed");
591 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::MAXSPEED_CHOICE;
592 tcm_detail.maxspeed = tree.get<uint16_t>(
"detail.maxspeed");
595 auto child_minhdwy = tree.get_child_optional(
"detail.minhdwy");
598 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::MINHDWY_CHOICE;
599 tcm_detail.minhdwy = tree.get<uint16_t>(
"detail.minhdwy");
602 auto child_maxvehmass = tree.get_child_optional(
"detail.maxvehmass");
603 if( child_maxvehmass )
605 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::MAXVEHMASS_CHOICE;
606 tcm_detail.maxvehmass = tree.get<uint16_t>(
"detail.maxvehmass");
609 auto child_maxvehheight = tree.get_child_optional(
"detail.maxvehheight");
610 if( child_maxvehheight )
612 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::MAXVEHHEIGHT_CHOICE;
613 tcm_detail.maxvehheight = tree.get<uint8_t>(
"detail.maxvehheight");
616 auto child_maxvehwidth = tree.get_child_optional(
"detail.maxvehwidth");
617 if( child_maxvehwidth )
619 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::MAXVEHWIDTH_CHOICE;
620 tcm_detail.maxvehwidth = tree.get<uint8_t>(
"detail.maxvehwidth");
623 auto child_maxvehlength = tree.get_child_optional(
"detail.maxvehlength");
624 if( child_maxvehlength )
626 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::MAXVEHLENGTH_CHOICE;
627 tcm_detail.maxvehlength = tree.get<uint16_t>(
"detail.maxvehlength");
630 auto child_maxvehaxles = tree.get_child_optional(
"detail.maxvehaxles");
631 if( child_maxvehaxles)
633 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::MAXVEHAXLES_CHOICE;
634 tcm_detail.maxvehaxles = tree.get<uint8_t>(
"detail.maxvehaxles");
637 auto child_minvehocc = tree.get_child_optional(
"detail.minvehocc");
640 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::MINVEHOCC_CHOICE;
641 tcm_detail.minvehocc = tree.get<uint8_t>(
"detail.minvehocc");
644 auto child_maxplatoonsize = tree.get_child_optional(
"detail.maxplatoonsize");
645 if( child_maxplatoonsize)
647 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::MAXPLATOONSIZE_CHOICE;
648 tcm_detail.maxplatoonsize = tree.get<uint8_t>(
"detail.maxplatoonsize");
651 auto child_minplatoonhdwy = tree.get_child_optional(
"detail.minplatoonhdwy");
652 if( child_minplatoonhdwy)
654 tcm_detail.choice = j2735_v2x_msgs::msg::TrafficControlDetail::MINPLATOONHDWY_CHOICE;
655 tcm_detail.minplatoonhdwy = tree.get<uint16_t>(
"detail.minplatoonhdwy");
663 j2735_v2x_msgs::msg::TrafficControlParams tcm_params;
664 for (
auto& item : tree.get_child(
"vclasses"))
666 j2735_v2x_msgs::msg::TrafficControlVehClass vclass;
667 if (item.first ==
"any")
669 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::ANY;
671 else if (item.first ==
"pedestrian")
673 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::PEDESTRIAN;
675 else if (item.first ==
"bicycle")
677 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::BICYCLE;
679 else if (tree.count(
"micromobile") != 0)
681 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::MICROMOBILE;
683 else if (item.first ==
"motorcycle")
685 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::MOTORCYCLE;
687 else if (item.first ==
"passenger-car")
689 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::PASSENGER_CAR;
691 else if (item.first ==
"light-truck-van")
693 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::LIGHT_TRUCK_VAN;
695 else if (item.first ==
"bus")
697 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::BUS;
699 else if (item.first ==
"two-axle-six-tire-single-unit-truck")
701 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::TWO_AXLE_SIX_TIRE_SINGLE_UNIT_TRUCK;
703 else if (item.first ==
"three-axle-single-unit-truck")
705 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::THREE_AXLE_SINGLE_UNIT_TRUCK;
707 else if (item.first ==
"four-or-more-axle-single-unit-truck")
709 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::FOUR_OR_MORE_AXLE_SINGLE_UNIT_TRUCK;
711 else if (item.first ==
"four-or-fewer-axle-single-trailer-truck")
713 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::FOUR_OR_FEWER_AXLE_SINGLE_TRAILER_TRUCK;
715 else if (item.first ==
"five-axle-single-trailer-truck")
717 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::FIVE_AXLE_SINGLE_TRAILER_TRUCK;
719 else if (item.first ==
"six-or-more-axle-single-trailer-truck")
721 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::SIX_OR_MORE_AXLE_SINGLE_TRAILER_TRUCK;
723 else if (item.first ==
"five-or-fewer-axle-multi-trailer-truck")
725 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::FIVE_OR_FEWER_AXLE_MULTI_TRAILER_TRUCK;
727 else if (item.first ==
"six-axle-multi-trailer-truck")
729 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::SIX_AXLE_MULTI_TRAILER_TRUCK;
731 else if (item.first ==
"seven-or-more-axle-multi-trailer-truck")
733 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::SEVEN_OR_MORE_AXLE_MULTI_TRAILER_TRUCK;
735 else if (item.first ==
"rail")
737 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::RAIL;
739 else if (item.first ==
"unclassified")
741 vclass.vehicle_class = j2735_v2x_msgs::msg::TrafficControlVehClass::UNCLASSIFIED;
743 tcm_params.vclasses.push_back(vclass);
747 std::string bool_str = tree.get_value<std::string>(
"regulatory");
748 if (bool_str ==
"false") tcm_params.regulatory =
false;
749 else tcm_params.regulatory =
true;
759 j2735_v2x_msgs::msg::TrafficControlGeometry tcm_geometry;
760 tcm_geometry.proj = tree.get<std::string>(
"proj");
761 tcm_geometry.datum = tree.get<std::string>(
"datum");
763 tcm_geometry.reftime = tree.get<uint64_t>(
"reftime");
765 tcm_geometry.reflon = tree.get<int32_t>(
"reflon");
766 tcm_geometry.reflat = tree.get<int32_t>(
"reflat");
767 tcm_geometry.refelv = tree.get<int32_t>(
"refelv");
768 tcm_geometry.heading = tree.get<int16_t>(
"heading");
770 for (
auto& item : tree.get_child(
"nodes"))
772 j2735_v2x_msgs::msg::PathNode pathnode;
773 for (
auto& which : item.second)
775 if (which.first ==
"x")
777 std::string x_val = which.second.get_value<std::string>();
778 pathnode.x = std::stoll(x_val);
781 else if (which.first ==
"y")
783 std::string y_val = which.second.get_value<std::string>();
784 pathnode.y = std::stoll(y_val);
786 else if (which.first ==
"z")
788 pathnode.z_exists =
true;
789 std::string z_val = which.second.get_value<std::string>();
790 pathnode.z = std::stoll(z_val);
792 else if (which.first ==
"width")
794 pathnode.width_exists =
true;
795 std::string w_val = which.second.get_value<std::string>();
796 pathnode.width = std::stoll(w_val);
801 tcm_geometry.nodes.push_back(pathnode);
810 if (
'0' <=
c &&
c <=
'9')
return c -
'0';
811 if (
'A' <=
c &&
c <=
'F')
return c -
'A' + 10;
812 if (
'a' <=
c &&
c <=
'f')
return c -
'a' + 10;
820#include "rclcpp_components/register_node_macro.hpp"
TODO for USER: Add class description.
j2735_v2x_msgs::msg::TrafficControlGeometry parse_geometry(boost::property_tree::ptree &tree)
Parse xml geometry subtree of tcm msg.
carma_ros2_utils::CallbackReturn handle_on_configure(const rclcpp_lifecycle::State &prev_state)
const char * CONTENT_ENCODING_KEY
void tcr_callback(carma_v2x_msgs::msg::TrafficControlRequest::UniquePtr msg)
TCR subscription callback.
j2735_v2x_msgs::msg::TrafficControlParams parse_params(boost::property_tree::ptree &tree)
Parse xml params subtree of tcm msg.
j2735_v2x_msgs::msg::TrafficControlSchedule parse_schedule(boost::property_tree::ptree &tree)
Parse xml schedule subtree of tcm msg.
void CloudSendAsync(const std::string &local_msg, const std::string &local_url, const std::string &local_base, const std::string &local_method)
Send async http request to carma cloud.
carma_ros2_utils::PubPtr< j2735_v2x_msgs::msg::TrafficControlMessage > tcm_pub_
unsigned char parse_hex(char c)
Convert Hex char to unsigned char.
j2735_v2x_msgs::msg::TrafficControlMessage parseTCMXML(boost::property_tree::ptree &tree)
Parse xml package of tcm msg using boost property tree xml parser.
void TCMHandler(QHttpEngine::Socket *socket)
Handles the TCM received from CARMA Cloud.
const char * CONTENT_ENCODING_VALUE
void XMLconversion(char *xml_str, carma_v2x_msgs::msg::TrafficControlRequest request_msg)
Funtion to Convert the TCR into XML format.
int CloudSend(const std::string &local_msg, const std::string &local_url, const std::string &local_base, const std::string &local_method)
Send http request to carma cloud.
QByteArray UncompressBytes(const QByteArray compressedBytes) const
Uncompress bytes using zlib library.
CarmaCloudClient(const rclcpp::NodeOptions &)
Node constructor.
j2735_v2x_msgs::msg::TrafficControlDetail parse_detail(boost::property_tree::ptree &tree)
Parse xml detail subtree of tcm msg.
j2735_v2x_msgs::msg::TrafficControlPackage parse_package(boost::property_tree::ptree &tree)
Parse xml package subtree of tcm msg.
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::TrafficControlRequest > tcr_sub_
int StartWebService()
Starts web service.
rcl_interfaces::msg::SetParametersResult parameter_update_callback(const std::vector< rclcpp::Parameter > ¶meters)
callback for dynamic parameter updates
void convert(const carma_v2x_msgs::msg::PSM &in_msg, carma_perception_msgs::msg::ExternalObject &out_msg, const std::string &map_frame_id, double pred_period, double pred_step_size, const lanelet::projection::LocalFrameProjector &map_projector, const tf2::Quaternion &ned_in_map_rotation, rclcpp::node_interfaces::NodeClockInterface::SharedPtr node_clock)
Stuct containing the algorithm configuration values for carma_cloud_client.