Skip to content

Commit

Permalink
fix(hesai_ros_wrapper): disallow cutting at start of scan (except for…
Browse files Browse the repository at this point in the history
… 360deg FoV) to avoid publishing pointclouds later than necessary.
  • Loading branch information
mojomex committed Sep 4, 2024
1 parent acf2a49 commit 96d46df
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions nebula_ros/src/hesai/hesai_ros_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,10 @@ nebula::Status HesaiRosWrapper::DeclareAndGetSensorConfigParams()

{
rcl_interfaces::msg::ParameterDescriptor descriptor = param_read_write();
descriptor.floating_point_range = float_range(0, 360, 0.01);
descriptor.floating_point_range = float_range(0, 359.99, 0.01);
config.cut_angle = declare_parameter<double>("cut_angle", descriptor);
}

if (config.cut_angle == 360.0) {
RCLCPP_WARN_STREAM(
get_logger(),
"Cut angle was set to 360 deg, overriding with canonical representation of 0 deg.");
config.cut_angle = 0.0;
set_parameter(rclcpp::Parameter("cut_angle", 0.0));
}

{
rcl_interfaces::msg::ParameterDescriptor descriptor = param_read_write();
descriptor.integer_range = int_range(0, 359, 1);
Expand Down Expand Up @@ -230,9 +222,9 @@ Status HesaiRosWrapper::ValidateAndSetConfig(
new_config->cloud_min_angle, new_config->cloud_max_angle, new_config->cut_angle)) {
RCLCPP_ERROR(get_logger(), "Cannot cut scan outside of the FoV.");
}
if (
new_config->sensor_model == drivers::SensorModel::HESAI_PANDARAT128 &&
new_config->cut_angle == new_config->cloud_min_angle) {

bool fov_is_360 = new_config->cloud_min_angle == 0 && new_config->cloud_max_angle == 360;
if (new_config->cut_angle == new_config->cloud_min_angle) {
RCLCPP_ERROR(
get_logger(), "Cannot cut scan right at the start of the FoV. Cut at the end instead.");
return Status::SENSOR_CONFIG_ERROR;
Expand Down

0 comments on commit 96d46df

Please sign in to comment.