From 16f608faec614811695f67e197c3ac241eb0a60a Mon Sep 17 00:00:00 2001 From: Tiago Garcia Date: Fri, 13 Sep 2024 16:58:15 +0100 Subject: [PATCH] enconding fixes Signed-off-by: Tiago Garcia --- src/cam_application.cpp | 3 ++- src/cpm_application.cpp | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cam_application.cpp b/src/cam_application.cpp index 875493e..1b51dca 100644 --- a/src/cam_application.cpp +++ b/src/cam_application.cpp @@ -348,7 +348,8 @@ namespace v2x bvc.yawRate.yawRateConfidence = YawRateConfidence_unavailable; // ------------------------------ - RCLCPP_INFO(node_->get_logger(), "[CamApplication::send] Sending CAM from station with ID %ld with generationDeltaTime %ld", stationId_, cam.generationDeltaTime); + RCLCPP_INFO(node_->get_logger(), "[CamApplication::send] Sending CAM from station with ID %ld with generationDeltaTime %ld, latitude %f, longitude %f, altitude %f", + stationId_, cam.generationDeltaTime, ego_.latitude, ego_.longitude, ego_.altitude); std::unique_ptr payload{new geonet::DownPacket()}; payload->layer(OsiLayer::Application) = std::move(message); diff --git a/src/cpm_application.cpp b/src/cpm_application.cpp index 83970c7..7f21eb1 100644 --- a/src/cpm_application.cpp +++ b/src/cpm_application.cpp @@ -440,7 +440,6 @@ namespace v2x { } void CpmApplication::send() { - if (is_sender_) { sending_ = true; @@ -449,6 +448,8 @@ namespace v2x { // RCLCPP_INFO(node_->get_logger(), "[CpmApplication::send] Sending CPM..."); + std::chrono::milliseconds now_ms = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()); + vanetza::asn1::Cpm message; // ITS PDU Header @@ -461,8 +462,7 @@ namespace v2x { // Set GenerationTime RCLCPP_INFO(node_->get_logger(), "[CpmApplication::send] %ld", gdt_timestamp_); - //asn_long2INTEGER(&cpm.generationTime, (long) gdt_timestamp_); - cpm.generationDeltaTime = gdt_timestamp_; + cpm.generationDeltaTime = (now_ms.count() - 1072915200000) % 65536; CpmManagementContainer_t &management = cpm.cpmParameters.managementContainer; management.stationType = StationType_passengerCar;