ego_swarm代码框架

plannnerV1

ego_plannner_node:main函数初始化

init

  rebo_replan.init(nh);

ego_replan_fsm(重规划状态机)
将launch文件的参数引入
在这里插入图片描述
订阅状态机回调函数+碰撞检测回调函数
在这里插入图片描述
判断模式是手动设置目标模式或者waypoint模式
后者进入读取waypoint点函数
在这里插入图片描述
在该函数中先进行全局轨迹规划
然后将状态从WAIT_TARGET切换到GEN_NEW_TRAJ(生成新轨迹)模式
循环等待EXEC_TRAJ模式

如果等待到了EXEC_TRAJ模式,状态转换为REPLAN_TRAJ模式

状态机回调函数

在GEN_NEW_TRAJ状态中进行全局轨迹规划
然后将状态转换成EXEC_TRAJ模式

在EXEC_TRAJ模式中检测是否需要replan
如果满足条件则进入REPLAN_TRAJ模式

在REPLAN_TRAJ模式中一直调用planFromCurrentTraj函数进行rebounds
直到成功,将状态转移至EXEC_TRAJ

轨迹数据流向

Bspline解析

  1. (ego-replan-fsm.cpp中)callReboundReplan函数下调用reboundReplan进行轨迹重优化,最终将轨迹发布到planning/bspline话题中
  2. planning/bspline== 经过traj-server处理过后=/position_cmd
  3. /position_cmd == cmd == cmd_data == 在get_cmd_des调用cmd_data
  4. get_cmd_des ==des=经过calculateControl=debug_msg和输出u

最终进入mavros控制

  • debug_msg=通过debug_pub=发布到/debugPx4ctrl上面 ===可能用于调试

  • u通过publish_attitude_ctrl和publish_bodyrate_ctrl函数发布到(“/mavros/setpoint_raw/attitude”,话题上面进行姿态控制,成功控制无人机

px4ctrl控制逻辑

    // 1
    if (last_mode < API_MODE_THRESHOLD_VALUE && mode > API_MODE_THRESHOLD_VALUE)
        enter_hover_mode = true;
    else
        enter_hover_mode = false;

    if (mode > API_MODE_THRESHOLD_VALUE)
        is_hover_mode = true;
    else
        is_hover_mode = false;

    // 2
    if (is_hover_mode)
    {
        if (last_gear < GEAR_SHIFT_VALUE && gear > GEAR_SHIFT_VALUE)
            enter_command_mode = true;
        else if (gear < GEAR_SHIFT_VALUE)
            enter_command_mode = false;

        if (gear > GEAR_SHIFT_VALUE)
            is_command_mode = true;
        else
            is_command_mode = false;
    }

    // 3
    if (!is_hover_mode && !is_command_mode)
    {
        if (last_reboot_cmd < REBOOT_THRESHOLD_VALUE && reboot_cmd > REBOOT_THRESHOLD_VALUE)
            toggle_reboot = true;
        else
            toggle_reboot = false;
    }
    else
        toggle_reboot = false;

channel5

mode
mode变大 enter_hover_mode=1
mode>0.75 is_hover_mode=1

channel6

gear
gear 变大 enter_command_mode =1
gear >0.75 is_command_mode =1

channel8

reboot_cmd
reboot_cmd 变大 toggle_reboot

ch5上拉,L1=L2
6上拉 L2=L3

更改ID

在这里插入图片描述

egoplannerV2

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值