From 97c2256dd9927ea92182a0c13bc231688193cbb7 Mon Sep 17 00:00:00 2001 From: Kenzo Lobos-Tsunekawa Date: Thu, 26 Dec 2024 13:09:25 +0900 Subject: [PATCH 1/4] feat: hack to produce correct-looking objects for corner ars548 radars. This essentially assumes that continental ignores the configuration's yaw for FRONT corner radars. Kinematics will be wrong no matter what... Signed-off-by: Kenzo Lobos-Tsunekawa --- .../decoders/continental_ars548_decoder.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nebula_decoders/src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp b/nebula_decoders/src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp index a6d3e983f..72f4b92df 100644 --- a/nebula_decoders/src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp +++ b/nebula_decoders/src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp @@ -345,6 +345,20 @@ bool ContinentalARS548Decoder::parse_objects_list_packet( object_msg.orientation = object.position_orientation.value(); object_msg.orientation_std = object.position_orientation_std.value(); + if ( + std::abs(radar_status_.yaw) > 5.0 * M_PI / 180.0 && + std::abs(radar_status_.yaw) < 90.0 * M_PI / 180.0) { + const double dx = radar_status_.longitudinal + radar_status_.wheel_base; + const double dy = radar_status_.lateral; + double x = object_msg.position.x - dx; + double y = object_msg.position.y - dy; + const auto & yaw = radar_status_.yaw; + + object_msg.position.x = x * std::cos(yaw) - y * std::sin(yaw) + dx; + object_msg.position.y = x * std::sin(yaw) + y * std::cos(yaw) + dy; + object_msg.orientation += yaw; + } + object_msg.existence_probability = object.existence_probability.value(); object_msg.classification_car = object.classification_car; object_msg.classification_truck = object.classification_truck; From f49bb47cfc91c4f9b6e95e9aac569a648b13a141 Mon Sep 17 00:00:00 2001 From: Kenzo Lobos-Tsunekawa Date: Wed, 8 Jan 2025 09:41:44 +0900 Subject: [PATCH 2/4] chore: added log messages to warn the user against using corner radars (it should only be for evaluation purposes) Signed-off-by: Kenzo Lobos-Tsunekawa --- .../decoders/continental_ars548_decoder.cpp | 6 ++++++ .../continental_ars548_decoder_wrapper.cpp | 17 +++++++++++++++++ .../continental_ars548_hw_interface_wrapper.cpp | 17 +++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/nebula_decoders/src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp b/nebula_decoders/src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp index 72f4b92df..936db1e7a 100644 --- a/nebula_decoders/src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp +++ b/nebula_decoders/src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp @@ -345,6 +345,12 @@ bool ContinentalARS548Decoder::parse_objects_list_packet( object_msg.orientation = object.position_orientation.value(); object_msg.orientation_std = object.position_orientation_std.value(); + // NOTE(knzo25): In the radar firmware used when developing this driver, + // corner radars are not supported. We can partially address this, + // but the coordinates look only spatially correct (not the dynamics). + // so its use is the responsibility of the user. + // Corner radars are expected to be supported in a new firmware version, + // but this is not yet confirmed. if ( std::abs(radar_status_.yaw) > 5.0 * M_PI / 180.0 && std::abs(radar_status_.yaw) < 90.0 * M_PI / 180.0) { diff --git a/nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp b/nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp index 1bdfdd717..0e3129559 100644 --- a/nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp +++ b/nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp @@ -191,6 +191,23 @@ void ContinentalARS548DecoderWrapper::object_list_callback( void ContinentalARS548DecoderWrapper::sensor_status_callback( const drivers::continental_ars548::ContinentalARS548Status & sensor_status) { + // NOTE(knzo25): In the radar firmware used when developing this driver, + // corner radars are not supported. We can partially address this, + // but the coordinates look only spatially correct (not the dynamics). + // so its use is the responsibility of the user. + // Corner radars are expected to be supported in a new firmware version, + // but this is not yet confirmed. + if ( + std::abs(radar_status_.yaw) > 5.0 * M_PI / 180.0 && + std::abs(radar_status_.yaw) < 90.0 * M_PI / 180.0) { + RCLCPP_WARN_THROTTLE( + logger_, *rclcpp::Clock::now(), 5000, + "This radar has been configured as a corner radar, which is not supported by the sensor. We " + "can partially address this, but the coordinates look only spatially correct (not the " + "dynamics). so its use is the responsibility of the user. Corner radars are expected to be " + "supported in a new firmware version, but this is not yet confirmed."); + } + diagnostic_msgs::msg::DiagnosticArray diagnostic_array_msg; diagnostic_array_msg.header.stamp.sec = sensor_status.timestamp_seconds; diagnostic_array_msg.header.stamp.nanosec = sensor_status.timestamp_nanoseconds; diff --git a/nebula_ros/src/continental/continental_ars548_hw_interface_wrapper.cpp b/nebula_ros/src/continental/continental_ars548_hw_interface_wrapper.cpp index 0fc179524..333c7fd61 100644 --- a/nebula_ros/src/continental/continental_ars548_hw_interface_wrapper.cpp +++ b/nebula_ros/src/continental/continental_ars548_hw_interface_wrapper.cpp @@ -215,6 +215,23 @@ void ContinentalARS548HwInterfaceWrapper::set_sensor_mounting_request_callback( pitch = rpy.y; } + // NOTE(knzo25): In the radar firmware used when developing this driver, + // corner radars are not supported. We can partially address this, + // but the coordinates look only spatially correct (not the dynamics). + // so its use is the responsibility of the user. + // Corner radars are expected to be supported in a new firmware version, + // but this is not yet confirmed. + if ( + std::abs(radar_status_.yaw) > 5.0 * M_PI / 180.0 && + std::abs(radar_status_.yaw) < 90.0 * M_PI / 180.0) { + RCLCPP_WARN( + logger_, *rclcpp::Clock::now(), 5000, + "This radar has been configured as a corner radar, which is not supported by the sensor. We " + "can partially address this, but the coordinates look only spatially correct (not the " + "dynamics). so its use is the responsibility of the user. Corner radars are expected to be " + "supported in a new firmware version, but this is not yet confirmed."); + } + auto result = hw_interface_->set_sensor_mounting( longitudinal, lateral, vertical, yaw, pitch, request->plug_orientation); From de1ba743f1aa1c8fc1c35e5c592c7303e24759ac Mon Sep 17 00:00:00 2001 From: Kenzo Lobos-Tsunekawa Date: Wed, 8 Jan 2025 10:25:20 +0900 Subject: [PATCH 3/4] fix: fixed compilation and spells Signed-off-by: Kenzo Lobos-Tsunekawa --- .../decoders/continental_ars548_decoder.cpp | 1 + .../continental/continental_ars548_decoder_wrapper.cpp | 8 +++++--- .../continental_ars548_hw_interface_wrapper.cpp | 7 +++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/nebula_decoders/src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp b/nebula_decoders/src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp index 936db1e7a..c2ee20c54 100644 --- a/nebula_decoders/src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp +++ b/nebula_decoders/src/nebula_decoders_continental/decoders/continental_ars548_decoder.cpp @@ -345,6 +345,7 @@ bool ContinentalARS548Decoder::parse_objects_list_packet( object_msg.orientation = object.position_orientation.value(); object_msg.orientation_std = object.position_orientation_std.value(); + // cSpell:ignore knzo25 // NOTE(knzo25): In the radar firmware used when developing this driver, // corner radars are not supported. We can partially address this, // but the coordinates look only spatially correct (not the dynamics). diff --git a/nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp b/nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp index 0e3129559..a0040b8f2 100644 --- a/nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp +++ b/nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp @@ -191,6 +191,7 @@ void ContinentalARS548DecoderWrapper::object_list_callback( void ContinentalARS548DecoderWrapper::sensor_status_callback( const drivers::continental_ars548::ContinentalARS548Status & sensor_status) { + // cSpell:ignore knzo25 // NOTE(knzo25): In the radar firmware used when developing this driver, // corner radars are not supported. We can partially address this, // but the coordinates look only spatially correct (not the dynamics). @@ -198,10 +199,11 @@ void ContinentalARS548DecoderWrapper::sensor_status_callback( // Corner radars are expected to be supported in a new firmware version, // but this is not yet confirmed. if ( - std::abs(radar_status_.yaw) > 5.0 * M_PI / 180.0 && - std::abs(radar_status_.yaw) < 90.0 * M_PI / 180.0) { + std::abs(sensor_status.yaw) > 5.0 * M_PI / 180.0 && + std::abs(sensor_status.yaw) < 90.0 * M_PI / 180.0) { + rclcpp::Clock clock{RCL_ROS_TIME}; RCLCPP_WARN_THROTTLE( - logger_, *rclcpp::Clock::now(), 5000, + logger_, clock, 5000, "This radar has been configured as a corner radar, which is not supported by the sensor. We " "can partially address this, but the coordinates look only spatially correct (not the " "dynamics). so its use is the responsibility of the user. Corner radars are expected to be " diff --git a/nebula_ros/src/continental/continental_ars548_hw_interface_wrapper.cpp b/nebula_ros/src/continental/continental_ars548_hw_interface_wrapper.cpp index 333c7fd61..905e8a40b 100644 --- a/nebula_ros/src/continental/continental_ars548_hw_interface_wrapper.cpp +++ b/nebula_ros/src/continental/continental_ars548_hw_interface_wrapper.cpp @@ -215,17 +215,16 @@ void ContinentalARS548HwInterfaceWrapper::set_sensor_mounting_request_callback( pitch = rpy.y; } + // cSpell:ignore knzo25 // NOTE(knzo25): In the radar firmware used when developing this driver, // corner radars are not supported. We can partially address this, // but the coordinates look only spatially correct (not the dynamics). // so its use is the responsibility of the user. // Corner radars are expected to be supported in a new firmware version, // but this is not yet confirmed. - if ( - std::abs(radar_status_.yaw) > 5.0 * M_PI / 180.0 && - std::abs(radar_status_.yaw) < 90.0 * M_PI / 180.0) { + if (std::abs(yaw) > 5.0 * M_PI / 180.0 && std::abs(yaw) < 90.0 * M_PI / 180.0) { RCLCPP_WARN( - logger_, *rclcpp::Clock::now(), 5000, + logger_, "This radar has been configured as a corner radar, which is not supported by the sensor. We " "can partially address this, but the coordinates look only spatially correct (not the " "dynamics). so its use is the responsibility of the user. Corner radars are expected to be " From 9ab56a108d17871456bdb5e5d6c386259dac7ff1 Mon Sep 17 00:00:00 2001 From: Kenzo Lobos-Tsunekawa Date: Wed, 8 Jan 2025 10:42:10 +0900 Subject: [PATCH 4/4] feat: added a diagnostics message Signed-off-by: Kenzo Lobos-Tsunekawa --- .../continental_ars548_decoder_wrapper.cpp | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp b/nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp index a0040b8f2..7515fb010 100644 --- a/nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp +++ b/nebula_ros/src/continental/continental_ars548_decoder_wrapper.cpp @@ -191,6 +191,19 @@ void ContinentalARS548DecoderWrapper::object_list_callback( void ContinentalARS548DecoderWrapper::sensor_status_callback( const drivers::continental_ars548::ContinentalARS548Status & sensor_status) { + diagnostic_msgs::msg::DiagnosticArray diagnostic_array_msg; + diagnostic_array_msg.header.stamp.sec = sensor_status.timestamp_seconds; + diagnostic_array_msg.header.stamp.nanosec = sensor_status.timestamp_nanoseconds; + diagnostic_array_msg.header.frame_id = config_ptr_->frame_id; + + diagnostic_array_msg.status.resize(1); + auto & status = diagnostic_array_msg.status[0]; + status.values.reserve(36); + status.level = diagnostic_msgs::msg::DiagnosticStatus::OK; + status.hardware_id = config_ptr_->frame_id; + status.name = config_ptr_->frame_id; + status.message = "Diagnostic messages from ARS548"; + // cSpell:ignore knzo25 // NOTE(knzo25): In the radar firmware used when developing this driver, // corner radars are not supported. We can partially address this, @@ -208,20 +221,12 @@ void ContinentalARS548DecoderWrapper::sensor_status_callback( "can partially address this, but the coordinates look only spatially correct (not the " "dynamics). so its use is the responsibility of the user. Corner radars are expected to be " "supported in a new firmware version, but this is not yet confirmed."); - } - diagnostic_msgs::msg::DiagnosticArray diagnostic_array_msg; - diagnostic_array_msg.header.stamp.sec = sensor_status.timestamp_seconds; - diagnostic_array_msg.header.stamp.nanosec = sensor_status.timestamp_nanoseconds; - diagnostic_array_msg.header.frame_id = config_ptr_->frame_id; - - diagnostic_array_msg.status.resize(1); - auto & status = diagnostic_array_msg.status[0]; - status.values.reserve(36); - status.level = diagnostic_msgs::msg::DiagnosticStatus::OK; - status.hardware_id = config_ptr_->frame_id; - status.name = config_ptr_->frame_id; - status.message = "Diagnostic messages from ARS548"; + status.level = diagnostic_msgs::msg::DiagnosticStatus::WARN; + status.message += + ". Unsupported mounting configuration (corner radar). This should only be used for " + "evaluation purposes."; + } auto add_diagnostic = [&status](const std::string & key, const std::string & value) { diagnostic_msgs::msg::KeyValue key_value;