From 99e7d74a20b485ff76bff93ece7e763084f02b84 Mon Sep 17 00:00:00 2001 From: ethan Date: Wed, 12 Jun 2024 18:22:39 +0800 Subject: [PATCH 1/2] chore(launch): add default map [Town05] Change-Id: If0789b6bdca51af2db9c92bbb61281bd152470b6 --- .../launch/carla_ros_bridge_with_example_ego_vehicle.launch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/carla_ros_bridge/launch/carla_ros_bridge_with_example_ego_vehicle.launch b/carla_ros_bridge/launch/carla_ros_bridge_with_example_ego_vehicle.launch index 3ce9dedb..4949e6ff 100644 --- a/carla_ros_bridge/launch/carla_ros_bridge_with_example_ego_vehicle.launch +++ b/carla_ros_bridge/launch/carla_ros_bridge_with_example_ego_vehicle.launch @@ -11,7 +11,7 @@ - + From 0cb071fa043110b3fe612953bf6841d3048e7d63 Mon Sep 17 00:00:00 2001 From: Ethan Date: Tue, 16 Jul 2024 10:57:15 +0100 Subject: [PATCH 2/2] feat(carla_ros_bridge): adapter to carla 0.9.15 Change-Id: I822ea07dd459c85748690ef5a684a3b2018082f9 --- carla_ros_bridge/src/carla_ros_bridge/bridge.py | 7 +++---- carla_ros_bridge/src/carla_ros_bridge/sensor.py | 11 ++++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/carla_ros_bridge/src/carla_ros_bridge/bridge.py b/carla_ros_bridge/src/carla_ros_bridge/bridge.py index 9e34f499..03a73169 100755 --- a/carla_ros_bridge/src/carla_ros_bridge/bridge.py +++ b/carla_ros_bridge/src/carla_ros_bridge/bridge.py @@ -18,7 +18,7 @@ except ImportError: import Queue as queue import sys -from distutils.version import LooseVersion +from packaging.version import Version from threading import Thread, Lock, Event import carla @@ -413,13 +413,12 @@ def main(args=None): # check carla version dist = pkg_resources.get_distribution("carla") - if LooseVersion(dist.version) != LooseVersion(CarlaRosBridge.CARLA_VERSION): + if Version(dist.version).release[0] != Version(CarlaRosBridge.CARLA_VERSION).release[0]: carla_bridge.logfatal("CARLA python module version {} required. Found: {}".format( CarlaRosBridge.CARLA_VERSION, dist.version)) sys.exit(1) - if LooseVersion(carla_client.get_server_version()) != \ - LooseVersion(carla_client.get_client_version()): + if Version(carla_client.get_server_version()) != Version(carla_client.get_client_version()): carla_bridge.logwarn( "Version mismatch detected: You are trying to connect to a simulator that might be incompatible with this API. Client API version: {}. Simulator API version: {}" .format(carla_client.get_client_version(), diff --git a/carla_ros_bridge/src/carla_ros_bridge/sensor.py b/carla_ros_bridge/src/carla_ros_bridge/sensor.py index 1bdd36c3..81e8858c 100644 --- a/carla_ros_bridge/src/carla_ros_bridge/sensor.py +++ b/carla_ros_bridge/src/carla_ros_bridge/sensor.py @@ -202,14 +202,15 @@ def sensor_data_updated(self, carla_sensor_data): "This function has to be implemented by the derived classes") def _update_synchronous_event_sensor(self, frame, timestamp): + buffer_size = 5 while True: try: carla_sensor_data = self.queue.get(block=False) - if carla_sensor_data.frame != frame: - self.node.logwarn("{}({}): Received event for frame {}" - " (expected {}). Process it anyways.".format( - self.__class__.__name__, self.get_id(), - carla_sensor_data.frame, frame)) + frame_difference = abs(carla_sensor_data.frame - frame) + if frame_difference > buffer_size: + self.node.logwarn("{}({}): Received event for frame {} (expected {}). Process it anyways.".format( + self.__class__.__name__, self.get_id(), + carla_sensor_data.frame, frame)) self.node.logdebug("{}({}): process {}".format( self.__class__.__name__, self.get_id(), frame)) self.publish_tf(trans.carla_transform_to_ros_pose(