Skip to content

mixer

Array API mixer for mapping thrust/moment demands to rotor speeds.

Classes:

Name Description
Mixer

Map batched thrust and moment demands to rotor speed commands.

Mixer

Mixer(params: VehicleParams = VehicleParams(), num_envs: int = 1, device=None, *, backend: BackendName | None = None, xp: ModuleType | None = None, allocation_mode: Literal['pinv', 'saturation'] = 'pinv')

Map batched thrust and moment demands to rotor speed commands.

The default "pinv" allocator applies direct pseudo-inverse allocation. "saturation" enables a staged trim strategy: roll/pitch authority is trimmed first if needed, and yaw authority is allocated from the remaining rotor-speed margin.

Initialize the mixer matrix and backend namespace.

Parameters:

Name Type Description Default

params

VehicleParams

Vehicle parameters used to build the allocation matrix.

VehicleParams()

num_envs

int

Number of parallel environments represented by the batch.

1

device

Optional backend device, mainly used by Torch.

None

backend

BackendName | None

Explicit Array API backend. If omitted, NumPy is used when device is None and Torch otherwise for compatibility.

None

xp

ModuleType | None

Pre-resolved Array API namespace. Overrides backend.

None

allocation_mode

Literal['pinv', 'saturation']

"pinv" for direct pseudo-inverse allocation or "saturation" for staged saturation-aware allocation.

'pinv'

Methods:

Name Description
randomize

Randomize mixer parameters for selected environments.

calculate_rotor_commands

Allocate [thrust, roll, pitch, yaw] controls to rotor RPM.

randomize

randomize(env_ids=None, randomization: dict | None = None)

Randomize mixer parameters for selected environments.

calculate_rotor_commands

calculate_rotor_commands(control: ArrayLike) -> ArrayLike

Allocate [thrust, roll, pitch, yaw] controls to rotor RPM.

Parameters:

Name Type Description Default

control

ArrayLike

Batched control array with shape (num_envs, 4).

required

Returns:

Type Description
ArrayLike

Batched rotor speed magnitudes with shape (num_envs, 4).