mapping
Control-mode mapping utilities for batched Torch controller pipelines.
Classes:
| Name | Description |
|---|---|
FlightActionMapper |
Map batched normalized actions into controller targets, wrench, or RPM. |
Functions:
| Name | Description |
|---|---|
target_to_command |
Convert dict target batches into compact command vectors. |
Attributes:
| Name | Type | Description |
|---|---|---|
CONTROLLER_REGISTRY |
dict[str, type]
|
Torch-controller registry mirroring |
CONTROLLER_REGISTRY
module-attribute
CONTROLLER_REGISTRY: dict[str, type] = {'FlightController': FlightController, 'GeoControl': GeoControl}
Torch-controller registry mirroring
:data:lav2.controllers.mapping.CONTROLLER_REGISTRY.
FlightActionMapper
FlightActionMapper(control_mode: str, params: VehicleParams = VehicleParams(), mapping: FlightMappingConfig | None = None, control_mask: dict | None = None, num_envs: int = 1, device: str | device = 'cpu')
Map batched normalized actions into controller targets, wrench, or RPM.
Initialize a batched Torch flight action mapper for the selected mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Control mode string (e.g. |
required |
|
VehicleParams
|
Vehicle parameters for action scaling. |
VehicleParams()
|
|
FlightMappingConfig | None
|
Optional mapping-range overrides. Relative-rotation
behaviour is controlled via
:attr: |
None
|
|
dict | None
|
Per-key boolean mask dict. |
None
|
|
int
|
Number of parallel environments. |
1
|
|
str | device
|
Torch device. |
'cpu'
|
Methods:
| Name | Description |
|---|---|
randomize |
Randomize mapper runtime parameters used by action scaling. |
action_to_collective_acc |
Map a normalized policy collective action to total collective acceleration. |
collective_acc_to_thrust |
Convert total collective acceleration into total thrust in Newtons. |
action_to_collective_thrust |
Convert a normalized policy collective action into total thrust. |
map_action |
Map a normalized batched action into RPM commands and intermediates. |
Attributes:
| Name | Type | Description |
|---|---|---|
requires_controller |
bool
|
Whether this mode needs a controller — true when mask has any keys. |
requires_controller
property
requires_controller: bool
Whether this mode needs a controller — true when mask has any keys.
randomize
randomize(env_ids=None, randomization: dict[str, tuple[float, float]] | None = None) -> None
Randomize mapper runtime parameters used by action scaling.
action_to_collective_acc
action_to_collective_acc(action: Tensor, mixer: Mixer) -> torch.Tensor
Map a normalized policy collective action to total collective acceleration.
collective_acc_to_thrust
collective_acc_to_thrust(collective_acc: Tensor) -> torch.Tensor
Convert total collective acceleration into total thrust in Newtons.
action_to_collective_thrust
action_to_collective_thrust(action: Tensor, mixer: Mixer) -> torch.Tensor
Convert a normalized policy collective action into total thrust.
map_action
map_action(action: Tensor, mixer: Mixer, *, state: dict | None = None, flight_controller: ControllerBase | None = None) -> FlightMappingResult
Map a normalized batched action into RPM commands and intermediates.
target_to_command
target_to_command(target: dict, command_mode: str, state: dict | None = None, output_frame: str = 'world_relative') -> torch.Tensor
Convert dict target batches into compact command vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict
|
Batched target state dict. |
required |
|
str
|
One of |
required |
|
dict | None
|
Batched current state dict; required for |
None
|
|
str
|
|
'world_relative'
|