From d5061cd580c7baed5dad465c4b6eaa9a36c3292d Mon Sep 17 00:00:00 2001 From: Felix F Xu <84662027+felixf4xu@users.noreply.github.com> Date: Mon, 5 Feb 2024 12:14:57 +0800 Subject: [PATCH 1/3] build: make #include internal to cpp file (#117) --- nebula_decoders/CMakeLists.txt | 1 + .../decoders/velodyne_scan_decoder.hpp | 6 ------ .../src/nebula_decoders_velodyne/decoders/vlp16_decoder.cpp | 2 ++ .../src/nebula_decoders_velodyne/decoders/vlp32_decoder.cpp | 2 ++ .../nebula_decoders_velodyne/decoders/vls128_decoder.cpp | 2 ++ 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/nebula_decoders/CMakeLists.txt b/nebula_decoders/CMakeLists.txt index 6f38b97af..d08b16d6a 100644 --- a/nebula_decoders/CMakeLists.txt +++ b/nebula_decoders/CMakeLists.txt @@ -14,6 +14,7 @@ if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic -Wunused-function) endif () +find_package(angles REQUIRED) find_package(PCL REQUIRED) find_package(pcl_conversions REQUIRED) find_package(yaml-cpp REQUIRED) diff --git a/nebula_decoders/include/nebula_decoders/nebula_decoders_velodyne/decoders/velodyne_scan_decoder.hpp b/nebula_decoders/include/nebula_decoders/nebula_decoders_velodyne/decoders/velodyne_scan_decoder.hpp index 50937e66f..7c319e0fe 100644 --- a/nebula_decoders/include/nebula_decoders/nebula_decoders_velodyne/decoders/velodyne_scan_decoder.hpp +++ b/nebula_decoders/include/nebula_decoders/nebula_decoders_velodyne/decoders/velodyne_scan_decoder.hpp @@ -12,12 +12,6 @@ #include #include -#if defined(ROS_DISTRO_FOXY) || defined(ROS_DISTRO_GALACTIC) -#include //Galactic -#else -#include //Humble -#endif - #include "nebula_common/point_types.hpp" #include "nebula_common/velodyne/velodyne_calibration_decoder.hpp" #include "nebula_common/velodyne/velodyne_common.hpp" diff --git a/nebula_decoders/src/nebula_decoders_velodyne/decoders/vlp16_decoder.cpp b/nebula_decoders/src/nebula_decoders_velodyne/decoders/vlp16_decoder.cpp index e1e9062f0..338163d60 100644 --- a/nebula_decoders/src/nebula_decoders_velodyne/decoders/vlp16_decoder.cpp +++ b/nebula_decoders/src/nebula_decoders_velodyne/decoders/vlp16_decoder.cpp @@ -3,6 +3,8 @@ #include #include +#include + namespace nebula { namespace drivers diff --git a/nebula_decoders/src/nebula_decoders_velodyne/decoders/vlp32_decoder.cpp b/nebula_decoders/src/nebula_decoders_velodyne/decoders/vlp32_decoder.cpp index 25feaf8f7..ec3e06745 100644 --- a/nebula_decoders/src/nebula_decoders_velodyne/decoders/vlp32_decoder.cpp +++ b/nebula_decoders/src/nebula_decoders_velodyne/decoders/vlp32_decoder.cpp @@ -3,6 +3,8 @@ #include #include +#include + namespace nebula { namespace drivers diff --git a/nebula_decoders/src/nebula_decoders_velodyne/decoders/vls128_decoder.cpp b/nebula_decoders/src/nebula_decoders_velodyne/decoders/vls128_decoder.cpp index 23442a6f3..c42f9b0b5 100644 --- a/nebula_decoders/src/nebula_decoders_velodyne/decoders/vls128_decoder.cpp +++ b/nebula_decoders/src/nebula_decoders_velodyne/decoders/vls128_decoder.cpp @@ -3,6 +3,8 @@ #include #include +#include + namespace nebula { namespace drivers From 76526caf873028c90f64179f4aea0d756a9572f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Emin=20BA=C5=9EO=C4=9ELU?= Date: Mon, 5 Feb 2024 12:04:23 +0300 Subject: [PATCH 2/3] fix(nebula_ros): remove calibration file argument from robosense launch (#116) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mehmet Emin BAŞOĞLU Co-authored-by: Kenzo Lobos Tsunekawa --- nebula_ros/launch/robosense_launch.all_hw.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/nebula_ros/launch/robosense_launch.all_hw.xml b/nebula_ros/launch/robosense_launch.all_hw.xml index 8a3f73037..6e2ab6dda 100644 --- a/nebula_ros/launch/robosense_launch.all_hw.xml +++ b/nebula_ros/launch/robosense_launch.all_hw.xml @@ -5,8 +5,6 @@ - - From 4651feb325a95296ac711fceaf85af628d635d4c Mon Sep 17 00:00:00 2001 From: Yukihiro Saito Date: Wed, 28 Feb 2024 15:28:56 +0900 Subject: [PATCH 3/3] feat: range param for hesai (#121) * add range parameter Signed-off-by: Yukihiro Saito * add test Signed-off-by: Yukihiro Saito * fix test param Signed-off-by: Yukihiro Saito * hesai tests. set default min max range depending on model Signed-off-by: amc-nu --------- Signed-off-by: Yukihiro Saito Signed-off-by: amc-nu Co-authored-by: amc-nu --- .../decoders/hesai_decoder.hpp | 5 +++- .../src/hesai/hesai_decoder_ros_wrapper.cpp | 18 ++++++++++++ nebula_tests/hesai/hesai_ros_decoder_test.cpp | 21 +++++++++++++- nebula_tests/hesai/hesai_ros_decoder_test.hpp | 5 +++- .../hesai/hesai_ros_decoder_test.yaml | 2 ++ .../hesai/hesai_ros_decoder_test_main.cpp | 29 +++++++++++++++++++ 6 files changed, 77 insertions(+), 3 deletions(-) diff --git a/nebula_decoders/include/nebula_decoders/nebula_decoders_hesai/decoders/hesai_decoder.hpp b/nebula_decoders/include/nebula_decoders/nebula_decoders_hesai/decoders/hesai_decoder.hpp index cc589e929..7bdfd069e 100644 --- a/nebula_decoders/include/nebula_decoders/nebula_decoders_hesai/decoders/hesai_decoder.hpp +++ b/nebula_decoders/include/nebula_decoders/nebula_decoders_hesai/decoders/hesai_decoder.hpp @@ -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; } diff --git a/nebula_ros/src/hesai/hesai_decoder_ros_wrapper.cpp b/nebula_ros/src/hesai/hesai_decoder_ros_wrapper.cpp index d8e206995..573de5696 100644 --- a/nebula_ros/src/hesai/hesai_decoder_ros_wrapper.cpp +++ b/nebula_ros/src/hesai/hesai_decoder_ros_wrapper.cpp @@ -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("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("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; diff --git a/nebula_tests/hesai/hesai_ros_decoder_test.cpp b/nebula_tests/hesai/hesai_ros_decoder_test.cpp index bc6852d2d..a07a4dabd 100644 --- a/nebula_tests/hesai/hesai_ros_decoder_test.cpp +++ b/nebula_tests/hesai/hesai_ros_decoder_test.cpp @@ -148,6 +148,24 @@ Status HesaiRosDecoderTest::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 = true; + descriptor.dynamic_typing = false; + descriptor.additional_constraints = ""; + this->declare_parameter("min_range", params_.min_range, 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 = true; + descriptor.dynamic_typing = false; + descriptor.additional_constraints = ""; + this->declare_parameter("max_range", params_.max_range, 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; @@ -217,7 +235,8 @@ Status HesaiRosDecoderTest::GetParameters( if (sensor_configuration.return_mode == nebula::drivers::ReturnMode::UNKNOWN) { return Status::INVALID_ECHO_MODE; } - if (sensor_configuration.frame_id.empty() || sensor_configuration.scan_phase > 360) { + if ( + sensor_configuration.frame_id.empty() || sensor_configuration.scan_phase > 360) { return Status::SENSOR_CONFIG_ERROR; } if (calibration_configuration.calibration_file.empty()) { diff --git a/nebula_tests/hesai/hesai_ros_decoder_test.hpp b/nebula_tests/hesai/hesai_ros_decoder_test.hpp index b66c996f8..a0477a366 100644 --- a/nebula_tests/hesai/hesai_ros_decoder_test.hpp +++ b/nebula_tests/hesai/hesai_ros_decoder_test.hpp @@ -40,6 +40,8 @@ struct HesaiRosDecoderTestParams std::string correction_file = ""; std::string frame_id = "hesai"; double scan_phase = 0.; + double min_range = 0.3; + double max_range = 300.; std::string storage_id = "sqlite3"; std::string format = "cdr"; std::string target_topic = "/pandar_packets"; @@ -108,7 +110,8 @@ class HesaiRosDecoderTest final : public rclcpp::Node, NebulaDriverRosWrapperBas /// @brief Read the specified bag file and compare the constructed point clouds with the /// corresponding PCD files - void ReadBag(std::function scan_callback); + void ReadBag( + std::function scan_callback); HesaiRosDecoderTestParams params_; }; diff --git a/nebula_tests/hesai/hesai_ros_decoder_test.yaml b/nebula_tests/hesai/hesai_ros_decoder_test.yaml index 0878791a3..ea4b66a98 100644 --- a/nebula_tests/hesai/hesai_ros_decoder_test.yaml +++ b/nebula_tests/hesai/hesai_ros_decoder_test.yaml @@ -12,6 +12,8 @@ rotation_speed: 200 # Motor RPM, the sensor's internal spin rate. cloud_min_angle: 0 # Field of View, start degrees. cloud_max_angle: 360 # Field of View, end degrees. + min_range: 0.3 # Minimum range. + max_range: 300. # Maximum range. diag_span: 1000 # milliseconds calibration_file: "./install/nebula_decoders/share/nebula_decoders/calibration/hesai/PandarAT128.csv" correction_file: "./install/nebula_decoders/share/nebula_decoders/calibration/hesai/PandarAT128.dat" diff --git a/nebula_tests/hesai/hesai_ros_decoder_test_main.cpp b/nebula_tests/hesai/hesai_ros_decoder_test_main.cpp index feda648f0..96ff00c3c 100644 --- a/nebula_tests/hesai/hesai_ros_decoder_test_main.cpp +++ b/nebula_tests/hesai/hesai_ros_decoder_test_main.cpp @@ -24,12 +24,22 @@ const nebula::ros::HesaiRosDecoderTestParams TEST_CONFIGS[6] = { "Dual", "Pandar40P.csv", "40p/1673400149412331409", + "", + "hesai", + 0, + 0.3f, + 200.f }, { "Pandar64", "Dual", "Pandar64.csv", "64/1673403880599376836", + "", + "hesai", + 0, + 0.3f, + 200.f }, { "PandarAT128", @@ -37,24 +47,43 @@ const nebula::ros::HesaiRosDecoderTestParams TEST_CONFIGS[6] = { "PandarAT128.csv", "at128/1679653308406038376", "PandarAT128.dat", + "hesai", + 0, + 1.f, + 180.f }, { "PandarQT64", "Dual", "PandarQT64.csv", "qt64/1673401195788312575", + "", + "hesai", + 0, + 0.1f, + 60.f }, { "PandarXT32", "Dual", "PandarXT32.csv", "xt32/1673400677802009732", + "", + "hesai", + 0, + 0.05f, + 120.f }, { "PandarXT32M", "LastStrongest", "PandarXT32M.csv", "xt32m/1660893203042895158", + "", + "hesai", + 0, + 0.5f, + 300.f }}; // Compares geometrical output of decoder against pre-recorded reference pointcloud.