mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 18:47:21 +08:00
px_generate_mixers.py: scale mixer so that sum(z_thrust_scale)==n_rotors
This commit is contained in:
committed by
Daniel Agar
parent
262d9c790b
commit
b7d7d1209b
@@ -195,6 +195,7 @@ def normalize_mix_px4(B):
|
||||
'''
|
||||
B_norm = np.linalg.norm(B, axis=0)
|
||||
B_max = np.abs(B).max(axis=0)
|
||||
B_sum = np.sum(B, axis=0)
|
||||
|
||||
# Same scale on roll and pitch
|
||||
B_norm[0] = max(B_norm[0], B_norm[1]) / np.sqrt(B.shape[0] / 2.0)
|
||||
@@ -208,7 +209,7 @@ def normalize_mix_px4(B):
|
||||
B_norm[4] = B_norm[3]
|
||||
|
||||
# Scale z thrust separately
|
||||
B_norm[5] = B_max[5]
|
||||
B_norm[5] = - B_sum[5] / np.count_nonzero(B[:,5])
|
||||
|
||||
# Normalize
|
||||
B_norm[np.abs(B_norm) < 1e-3] = 1
|
||||
|
||||
Reference in New Issue
Block a user