PX4_mixer通道分配的深度解析

        上文写了PIXHAWK的姿态控制算法,该文主要对姿态控制输出到电机输出的通道分配环节进行深入解析。PX4的通道分配环节查看mixer_multirotor.cpp(对应多旋翼的通道分配)。

        PX4的mixer策略:

/* Summary of mixing strategy:
1) mix roll, pitch and thrust without yaw.
2) if some outputs violate range [0,1] then try to shift all outputs to minimize violation ->
increase or decrease total thrust (boost). The total increase or decrease of thrust is limited
(max_thrust_diff). If after the shift some outputs still violate the bounds then scale roll & pitch.
In case there is violation at the lower and upper bound then try to shift such that violation is equal
on both sides.
3) mix in yaw and scale if it leads to limit violation.
4) scale all outputs to range [idle_speed,1]           
 */

        先融合横滚、俯仰、油门值,然后依据得到的结果对其横滚、俯仰进行比率钳位,最后融合航向值,对航向进行比率钳位,最后对整体做限幅和怠速处理。(从处理的顺序可以看出横滚/俯仰的响应优先级大于航向)

其中比率钳位的意思可看下图讲解:

这里思考一下,是比例钳位好?还是整体都减去四个电机的最大值越界的部分好呢?(有待后续进一步实验验证)

        实际代码执行细节会相对更加丰富一些,接下来讲解一下代码结构。

        首先从姿态控制器输出获得roll,pitch, yaw, thrust:

float roll    = constrain(get_control(0, 0) * _roll_scale, -1.0f, 1.0f);
float pitch   = constrain(get_control(0, 1) * _pitch_scale, -1.0f, 1.0f);
float yaw     = constrain(get_control(0, 2) * _yaw_scale, -1.0f, 1.0f);
float thrust  = constrain(get_control(0, 3), 0.0f, 1.0f);

然后在忽略yaw的情况下,计算融合后结果的

  • 4
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值