time
Time
¶
Bases: State
Time state variable for trajectory optimization.
Time is a State representing physical time along the trajectory. Used for time-optimal control and problems with time-dependent dynamics/constraints.
Since Time is a State, it can be:
- Used directly in constraint expressions (e.g., time[0] <= 5.0)
- Added to the states list, or auto-added via the time= argument
The constructor accepts scalar values for convenience, which are converted to arrays internally to match State's API.
Attributes:
| Name | Type | Description |
|---|---|---|
derivative |
float
|
Always 1.0 - time derivative in normalized coordinates. |
Example
Basic usage::
time = ox.Time(initial=0.0, final=10.0, min=0.0, max=20.0)
problem = Problem(..., time=time)
Time-optimal (minimize final time)::
time = ox.Time(
initial=0.0,
final=("minimize", 10.0),
min=0.0,
max=20.0,
)
Using time in constraints::
time = ox.Time(initial=0.0, final=10.0, min=0.0, max=20.0)
states = [position, velocity, time]
constraint = ox.ctcs(time[0] <= 5.0)
Source code in openscvx/symbolic/time.py
__init__(initial: Union[float, tuple], final: Union[float, tuple], min: float, max: float)
¶
Initialize a Time state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial
|
Union[float, tuple]
|
Initial time. Either a float (fixed) or tuple like ("free", value), ("minimize", value), ("maximize", value). |
required |
final
|
Union[float, tuple]
|
Final time. Same format as initial. |
required |
min
|
float
|
Minimum time bound. |
required |
max
|
float
|
Maximum time bound. |
required |