vehicle
cosmic_warp.core.vehicle
Vehicle configuration and properties.
VehicleConfig
Physical properties of the spacecraft.
VehicleManager
Manages vehicle configurations for parallel entities (envs * bodies).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_envs
|
int
|
Number of parallel environments |
required |
device
|
str
|
Compute device |
'cuda'
|
num_bodies
|
int
|
Number of bodies per environment |
1
|
states
|
array
|
The simulator's State array, so a new mass_dry can be checked against the current masses (None: no check) |
None
|
Source code in cosmic_warp/core/vehicle.py
set_config
set_config(
*,
mass_dry: float = None,
inertia: list = None,
area_drag: float = None,
cd: float = None,
magnetic_dipole: list = None,
env_ids: list = None,
body_ids: list = None,
entity_ids: list = None,
) -> None
Set vehicle configuration for specific or all entities.
Only the fields given are checked and written; None leaves a field unchanged for the selected entities. A new simulator starts with a 1 kg cube: mass_dry 1, inertia diag(1/6), area_drag 1, cd 2.2, no magnetic dipole.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mass_dry
|
float
|
Dry mass (without propellant) [kg], > 0 and at most the current mass of every selected entity that has been reset |
None
|
inertia
|
list
|
Inertia tensor [kg*m^2] as 3x3 list/tuple; must be symmetric, positive definite and satisfy the triangle inequality of a rigid body |
None
|
area_drag
|
float
|
Cross-sectional area for drag [m^2], >= 0 |
None
|
cd
|
float
|
Drag coefficient, >= 0 |
None
|
magnetic_dipole
|
list
|
Residual magnetic dipole moment in body frame [A*m^2] as [mx, my, mz] |
None
|
env_ids
|
list
|
List of environment indices to configure (None = all) |
None
|
body_ids
|
list
|
List of body indices to configure (None = all bodies) |
None
|
entity_ids
|
list
|
Optional flat entity indices (env_id * num_bodies + body_id) |
None
|
Source code in cosmic_warp/core/vehicle.py
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 | |
set_config_per_entity
set_config_per_entity(
*,
mass_dry: ndarray | array | None = None,
inertia: ndarray | array | None = None,
area_drag: ndarray | array | None = None,
cd: ndarray | array | None = None,
magnetic_dipole: ndarray | array | None = None,
) -> None
Set vehicle configuration per entity from batched arrays (e.g. for Monte Carlo parameter dispersions).
Each argument holds one value per entity, num_envs * num_bodies of
them: a NumPy array or nested list of numbers, or a Warp array of the
field's dtype on the simulator's device (used as-is; anything else is
copied to the device). None leaves that field unchanged. The inverse
inertia tensor is computed in-kernel from inertia. Values are
checked as in set_config (Warp arrays are copied to the host for the
check) before anything is written.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mass_dry
|
ndarray | array | None
|
Dry masses [kg], shape (num_entities,); Warp: float64 |
None
|
inertia
|
ndarray | array | None
|
Inertia tensors [kg*m^2], shape (num_entities, 3, 3); Warp: mat33d of shape (num_entities,) |
None
|
area_drag
|
ndarray | array | None
|
Drag areas [m^2], shape (num_entities,); Warp: float64 |
None
|
cd
|
ndarray | array | None
|
Drag coefficients, shape (num_entities,); Warp: float64 |
None
|
magnetic_dipole
|
ndarray | array | None
|
Dipole moments [A*m^2], shape (num_entities, 3); Warp: vec3d of shape (num_entities,) |
None
|