From 18bb03a70cd0f40d6be747ff6ddd88193b6df864 Mon Sep 17 00:00:00 2001 From: Max Schmeller <6088931+mojomex@users.noreply.github.com> Date: Tue, 26 Mar 2024 16:43:01 +0900 Subject: [PATCH] fix(nebula_launch): pass correct default path for AT128 correction file (#128) * fix(nebula_launch): pass correct default path for AT128 correction file * fix(nebula_launch): replace None with empty string for type safety --------- Co-authored-by: Max SCHMELLER --- nebula_ros/launch/nebula_launch.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nebula_ros/launch/nebula_launch.py b/nebula_ros/launch/nebula_launch.py index e29dbb4f03fc..73c516761e97 100644 --- a/nebula_ros/launch/nebula_launch.py +++ b/nebula_ros/launch/nebula_launch.py @@ -44,11 +44,14 @@ def launch_setup(context, *args, **kwargs): sensor_params_fp = os.path.join(nebula_ros_share_dir, "config", "BaseParams.yaml") assert os.path.exists(sensor_params_fp), "Sensor params yaml file under config/ was not found: {}".format(sensor_params_fp) + sensor_calib_fp = sensor_corr_fp = "" if sensor_extension is not None: # Velodyne and Hesai sensor_calib_fp = os.path.join(nebula_decoders_share_dir, "calibration", sensor_make.lower(), sensor_model + sensor_extension) assert os.path.exists(sensor_calib_fp), "Sensor calib file under calibration/ was not found: {}".format(sensor_calib_fp) - else: # Robosense - sensor_calib_fp = "" + + if sensor_model.lower() == "pandarat128": + sensor_corr_fp = os.path.splitext(sensor_calib_fp)[0] + ".dat" + assert os.path.exists(sensor_corr_fp), "Sensor corr file under calibration/ was not found: {}".format(sensor_corr_fp) with open(sensor_params_fp, "r") as f: sensor_params = yaml.safe_load(f)["/**"]["ros__parameters"] @@ -67,7 +70,7 @@ def launch_setup(context, *args, **kwargs): "sensor_ip": LaunchConfiguration("sensor_ip"), "return_mode": LaunchConfiguration("return_mode"), "calibration_file": calibration_file or sensor_calib_fp, - "correction_file": correction_file or sensor_calib_fp, + "correction_file": correction_file or sensor_corr_fp, "setup_sensor": LaunchConfiguration("setup_sensor"), "ptp_profile": LaunchConfiguration("ptp_profile"), "ptp_domain": LaunchConfiguration("ptp_domain"), @@ -90,7 +93,7 @@ def launch_setup(context, *args, **kwargs): "sensor_ip": LaunchConfiguration("sensor_ip"), "return_mode": LaunchConfiguration("return_mode"), "calibration_file": calibration_file or sensor_calib_fp, - "correction_file": correction_file or sensor_calib_fp, + "correction_file": correction_file or sensor_corr_fp, }, ], ) @@ -107,7 +110,7 @@ def launch_setup(context, *args, **kwargs): "sensor_ip": LaunchConfiguration("sensor_ip"), "return_mode": LaunchConfiguration("return_mode"), "calibration_file": calibration_file or sensor_calib_fp, - "correction_file": correction_file or sensor_calib_fp, + "correction_file": correction_file or sensor_corr_fp, "launch_hw": LaunchConfiguration("launch_hw"), "ptp_profile": LaunchConfiguration("ptp_profile"), "ptp_domain": LaunchConfiguration("ptp_domain"),