Skip to content

mixer

Torch mixer for mapping thrust/moment demands to rotor speeds.

Classes:

Name Description
Mixer

Map thrust and moment demands to rotor commands.

Mixer

Mixer(params: VehicleParams = VehicleParams(), num_envs: int = 1, device: str | device = 'cpu')

Map thrust and moment demands to rotor commands.

Note

电机推力分配: 电机1 = 推力 - 横滚(roll) + 俯仰(pitch) + 偏航(yaw) 电机2 = 推力 + 横滚(roll) - 俯仰(pitch) + 偏航(yaw) 电机3 = 推力 + 横滚(roll) + 俯仰(pitch) - 偏航(yaw) 电机4 = 推力 - 横滚(roll) - 俯仰(pitch) - 偏航(yaw)

Initialize the torch mixer with vehicle parameters and device.

Methods:

Name Description
randomize

Randomize mixer runtime parameters from nominal values.

calculate_rotor_commands

Allocate thrust and moments into rotor speeds.

randomize

randomize(env_ids=None, randomization=None)

Randomize mixer runtime parameters from nominal values.

calculate_rotor_commands

calculate_rotor_commands(control: Tensor) -> torch.Tensor

Allocate thrust and moments into rotor speeds.

Parameters:

Name Type Description Default

control

Tensor

Desired total thrust and roll/pitch/yaw moments. Shape: (num_envs, 4)

required

Returns:

Type Description
Tensor

torch.Tensor: The amplitude of each motor's rotational speed (calculated using sqrt(clip(rpm_sq))). Shape: (num_envs, 4)