From 30450fad718cc6e0fca002f4c6ea70cf1efb38d6 Mon Sep 17 00:00:00 2001 From: Max SCHMELLER Date: Tue, 17 Sep 2024 16:00:02 +0900 Subject: [PATCH] fix(hesai): handle cut at 0/360deg correctly for non-360 and 360deg FoVs --- nebula_ros/src/hesai/hesai_ros_wrapper.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nebula_ros/src/hesai/hesai_ros_wrapper.cpp b/nebula_ros/src/hesai/hesai_ros_wrapper.cpp index c064fdbc..48283c34 100644 --- a/nebula_ros/src/hesai/hesai_ros_wrapper.cpp +++ b/nebula_ros/src/hesai/hesai_ros_wrapper.cpp @@ -113,7 +113,7 @@ nebula::Status HesaiRosWrapper::DeclareAndGetSensorConfigParams() { rcl_interfaces::msg::ParameterDescriptor descriptor = param_read_write(); - descriptor.floating_point_range = float_range(0, 359.99, 0.01); + descriptor.floating_point_range = float_range(0, 360, 0.01); descriptor.description = "At which angle to start a new scan. Cannot be equal to the start angle in a non-360 deg " "FoV. Choose the end angle instead."; @@ -240,6 +240,13 @@ Status HesaiRosWrapper::ValidateAndSetConfig( return Status::SENSOR_CONFIG_ERROR; } + // Handling cutting at 360deg (as opposed to 0deg) for a full 360deg FoV requires a special case + // in the cutting logic. Thus, require the user to cut at 0deg. + if (fov_is_360 && new_config->cut_angle == 360) { + RCLCPP_ERROR(get_logger(), "Cannot cut a 360deg FoV at 360deg. Cut at 0deg instead."); + return Status::SENSOR_CONFIG_ERROR; + } + if (hw_interface_wrapper_) { hw_interface_wrapper_->OnConfigChange(new_config); }