Skip to content

mapping

Control-mode mapping utilities for NumPy-based controller pipelines.

Classes:

Name Description
FlightMappingLimits

Per-channel limits used when mapping normalized actions to targets.

FlightMappingResult

Mapped result for a normalized flight action or action batch.

FlightActionMapper

Map normalized actions into controller targets, wrench commands, or RPM.

Functions:

Name Description
target_to_command

Convert a full 12D target into a compact command vector.

FlightMappingLimits dataclass

FlightMappingLimits(vel_limits: tuple[float, float, float] = (5.0, 5.0, 5.0), att_limits: tuple[float, float, float] = (1.0, 1.0, math.pi), br_limits: tuple[float, float, float] = (2.0, 2.0, 2.0))

Per-channel limits used when mapping normalized actions to targets.

FlightMappingResult dataclass

FlightMappingResult(clamped_action: ndarray | Tensor, rpm_command: ndarray | Tensor, control: ndarray | Tensor | None = None, target: ndarray | Tensor | None = None)

Mapped result for a normalized flight action or action batch.

FlightActionMapper

FlightActionMapper(control_mode: str, params: VehicleParams = VehicleParams(), limits: FlightMappingLimits = FlightMappingLimits())

Map normalized actions into controller targets, wrench commands, or RPM.

Initialize a NumPy flight action mapper for the selected control mode.

Methods:

Name Description
map_action

Map a normalized action into an RPM command and optional intermediates.

Attributes:

Name Type Description
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: ndarray, mixer: Mixer, *, state: ndarray | None = None, flight_controller: ControllerBase | None = None) -> FlightMappingResult

Map a normalized action into an RPM command and optional intermediates.

target_to_command

target_to_command(target: ndarray, command_mode: str, state: ndarray | None = None) -> np.ndarray

Convert a full 12D target into a compact command vector.

Parameters:

Name Type Description Default

target

ndarray

Full target state ordered as [x, y, z, vx, vy, vz, roll, pitch, yaw, wx, wy, wz].

required

command_mode

str

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

required

state

ndarray | None

Current 12D vehicle state. Required only for "tgt_pos", where the returned command is the body-frame position error and heading error rather than an absolute world-frame pose target.

None

Returns:

Name Type Description
ndarray

np.ndarray: A compact command vector matching the requested command

mode ndarray
  • 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]

Raises:

Type Description
ValueError

If command_mode is unsupported or state is missing for tgt_pos.