Service Definition
Methods
start_session
Initialize a traffic simulation session with scene and actor data.Unique identifier for this traffic session
Map identifier for road network information
Random seed for reproducible traffic behavior
Initial trajectories from logged data
Earliest time when traffic model takes control (microseconds).Objects appearing later will be handed over after
minimum_history_length
steps of log history, but not before handover_time_us.simulate
Advance traffic simulation and get predicted trajectories.Session identifier
Time for which predictions are requested (microseconds)
Updates for objects not controlled by traffic model (primarily ego vehicle).
Must include poses until at least
time_query_us.Updated trajectories for all objects in the scene.The last pose in each trajectory is the predicted pose at
time_query_us.Maintains the order of objects from
TrafficSessionRequest.logged_object_trajectories.get_metadata
Query traffic module capabilities and requirements.Traffic module version information
Required history duration before handover (microseconds).Traffic model needs this much historical data before taking control of an actor.
List of map IDs supported by this traffic module
close_session
Release resources for a traffic session.Session identifier to close
Usage Example
Fromalpasim_runtime/services/traffic_service.py:
Traffic Model Behavior
The traffic service follows this pattern:- Log Replay Phase: During initial frames, traffic follows logged trajectories
- Handover: After
minimum_history_length_usof history, model takes control - Prediction: Model predicts future behavior conditioned on:
- Road network geometry (from
map_id) - Historical trajectories
- Ego vehicle behavior
- Other traffic participants
- Road network geometry (from
Coordinate Frames
All trajectories use active transforms local→aabb where:
- Local: World/map coordinate system
- AABB: Center of object’s axis-aligned bounding box
Configuration
Traffic model parameters are configured via runtime config:Object Tracking
Object IDs must be stable across frames. The traffic service uses these IDs to:
- Maintain trajectory history
- Track handover timing
- Associate predictions with objects
Related
- Physics Service - Adjusts traffic poses for ground
- SensorSim Service - Renders traffic actors
- Runtime Module - Orchestrates traffic simulation