From e8bd0f4f7d3fb641b42203e85f71bb37f638c9e4 Mon Sep 17 00:00:00 2001 From: Bjoern Petersen Date: Mon, 26 Jun 2023 17:49:00 +0200 Subject: [PATCH] Fix absolute path problem in launch file --- .../launch/fsds_ros2_bridge.launch.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ros2/src/fsds_ros2_bridge/launch/fsds_ros2_bridge.launch.py b/ros2/src/fsds_ros2_bridge/launch/fsds_ros2_bridge.launch.py index b8f76687..532ae11a 100644 --- a/ros2/src/fsds_ros2_bridge/launch/fsds_ros2_bridge.launch.py +++ b/ros2/src/fsds_ros2_bridge/launch/fsds_ros2_bridge.launch.py @@ -1,18 +1,22 @@ +import os + import launch import launch_ros.actions -from os.path import expanduser -import json +import json +import re CAMERA_FRAMERATE = 30.0 + def generate_launch_description(): - with open(expanduser("~")+'/Formula-Student-Driverless-Simulator/settings.json', 'r') as file: + with open(re.sub('ros2/install/fsds_ros2_bridge/share/fsds_ros2_bridge/launch', 'settings.json', + os.path.dirname(__file__)), 'r') as file: settings = json.load(file) camera_configs = settings['Vehicles']['FSCar']['Cameras'] - if(not camera_configs): - print('no cameras configured in ~/Formula-Student-Driverless-Simulator/settings.json') + if not camera_configs: + print('no cameras configured in settings.json') camera_nodes = [ launch_ros.actions.Node(