跳转至

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 full 12D target batches into compact command vectors.

FlightActionMapper

FlightActionMapper(control_mode: str, params: VehicleParams = VehicleParams(), limits: FlightMappingLimits = FlightMappingLimits(), *, 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.

方法:

名称 描述
map_action

Map a normalized batched action into RPM commands and intermediates.

属性:

名称 类型 描述
requires_controller bool

Whether this mode needs a controller target expansion step.

requires_controller property

requires_controller: bool

Whether this mode needs a controller target expansion step.

map_action

map_action(action: Tensor, mixer: Mixer, *, state: Tensor | 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: Tensor, command_mode: str, state: Tensor | None = None) -> torch.Tensor

Convert full 12D target batches into compact command vectors.

参数:

名称 类型 描述 默认

target

Tensor

Batched target states with shape (N, 12) ordered as [x, y, z, vx, vy, vz, roll, pitch, yaw, wx, wy, wz].

必需

command_mode

str

Supported target command mode. Valid values are "tgt_pos", "tgt_vel", "tgt_ctatt", and "tgt_ctbr".

必需

state

Tensor | None

Current batched 12D vehicle state with shape (N, 12). Required only for "tgt_pos", where the returned command is the body-frame position error and heading error.

None

返回:

类型 描述
Tensor

torch.Tensor: A batched compact command tensor with shape (N, 4)

Tensor

matching the requested mode: - tgt_pos -> [dx_body, dy_body, dz, dyaw] - tgt_vel -> [vx, vy, vz, yaw_rate] - tgt_ctatt -> [collective, roll, pitch, yaw_rate] - tgt_ctbr -> [collective, wx, wy, wz]

引发:

类型 描述
ValueError

If command_mode is unsupported or state is missing for tgt_pos.