UnicycleAccelCurvatureActionSpace implements a unicycle kinematic model where the action space consists of acceleration and curvature values at each waypoint. This class converts between trajectories and (acceleration, curvature) pairs.
Class Definition
ActionSpace.
Constructor
Mean for normalizing acceleration
Standard deviation for normalizing acceleration
Mean for normalizing curvature
Standard deviation for normalizing curvature
Acceleration bounds (min, max) used to check if acceleration is within valid range
Curvature bounds (min, max) used to check if curvature is within valid range
Time step interval between waypoints in seconds
Number of waypoints in the trajectory
Lambda parameter for theta smoothing regularization
Ridge parameter for theta smoothing regularization
Lambda parameter for velocity smoothing regularization
Ridge parameter for velocity smoothing regularization
Lambda parameter for acceleration smoothing regularization
Ridge parameter for acceleration smoothing regularization
Lambda parameter for curvature smoothing regularization
Ridge parameter for curvature smoothing regularization
Methods
get_action_space_dims
Returns the dimensions of the action space.tuple[int, int] - Always returns (n_waypoints, 2) where 2 represents acceleration and curvature
is_within_bounds
Checks if a normalized action is within the specified bounds.Normalized action tensor with shape
(..., N, 2) where the last dimension contains [acceleration, curvature]torch.Tensor with shape (...) containing boolean values indicating whether all waypoints in each action are within bounds
estimate_t0_states
Estimates the initial state (velocity) at time t0 from trajectory history.Historical trajectory positions with shape
(..., N_hist, 3)Historical trajectory rotations with shape
(..., N_hist, 3, 3)dict[str, torch.Tensor] containing:
"v": Initial velocity estimate at time t0
traj_to_action
Transforms the future trajectory to the action space (acceleration and curvature).Historical trajectory positions with shape
(..., T, 3). The last position traj_history_xyz[..., -1, :] is assumed to be the current position at all zerosHistorical trajectory rotations with shape
(..., T, 3, 3)Future trajectory positions with shape
(..., T, 3). Must have T == n_waypointsFuture trajectory rotations with shape
(..., T, 3, 3)Initial state estimate containing
"v" (velocity). If None, will be estimated from historyWhether to output all intermediate states (velocity, acceleration, theta) in addition to the action
- If
output_all_states=False:torch.Tensorwith shape(..., T, 2)containing normalized [acceleration, curvature] - If
output_all_states=True: Tuple of(action, states)where:actionhas shape(..., T, 2)stateshas shape(..., T, 3)containing [velocity, acceleration, theta]
action_to_traj
Transforms the action space (acceleration and curvature) to trajectory representation.Normalized action tensor with shape
(..., T, 2) containing [acceleration, curvature]Historical trajectory positions with shape
(..., T, 3)Historical trajectory rotations with shape
(..., T, 3, 3)Initial state estimate containing
"v" (velocity). If None, will be estimated from history(traj_future_xyz, traj_future_rot) where:
traj_future_xyzhas shape(..., T, 3)traj_future_rothas shape(..., T, 3, 3)
Usage Example
The unicycle model assumes the current position at
traj_history_xyz[..., -1, :] is at the origin (all zeros). Actions are normalized using the provided mean and standard deviation parameters.