mapping
Control-mode mapping utilities for batched Torch controller pipelines.
类:
| 名称 | 描述 |
|---|---|
FlightActionMapper |
Map batched normalized actions into controller targets, wrench, or RPM. |
函数:
| 名称 | 描述 |
|---|---|
target_to_command |
Convert dict target batches into compact command vectors. |
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
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.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
str
|
Control mode string (e.g. |
必需 |
|
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'
|
方法:
| 名称 | 描述 |
|---|---|
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. |
decode_action |
Decode normalized batched action into a runtime-neutral control request. |
map_action |
Resolve normalized batched action into simulation rotor RPM commands. |
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
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.
返回:
| 类型 | 描述 |
|---|---|
Tensor
|
The total collective acceleration tensor. |
collective_acc_to_thrust
collective_acc_to_thrust(collective_acc: Tensor) -> torch.Tensor
Convert total collective acceleration into total thrust in Newtons.
返回:
| 类型 | 描述 |
|---|---|
Tensor
|
The total thrust tensor 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.
返回:
| 类型 | 描述 |
|---|---|
Tensor
|
The total thrust tensor. |
decode_action
decode_action(action: Tensor, mixer: Mixer, *, state: ControllerState | None = None) -> FlightMapping
Decode normalized batched action into a runtime-neutral control request.
返回:
| 类型 | 描述 |
|---|---|
FlightMapping
|
FlightMapping dictionary containing control targets/commands. |
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
If state is missing when required for control mode. |
map_action
map_action(action: Tensor, mixer: Mixer, *, state: ControllerState | None = None, flight_controller: ControllerBase | None = None) -> FlightMapping
Resolve normalized batched action into simulation rotor RPM commands.
返回:
| 类型 | 描述 |
|---|---|
FlightMapping
|
FlightMapping dictionary containing RPM commands and wrench details. |
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
If flight_controller is missing for mapped modes. |
target_to_command
target_to_command(target: ControllerTarget, command_mode: str, state: ControllerState | None = None, output_frame: str = 'world_relative') -> torch.Tensor
Convert dict target batches into compact command vectors.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
|
ControllerTarget
|
Batched target state dict. |
必需 |
|
str
|
One of |
必需 |
|
ControllerState | None
|
Batched current state dict; required for |
None
|
|
str
|
|
'world_relative'
|
返回:
| 类型 | 描述 |
|---|---|
Tensor
|
The encoded target command tensor. |
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
If state is missing for pos mode or if command_mode is invalid. |