跳转至

mixer

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

类:

名称 描述
Mixer

Map thrust and moment demands to rotor commands.

Mixer

Mixer(params: VehicleParams = VehicleParams(), verbose=False)

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 mixer with vehicle parameters and mixer matrix.

方法:

名称 描述
calculate_rotor_commands

Allocate thrust and moments into rotor speeds.

属性:

名称 类型 描述
mat

转速平方到推力扭矩

inv_mat

推力扭矩到转速平方

max_rpm_sq

最大转速平方

min_rpm_sq

最小转速平方

max_wrench

单桨最大推力/力矩

min_wrench

单桨最小推力/力矩

max_collective_thrust

最大总推力

mat instance-attribute

mat = np.array([[self.params.cT * np.cos(self.params.alpha)] * 4, [self.params.cT * np.cos(self.params.alpha) * self.params.y] * 4, [self.params.cT * np.cos(self.params.alpha) * self.params.x] * 4, [self.params.cT * np.sin(self.params.alpha) * self.params.x + self.params.cM] * 4]) * np.array([[1, 1, 1, 1], [-1, 1, 1, -1], [-1, 1, -1, 1], self.params.spin_dir])

转速平方到推力扭矩

inv_mat instance-attribute

inv_mat = np.linalg.pinv(self.mat)

推力扭矩到转速平方

max_rpm_sq instance-attribute

max_rpm_sq = self.params.max_rpm ** 2

最大转速平方

min_rpm_sq instance-attribute

min_rpm_sq = self.params.init_rpm ** 2

最小转速平方

max_wrench instance-attribute

max_wrench = self.mat[:, 1] * self.max_rpm_sq

单桨最大推力/力矩

min_wrench instance-attribute

min_wrench = self.mat[:, 1] * self.min_rpm_sq

单桨最小推力/力矩

max_collective_thrust instance-attribute

max_collective_thrust = self.max_wrench[0] * 4.0

最大总推力

calculate_rotor_commands

calculate_rotor_commands(control: ndarray) -> np.ndarray

Allocate thrust and moments into rotor speeds.

参数:

名称 类型 描述 默认

control

ndarray

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

必需

返回:

类型 描述
ndarray

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