Unicycle¶
Kinematic unicycle vehicle dynamics implemented with JAX utilities.
The model tracks planar position, heading, and forward speed while accepting longitudinal acceleration and heading rate controls. Basic constraints on acceleration, velocity, and heading rate mirror the style of the single-track dynamics module to keep API parity across models.
Examples:
>>> import pct.dynamics.unicycle as uni
>>> params = uni.Param()
>>> state_and_control = jnp.array([0.0, 0.0, 0.0, 2.0, 0.1, -0.5])
>>> derivative = uni.vehicle_dynamics_unicycle(state_and_control, params)
Param ¶
Jittable parameters for the kinematic unicycle model.
Attributes:
| Name | Type | Description |
|---|---|---|
accel_min, accel_max |
float or Array
|
Longitudinal acceleration limits. |
heading_rate_min, heading_rate_max |
float or Array
|
Heading rate limits. |
v_min, v_max |
float or Array
|
Forward speed limits. |
timestep |
float or Array
|
Physics integration timestep. |
timestep_ratio |
int or Array
|
Simulation steps per control step (static field). |
State ¶
Placeholder container for unicycle state batches.
Attributes:
| Name | Type | Description |
|---|---|---|
cartesian_states |
Array
|
State arrays shaped |
vehicle_dynamics_unicycle ¶
vehicle_dynamics_unicycle(x_and_u, params)
Evaluate kinematic unicycle dynamics with control constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_and_u
|
Array
|
Vehicle state augmented with controls, shape
|
required |
params
|
Param
|
Unicycle parameters and constraints. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Time derivative of state and dummy zeros for controls, shape |
yaw_normalized_loss ¶
yaw_normalized_loss(output_states, target_states)
Compute L1 loss with heading angle wrapped before measuring error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_states
|
Array
|
Predicted states. |
required |
target_states
|
Array
|
Target states. |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Scalar loss value. |