config
Config
dataclass
¶
Source code in openscvx/config.py
apply_dict(settings: dict) -> None
¶
Apply a nested settings dict to this :class:Config.
Valid subsection names are discovered automatically from the
dataclass fields (minus internal ones like sim).
Each subsection is validated through its pydantic model, so
typos and wrong types are caught immediately (extra="forbid").
Example::
config.apply_dict({
"dev": {"printing": False, "verbosity": 1},
})
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
dict
|
|
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
On unknown section names. |
ValidationError
|
On unknown keys or wrong types within a section. |
Source code in openscvx/config.py
DevConfig
¶
Bases: BaseModel
Configuration class for development settings.
This class defines the parameters used for development and debugging purposes.
Attributes:
| Name | Type | Description |
|---|---|---|
profiling |
bool
|
Whether to enable profiling for performance analysis. Defaults to False. |
debug |
bool
|
Disables all precompilation so you can place breakpoints and inspect values. Defaults to False. |
printing |
bool
|
Whether to enable printing during development. Defaults to True. |
verbosity |
int
|
Verbosity level for iteration output. 1 (MINIMAL): Core metrics only (iter, cost, status) 2 (STANDARD): + timing, penalty terms (default) 3 (FULL): + autotuning diagnostics |
Source code in openscvx/config.py
PropagationConfig
¶
Bases: BaseModel
Configuration class for propagation settings.
This class defines the parameters required for propagating the nonlinear system dynamics using the optimal control sequence.
Attributes:
| Name | Type | Description |
|---|---|---|
inter_sample |
int
|
How dense the propagation within multishot discretization should be. Defaults to 30. |
dt |
float
|
The time step for propagation. Defaults to 0.01. |
solver |
str
|
The numerical solver to use for propagation (e.g., "Dopri8"). Defaults to "Dopri8". |
max_tau_len |
int
|
The maximum length of the time vector for propagation. Defaults to 1000. |
args |
Dict[str, Any]
|
Additional arguments to pass to the solver. Defaults to an empty dictionary. |
atol |
float
|
Absolute tolerance for the solver. Defaults to 1e-3. |
rtol |
float
|
Relative tolerance for the solver. Defaults to 1e-6. |
Source code in openscvx/config.py
SettingsSpec
¶
Bases: BaseModel
Validates the settings: block from YAML/JSON input.
Source code in openscvx/config.py
SimConfig
dataclass
¶
Source code in openscvx/config.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
ctcs_slice
property
¶
Slice for accessing CTCS augmented states.
ctcs_slice_prop
property
¶
Slice for accessing CTCS augmented states in propagation.
time_dilation_slice
property
¶
Slice for accessing time dilation in the control vector.
time_slice
property
¶
Slice for accessing time in the state vector.
true_control_slice
property
¶
Slice for accessing true (non-augmented) controls.
true_state_slice
property
¶
Slice for accessing true (non-augmented) states.
true_state_slice_prop
property
¶
Slice for accessing true (non-augmented) propagation states.
__init__(x: UnifiedState, x_prop: UnifiedState, u: UnifiedControl, total_time: float, n: int, save_compiled: bool = False, ctcs_node_intervals: Optional[list] = None, n_states: Optional[int] = None, n_states_prop: Optional[int] = None, n_controls: Optional[int] = None)
¶
Configuration class for simulation settings.
This class defines the parameters required for simulating a trajectory optimization problem.
Main arguments: These are the arguments most commonly used day-to-day.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
State
|
State object, must have .min and .max attributes for bounds. |
required |
x_prop
|
State
|
Propagation state object, must have .min and .max attributes for bounds. |
required |
u
|
Control
|
Control object, must have .min and .max attributes for bounds. |
required |
total_time
|
float
|
The total simulation time. |
required |
n
|
int
|
Number of discretization nodes. |
required |
save_compiled
|
bool
|
If True, save and reuse compiled solver functions. Defaults to False. |
False
|
ctcs_node_intervals
|
list
|
Node intervals for CTCS constraints. |
None
|
n_states
|
int
|
The number of state variables. Defaults to
|
None
|
n_states_prop
|
int
|
The number of propagation state
variables. Defaults to |
None
|
n_controls
|
int
|
The number of control variables. Defaults
to |
None
|
Note
You can specify custom scaling for specific states/controls using
the scaling_min and scaling_max attributes on State, Control, and Time objects.
If not set, the default min/max bounds will be used for scaling.