Overview
The action space abstraction serves two primary purposes:- Dimensionality reduction: Convert high-dimensional trajectory sequences (positions and rotations over time) into compact action representations
- Physical constraints: Encode vehicle dynamics and kinematic constraints into the action space
ActionSpace base class and implement bidirectional transformations between trajectories and actions.
Base Action Space Interface
TheActionSpace class defines the core interface:
action_space.py:23-95 for the complete base class implementation.
Unicycle Kinematic Model
TheUnicycleAccelCurvatureActionSpace is the primary action space implementation, modeling the vehicle as a unicycle with acceleration and curvature controls.
Action Representation
Each action is a sequence of(acceleration, curvature) pairs:
- Acceleration (
a): Rate of change of velocity in m/s² - Curvature (
κ): Inverse of the turning radius, controlling steering
n_waypoints future timesteps, the action has shape (n_waypoints, 2).
Trajectory to Action Conversion
Thetraj_to_action method extracts control parameters from a given trajectory:
unicycle_accel_curvature.py:128-205:
- Velocity estimation: Solves a regularized optimization problem to compute smooth velocity profiles
- Acceleration extraction: Uses Tikhonov regularization to ensure smooth jerk (derivative of acceleration)
- Curvature computation: Calculated as
dθ/swheresis the arc length
Action to Trajectory Conversion
Theaction_to_traj method simulates forward dynamics:
dx/dt = v cos(θ)dy/dt = v sin(θ)dv/dt = adθ/dt = κv
Configuration
Key parameters forUnicycleAccelCurvatureActionSpace:
| Parameter | Default | Description |
|---|---|---|
dt | 0.1 | Time step between waypoints (seconds) |
n_waypoints | 64 | Number of future waypoints to predict |
accel_bounds | (-9.8, 9.8) | Min/max acceleration in m/s² |
curvature_bounds | (-0.2, 0.2) | Min/max curvature in 1/m |
accel_mean, accel_std | 0.0, 1.0 | Normalization parameters |
curvature_mean, curvature_std | 0.0, 1.0 | Normalization parameters |
theta_lambda,theta_ridge: Heading smoothnessv_lambda,v_ridge: Velocity smoothnessa_lambda,a_ridge: Acceleration smoothness (jerk)kappa_lambda,kappa_ridge: Curvature smoothness
unicycle_accel_curvature.py:36-96 for the full initialization.
Discrete Action Space
TheDiscreteTrajectoryTokenizer quantizes continuous actions into discrete tokens for use with language models or discrete diffusion:
- Convert trajectory to continuous action using the underlying action space
- Normalize to [0, 1] using
dims_minanddims_max - Quantize to
{0, 1, ..., num_bins-1} - Decode by reversing the process
discrete_action_space.py:24-109 for implementation details.
Bounds Checking
Action spaces can validate that actions satisfy physical constraints:unicycle_accel_curvature.py:102-123.
Best Practices
- Normalization: Always normalize acceleration and curvature using dataset statistics for stable training
- Regularization: Tune lambda parameters based on your application’s smoothness requirements
- Time discretization: Choose
dtto match your sensor update rate (typically 10-100 Hz) - Bounds: Set conservative bounds to ensure physical realizability
- Initial state: Use
estimate_t0_states()to infer initial velocity from history when not available