Implementation:CARLA simulator Carla Start Replaying Tool
| Knowledge Sources | |
|---|---|
| Domains | Simulation, Recording, Utility |
| Last Updated | 2026-02-15 05:00 GMT |
Overview
Command-line utility script that replays a CARLA recorder file with configurable start time, duration, camera following, time factor, hero vehicle handling, spectator movement, and sensor spawning.
Description
This script (start_replaying.py) initiates playback of a recorded CARLA simulation session. Before calling client.replay_file(), it configures the replayer with client.set_replayer_time_factor() for playback speed control, client.set_replayer_ignore_hero() to optionally skip hero vehicle replay, and client.set_replayer_ignore_spectator() to control spectator camera movement during replay. The replay supports specifying a start time (-s), duration (-d), camera follow target actor (-c), and whether to spawn sensors in the replayed world (--spawn-sensors). The script uses a 60-second client timeout to handle large recording files.
Usage
Use this tool to replay recorded simulation sessions for analysis, debugging, or demonstration purposes. It supports both full and partial playback with configurable time scaling.
Code Reference
Source Location
- Repository: CARLA
- File: PythonAPI/util/start_replaying.py
Signature
def main():
"""Configure and start replaying a CARLA recorder file."""
# Sets replayer_time_factor, ignore_hero, ignore_spectator
# Calls client.replay_file(filename, start, duration, camera, spawn_sensors)
Import
# Run as a command-line tool:
python start_replaying.py -f recording.log -s 10 -d 60
I/O Contract
| Argument | Type | Default | Description |
|---|---|---|---|
| --host | str | 127.0.0.1 | CARLA server IP address |
| -p, --port | int | 2000 | CARLA server TCP port |
| -s, --start | float | 0.0 | Start time in seconds |
| -d, --duration | float | 0.0 | Duration in seconds (0 = full) |
| -f, --recorder-filename | str | test1.log | Recorder file to replay |
| -c, --camera | int | 0 | Actor ID for camera to follow (0 = disabled) |
| -x, --time-factor | float | 1.0 | Playback speed factor |
| -i, --ignore-hero | flag | False | Skip hero vehicle during replay |
| --move-spectator | flag | False | Move spectator camera during replay |
| --spawn-sensors | flag | False | Spawn sensors in replayed world |
Usage Examples
# Replay entire recording
python start_replaying.py -f my_recording.log
# Replay starting at 30 seconds for 60 seconds
python start_replaying.py -f my_recording.log -s 30 -d 60
# Replay at 2x speed following actor 82
python start_replaying.py -f my_recording.log -x 2.0 -c 82
# Replay with spectator movement and sensor spawning
python start_replaying.py -f my_recording.log --move-spectator --spawn-sensors