From c9f33e079f20870e21d8d0e136d8bde22685d7af Mon Sep 17 00:00:00 2001 From: joel-mb Date: Tue, 15 Jun 2021 17:18:09 +0200 Subject: [PATCH] Fix bug when spawning a vehicle with rolename other than ego_vehicle (#552) Fixes a bug when spawning a vehicle with rolename other than ego_vehicle. --- .../src/carla_spawn_objects/carla_spawn_objects.py | 4 ++-- ros_compatibility/src/ros_compatibility/node.py | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/carla_spawn_objects/src/carla_spawn_objects/carla_spawn_objects.py b/carla_spawn_objects/src/carla_spawn_objects/carla_spawn_objects.py index daad53da..0160d6a3 100755 --- a/carla_spawn_objects/src/carla_spawn_objects/carla_spawn_objects.py +++ b/carla_spawn_objects/src/carla_spawn_objects/carla_spawn_objects.py @@ -46,8 +46,8 @@ class CarlaSpawnObjects(CompatibleNode): def __init__(self): super(CarlaSpawnObjects, self).__init__('carla_spawn_objects') - self.objects_definition_file = self.get_param('objects_definition_file') - self.spawn_sensors_only = self.get_param('spawn_sensors_only', None) + self.objects_definition_file = self.get_param('objects_definition_file', '') + self.spawn_sensors_only = self.get_param('spawn_sensors_only', False) self.players = [] self.vehicles_sensors = [] diff --git a/ros_compatibility/src/ros_compatibility/node.py b/ros_compatibility/src/ros_compatibility/node.py index 3d710522..f80e8536 100644 --- a/ros_compatibility/src/ros_compatibility/node.py +++ b/ros_compatibility/src/ros_compatibility/node.py @@ -25,7 +25,7 @@ class CompatibleNode(object): def __init__(self, name, **kwargs): pass - def get_param(self, name, alternative_value=None, alternative_name=None): + def get_param(self, name, alternative_value=None): if name.startswith('/'): raise RuntimeError("Only private parameters are supported.") return rospy.get_param("~" + name, alternative_value) @@ -142,12 +142,10 @@ def __init__(self, name, **kwargs): parameter_overrides=[param], **kwargs) - def get_param(self, name, alternative_value=None, alternative_name=None): - if alternative_name is None: - alternative_name = name + def get_param(self, name, alternative_value=None): return self.get_parameter_or( name, - Parameter(alternative_name, value=alternative_value)).value + Parameter(name, value=alternative_value)).value def get_time(self): t = self.get_clock().now()