Skip to content

Commit

Permalink
fix(nebula_launch): pass correct default path for AT128 correction fi…
Browse files Browse the repository at this point in the history
…le (autowarefoundation#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 <max.schmeller@tier4.jp>
  • Loading branch information
mojomex and mojomex committed Mar 26, 2024
1 parent 5e587ba commit 18bb03a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions nebula_ros/launch/nebula_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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"),
Expand All @@ -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,
},
],
)
Expand All @@ -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"),
Expand Down

0 comments on commit 18bb03a

Please sign in to comment.