Skip to content

Commit

Permalink
add range parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Yukihiro Saito <[email protected]>
  • Loading branch information
yukkysaito committed Feb 22, 2024
1 parent 76526ca commit 9b82192
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ class HesaiDecoder : public HesaiScanDecoder

auto distance = getDistance(unit);

if (distance < SensorT::MIN_RANGE || distance > SensorT::MAX_RANGE) {
if (
distance < SensorT::MIN_RANGE || SensorT::MAX_RANGE < distance ||
distance < sensor_configuration_->min_range ||
sensor_configuration_->max_range < distance) {
continue;
}

Expand Down
18 changes: 18 additions & 0 deletions nebula_ros/src/hesai/hesai_decoder_ros_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,24 @@ Status HesaiDriverRosWrapper::GetParameters(
calibration_configuration.calibration_file =
this->get_parameter("calibration_file").as_string();
}
{
rcl_interfaces::msg::ParameterDescriptor descriptor;
descriptor.type = rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE;
descriptor.read_only = false;
descriptor.dynamic_typing = false;
descriptor.additional_constraints = "";
this->declare_parameter<double>("min_range", 0.3, descriptor);
sensor_configuration.min_range = this->get_parameter("min_range").as_double();
}
{
rcl_interfaces::msg::ParameterDescriptor descriptor;
descriptor.type = rcl_interfaces::msg::ParameterType::PARAMETER_DOUBLE;
descriptor.read_only = false;
descriptor.dynamic_typing = false;
descriptor.additional_constraints = "";
this->declare_parameter<double>("max_range", 300., descriptor);
sensor_configuration.max_range = this->get_parameter("max_range").as_double();
}
if (sensor_configuration.sensor_model == drivers::SensorModel::HESAI_PANDARAT128) {
rcl_interfaces::msg::ParameterDescriptor descriptor;
descriptor.type = rcl_interfaces::msg::ParameterType::PARAMETER_STRING;
Expand Down

0 comments on commit 9b82192

Please sign in to comment.