Fast-Planner:从0到1详解代码(1)总体架构一览

前言

Fast-Planner作为无人机规划界的网红,因为众多优点成为许多初学者入门的首选。

规划涉及的内容重要,表现为代码量庞大。

本文一是为了记录自己的学习经历,一是为了帮助其他初学者来了解如何阅读一个完整的项目。

总览

下载编译本文不涉及,假设已经可以独立完成仿真的复现。

首先给出Fast-Planner的文件夹架构

.
├── bag 录包脚本
│   └── record.sh
├── bspline  b样条相关
│   ├── CMakeLists.txt
│   ├── include
│   ├── package.xml
│   └── src
├── bspline_opt b优化相关
│   ├── CMakeLists.txt
│   ├── include
│   ├── package.xml
│   ├── script
│   └── src
├── path_searching  前段搜索
│   ├── CMakeLists.txt
│   ├── include
│   ├── package.xml
│   └── src 
├── plan_env   建图模块
│   ├── CMakeLists.txt
│   ├── include
│   ├── package.xml
│   └── src
├── plan_manage  规划主要内容
│   ├── CMakeLists.txt
│   ├── config
│   ├── include
│   ├── launch
│   ├── msg
│   ├── package.xml
│   ├── README.md
│   ├── script
│   └── src
├── poly_traj  多项式轨迹的定义
│   ├── CMakeLists.txt
│   ├── include
│   ├── package.xml
│   └── src
└── traj_utils 一些工具
    ├── CMakeLists.txt
    ├── include
    ├── package.xml
    └── src

个人认为较为重点的是 plan manage(管理整个项目的入口)、path-searching(前段搜索部分)bspline opt(后端优化部分),bspline、poly traj 、traj utils 主要是一些辅助工具。

启动

许多新手对整个项目的运行逻辑不清楚,这里逐步介绍在运行仿真后,各个模块之间的关系和运行逻辑。以Github上的教程为例:

1、启动RViz

  <!-- go to your workspace and run: -->
  source devel/setup.bash
  roslaunch plan_manage rviz.launch

这一部分是启动的RVIZ,为后边可视化提供基础。

2、启动规划部分

  <!-- open a new terminal, go to your workspace and run: -->
  source devel/setup.bash
  roslaunch plan_manage kino_replan.launch

这一部分较为关键,找到对应的launch文件如下:

<launch>
  <!-- size of map, change the size in x, y, z according to your application -->
  <arg name="map_size_x" value="40.0"/>
  <arg name="map_size_y" value="20.0"/>
  <arg name="map_size_z" value=" 5.0"/>

  <!-- topic of your odometry such as VIO or LIO -->
  <arg name="odom_topic" value="/state_ukf/odom" />

  <!-- main algorithm params -->
  <include file="$(find plan_manage)/launch/kino_algorithm.xml">

    <arg name="map_size_x_" value="$(arg map_size_x)"/>
    <arg name="map_size_y_" value="$(arg map_size_y)"/>
    <arg name="map_size_z_" value="$(arg map_size_z)"/>
    <arg name="odometry_topic" value="$(arg odom_topic)"/>

    <!-- camera pose: transform of camera frame in the world frame -->
    <!-- depth topic: depth image, 640x480 by default -->
    <!-- don't set cloud_topic if you already set these ones! -->
    <arg name="camera_pose_topic" value="/pcl_render_node/camera_pose"/>
    <arg name="depth_topic" value="/pcl_render_node/depth"/>

    <!-- topic of point cloud measurement, such as from LIDAR  -->
    <!-- don't set camera pose and depth, if you already set this one! -->
    <arg name="cloud_topic" value="/pcl_render_node/cloud"/>

    <!-- intrinsic params of the depth camera -->
    <arg name="cx" value="321.04638671875"/>
    <arg name="cy" value="243.44969177246094"/>
    <arg name="fx" value="387.229248046875"/>
    <arg name="fy" value="387.229248046875"/>

    <!-- maximum velocity and acceleration the drone will reach -->
    <arg name="max_vel" value="3.0" />
    <arg name="max_acc" value="2.0" />

    <!-- 1: use 2D Nav Goal to select goal  -->
    <!-- 2: use global waypoints below  -->
    <arg name="flight_type" value="1" />
    
    <!-- global waypoints -->
    <!-- If flight_type is set to 2, the drone will travel these waypoints one by one -->
    <arg name="point_num" value="2" />

    <arg name="point0_x" value="19.0" />
    <arg name="point0_y" value="0.0" />
    <arg name="point0_z" value="1.0" />

    <!-- set more waypoints if you need -->
    <arg name="point1_x" value="-19.0" />
    <arg name="point1_y" value="0.0" />
    <arg name="point1_z" value="1.0" />

    <arg name="point2_x" value="0.0" />
    <arg name="point2_y" value="19.0" />
    <arg name="point2_z" value="1.0" />
    
  </include>

  <!-- trajectory server -->
  <node pkg="plan_manage" name="traj_server" type="traj_server" output="screen">
    <remap from="/position_cmd" to="planning/pos_cmd"/>

    <remap from="/odom_world" to="$(arg odom_topic)&
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值