Skip to content

Commit 9dd00ec

Browse files
Added offset to game time to account
1 parent 32391ef commit 9dd00ec

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

srunner/autoagents/autoware_carla_interface/carla_ros.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
SensorInterface,
5656
)
5757

58+
from srunner.tools.CARLA_manager import CARLAManager
5859

5960
class carla_ros2_interface(object):
6061
def __init__(self):
@@ -84,6 +85,8 @@ def __init__(self):
8485
sensor: datetime.datetime.now() for sensor in self.sensor_frequencies
8586
}
8687

88+
self.game_time_offset = CARLAManager.FIXED_DELTA_SECONDS * 3 # offset to account for initilisation ticks
89+
8790
self.ros2_node = rclpy.create_node("carla_ros2_interface")
8891

8992
# Publish clock
@@ -168,7 +171,7 @@ def __init__(self):
168171

169172
def __call__(self):
170173
input_data = self.sensor_interface.get_data()
171-
timestamp = GameTime.get_time()
174+
timestamp = GameTime.get_time() - self.game_time_offset
172175
control = self.run_step(input_data, timestamp)
173176
return control
174177

0 commit comments

Comments
 (0)