TV Linear¶
Time-varying linear vehicle dynamics.
Notes
Defines a linear time-varying dynamics model with matrices A and B,
registered via ModelSpec for integration with the optimization stack.
Param ¶
Parameters for the time-varying linear model.
Attributes:
| Name | Type | Description |
|---|---|---|
A |
Array
|
State/control matrix of shape |
B |
Array
|
Bias term of shape |
timestep |
float
|
Physics integration timestep. |
timestep_ratio |
int
|
Simulation steps per control step (static field). |
vehicle_dynamics_tv_linear ¶
vehicle_dynamics_tv_linear(x_and_u, params)
Evaluate the time-varying linear dynamics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_and_u
|
Array
|
Vehicle state-control vector of shape
|
required |
params
|
Param
|
Parameter dataclass containing the linear map |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Time derivative of the state-control vector, shape |
yaw_normalized_loss ¶
yaw_normalized_loss(output_states, target_states)
Yaw-normalized loss between output and target states.
Handles angular differences by wrapping them to [-pi, pi] and uses
L1 loss for non-angular components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_states
|
Array
|
Predicted states of shape |
required |
target_states
|
Array
|
Target states of shape |
required |
Returns:
| Type | Description |
|---|---|
float
|
Total loss summed over all elements. |
yaw_normalized_loss_per_element ¶
yaw_normalized_loss_per_element(
output_states, target_states
)
Yaw-normalized loss per state dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_states
|
Array
|
Predicted states of shape |
required |
target_states
|
Array
|
Target states of shape |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Loss per dimension of shape |
yaw_normalized_loss_per_item ¶
yaw_normalized_loss_per_item(output_states, target_states)
Yaw-normalized loss per item in the batch.
Assumes input shape is (B, T, D) where D=5.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_states
|
Array
|
Predicted states of shape |
required |
target_states
|
Array
|
Target states of shape |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Loss per batch item of shape |
yaw_normalized_loss_weighted ¶
yaw_normalized_loss_weighted(
output_states, target_states, weights=None
)
Weighted yaw-normalized loss for state dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_states
|
Array
|
Predicted states of shape |
required |
target_states
|
Array
|
Target states of shape |
required |
weights
|
Array
|
Per-dimension weights of shape |
None
|
Returns:
| Type | Description |
|---|---|
float
|
Weighted loss value. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |