The four coordinate frames
AlpaSim uses four primary coordinate systems:Local frame - Scenario inertial frame
Local frame - Scenario inertial frame
Type: Inertial frame (fixed)Definition:
- Fixed on a per-scenario basis
- East-North-Up (ENU) frame defined by NRE
- Acts as the primary reference frame for simulation
- World state representation
- Primary coordinate system for most calculations
- Reference frame for logging
Rig frame - Ego vehicle body frame
Rig frame - Ego vehicle body frame
Type: Body-fixed frame (moves with vehicle)Definition:
- x-axis: Points forward
- y-axis: Points to the left (when looking forward)
- z-axis: Points up
- Origin: Center of rear axle, projected onto ground plane
- Ego vehicle pose representation
- Driver planning outputs
- Vehicle-centric calculations
The rig frame is the standard body-fixed frame for the ego vehicle. Most vehicle-relative quantities are expressed in this frame.
AABB frame - Bounding box frame
AABB frame - Bounding box frame
Type: Body-fixed frame (moves with object)Definition:
- Same orientation as rig frame (x forward, y left, z up)
- Origin: Center of the object’s Axis-Aligned Bounding Box
- Actor representations
- Traffic simulation
- Physics constraints
- Collision detection
The AABB frame uses the same orientation convention as rig but with a different origin point.
ECEF frame - Global reference
ECEF frame - Global reference
Type: Inertial frame (global)Definition:
- Earth-Centered, Earth-Fixed frame
- Based on WGS84 coordinate system
- Global positioning reference
- GPS coordinates
- Global positioning
- Map data integration
Special frame: Noised/estimated frame
To mimic proprioceptive noise, the ego position sent to the driver includes estimation error:- Can be thought of as
local -> rig_esttransformation - Equivalently:
local_est -> rigtransformation - Runtime translates waypoints from noised frame back to true
localframe
Naming conventions
Vectors (positions, velocities, accelerations)
Vector names must include enough information to determine:- The “tail” of the vector
- The “tip” of the vector
- The reference frame
- Good examples
- Bad examples
Rotations and poses
Rotations and poses follow an active convention:- The “A to B” transform moves a quantity from frame A to frame B
- All transformations are active unless explicitly noted
- Good examples
- Bad examples
Active vs passive transforms
Definition:- Active transform: Moves or rotates an object within a fixed coordinate frame
- Passive transform: Changes the coordinate frame in which the object is described
- Position of B in frame A = Active transform from A to B (i.e.,
A->B) - To change notation from frame A to frame B: Use passive transform
B->A = (A->B).inverse()
Example from source
QVec: Quaternion + vector representation
AlpaSim uses theQVec class for representing poses:
Real example from source
pose_local_to_rig_t0.inverse()givesrig_t0 -> local- Composed with
pose_local_to_rig_t1(i.e.,local -> rig_t1) - Result:
rig_t0 -> rig_t1
Service communication frames
Each service expects data in specific coordinate frames:Driver service
Driver service
Inputs:
submit_trajectory: Noised history inlocalframesubmit_route: Waypoints innoisy rigframesubmit_recording_ground_truth: GT trajectory inrigframe
driveresponses: Poses in (noisy)localframe- Runtime must map from noisy
localto truelocalframe
Controller service
Controller service
Inputs:
- Current
pose_local_to_rig - Linear/angular velocities
- Reference trajectory in
rigframe
- Future
local->rigposes - Estimated poses
Physics service
Physics service
Inputs:
- Ego and traffic poses as
local -> AABBtransformations
- Constrained poses in same
local -> AABBframe
Traffic service
Traffic service
Inputs & Outputs:
- All communication as
local -> AABBtransformations
Sensorsim service
Sensorsim service
Inputs:
- Rig trajectory in
localframe - Per-camera calibration
rig->sensor_pose local->AABBtrajectories for dynamic objects
- Rendered images (no coordinate frame)
Logging conventions
ActorPoses log entries:- Store every actor in
AABBframe relative tolocalframe - Metadata captures
rig->AABBtransform for replay
- Per DriveWorks conventions
- Majority of quantities in
rigframe
Best practices
Always follow these naming conventions:
- Include frame information in all variable names
- Use descriptive names:
pose_local_to_rignotpose - Be consistent with the active transform convention
- Document any deviations from these conventions
- Use type hints to clarify QVec vs np.ndarray usage
Common patterns
- Clear parameter naming with frame information
- Use of
.inverse()for passive transform (changing coordinate frame) - Documentation of which frames are involved