EGO-Planner 浙江大学 FAST-LAB 实验室的开源轨迹规划算法是,受到 IEEE Spectrum 等知名科技媒体的报道,其理论技术较为前沿,是一种不依赖于ESDF,基于B样条的规划算法,并且规划成功率、算法消耗时间、代价数值等性能方面都要高于其他几种知名算法。
而 EGO-Swarm 是基于 EGO-Planner 拓展的去中心化的无人机集群算法,有助于智能小车或自主无人机集群的规划的学习与开发
由于 EGO-Planner 是 EGO-Swarm 的一部分,并且他们的安装其实差别不大,因此本文主要介绍 EGO-Swarm 的编译与运行,参考
https://github.com/ZJU-FAST-Lab/ego-planner-swarm
https://github.com/ZJU-FAST-Lab/ego-planner
GitHub - ZJU-FAST-Lab/Fast-Drone-250: hardware and software design of the 250mm autonomous drone
由于 Jetson 系列开发板常用于当作机载电脑,因此本文介绍如何在 Jetson Orin NX 开发板上编译和运行 EGO-Swarm,当然本文对 EGO-Planner 同样适用。
首先安装依赖
sudo apt-get install libarmadillo-dev
然后创建并进入工作空间
mkdir -p ~/catkin_ws/src/
cd ~/catkin_ws/src/
从 GitHub 上下载 EGO-Swarm 源码
git clone https://github.com/ZJU-FAST-Lab/ego-planner-swarm.git
进入 EGO-Swarm 工作空间并编译
cd ~/catkin_ws/src/ego-planner-swarm
catkin_make
编译完成显示如下结果
接下来我们运行 EGO-Swarm,主要分为仿真和实验两个部分
首先通过快捷键 ctrl + alt + A 打开超级终端,如果没有安装则参考下文安装
Jetson Orin NX 开发指南(2): 基本环境配置_想要个小姑娘的博客-CSDN博客
将超级终端划分为两个终端,全选后 source 一下工作空间,终端输入
source ~/catkin_ws/src/ego-planner-swarm/devel/setup.bash
在第一个终端输入
roslaunch ego_planner rviz.launch
在第二个终端输入
roslaunch ego_planner swarm.launch
如下所示
依次执行可以得到如下结果
至此,EGO-Swarm 的仿真运行就实现了!
由于条件有限,我么在此仅仅只是将 EGO-Swarm 与 VINS-Fusion 进行连接,并且这里只涉及单个无人机(在这种情况下 EGO-Swarm 与 EGO-Planner 是等价的),其中 EGO-Swarm 单个无人机通过 VINS-Fusion 来获取里程计信息,同时通过深度相机数据来获取周围环境的情况。
首先需要配置实验用的一些参数,对应于仿真中的 advanced_param.xml 文件,
其次需要配置调用 VINS-Fusion 里程计信息和 Realsense 深度相机信息的 launch 启动文件,对应于仿真中的 single_run_in_sim.launch 文件,
此外还需要用于可视化的 rviz 文件,对应于仿真中的 default.rviz 文件,
具体的配置可以参考 FAST-LAB 实验室的 fast-drone-250 中采用的 xml 和 launch 文件:
GitHub - ZJU-FAST-Lab/Fast-Drone-250: hardware and software design of the 250mm autonomous drone
主要是如下三个文件
但是由于 VINS-Fusion 中里程计发布的话题是 /vins_estimator/imu_propagate,而上面订阅的话题是 /vins_fusion/imu_propagate,这是因为在 fast-drone-250 中,vins_estimator 节点被重命名为了 vins_fusion,从而产生了差异,只需修改以下订阅的话题即可,其余的可以不做修改,(当然如果标定了相机内外参以及 imu 的噪声,则可以将之后的数据修改上去,VINS-Fusion 或者 EGO-Swarm 上都要修改),具体操作如下
在 ~/catkin_ws/src/ego-planner-swarm/src/planner/plan_manage/launch/ 路径下创建四个文件
(1)advanced_param_exp.xml,其内容如下
(2)single_run_in_exp.launch,其内容如下
(3)rviz_exp.launch 文件,其内容如下
(4)default_exp.rviz 文件,其内容如下
Panels:
- Class: rviz/Displays
Help Height: 0
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
- /drone01/Planning1
- /drone01/Planning1/drone_path1/Offset1
- /drone01/Mapping1/map inflate1
- /Odometry1/Shape1
Splitter Ratio: 0.43611112236976624
Tree Height: 517
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.5886790156364441
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Name: Time
SyncMode: 0
SyncSource: map inflate
Preferences:
PromptSaveOnExit: true
Toolbars:
toolButtonStyle: 2
Visualization Manager:
Class: ""
Displays:
- Alpha: 1
Class: rviz/Axes
Enabled: true
Length: 1
Name: Axes
Radius: 0.10000000149011612
Reference Frame:
Show Trail: false
Value: true
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.029999999329447746
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 1000
Reference Frame:
Value: true
- Class: rviz/Group
Displays:
- Class: rviz/Group
Displays:
- Class: rviz/Marker
Enabled: true
Marker Topic: /drone_0_ego_planner_node/goal_point
Name: goal_point
Namespaces:
{}
Queue Size: 100
Value: true
- Class: rviz/Marker
Enabled: true
Marker Topic: /ego_planner_node/global_list
Name: global_path
Namespaces:
{}
Queue Size: 100
Value: true
- Class: rviz/Marker
Enabled: true
Marker Topic: /drone_0_ego_planner_node/optimal_list
Name: optimal_traj
Namespaces:
{}
Queue Size: 100
Value: true
- Class: rviz/Marker
Enabled: false
Marker Topic: /ego_planner_node/a_star_list
Name: AStar
Namespaces:
{}
Queue Size: 100
Value: false
- Class: rviz/Marker
Enabled: true
Marker Topic: /drone_0_ego_planner_node/init_list
Name: InitTraj
Namespaces:
{}
Queue Size: 100
Value: true
- Alpha: 1
Buffer Length: 1
Class: rviz/Path
Color: 29; 108; 212
Enabled: true
Head Diameter: 0.30000001192092896
Head Length: 0.20000000298023224
Length: 0.30000001192092896
Line Style: Billboards
Line Width: 0.10000000149011612
Name: drone_path
Offset:
X: 0
Y: 0
Z: 0
Pose Color: 255; 85; 255
Pose Style: None
Queue Size: 10
Radius: 0.029999999329447746
Shaft Diameter: 0.10000000149011612
Shaft Length: 0.10000000149011612
Topic: /drone_0_odom_visualization/path
Unreliable: false
Value: true
Enabled: true
Name: Planning
- Class: rviz/Group
Displays:
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 1.565000057220459
Min Value: 0.06499999761581421
Value: true
Axis: Z
Channel Name: intensity
Class: rviz/PointCloud2
Color: 29; 108; 212
Color Transformer: AxisColor
Decay Time: 0
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Min Color: 0; 0; 0
Name: map inflate
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 3
Size (m): 0.15000000596046448
Style: Boxes
Topic: /drone_0_ego_planner_node/grid_map/occupancy_inflate
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
Enabled: true
Name: Mapping
- Class: rviz/Group
Displays:
- Class: rviz/Marker
Enabled: true
Marker Topic: /drone_0_odom_visualization/robot
Name: robot
Namespaces:
{}
Queue Size: 100
Value: true
- Class: rviz/Image
Enabled: false
Image Topic: /drone_0_pcl_render_node/depth
Max Value: 1
Median window: 5
Min Value: 0
Name: depth
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: false
Enabled: true
Name: Simulation
Enabled: true
Name: drone0
- Class: rviz/Image
Enabled: false
Image Topic: /camera/depth/image_rect_raw
Max Value: 1
Median window: 5
Min Value: 0
Name: Image
Normalize Range: true
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: false
- Alpha: 1
Buffer Length: 1
Class: rviz/Path
Color: 25; 255; 0
Enabled: true
Head Diameter: 0.30000001192092896
Head Length: 0.20000000298023224
Length: 0.30000001192092896
Line Style: Lines
Line Width: 0.029999999329447746
Name: Path
Offset:
X: 0
Y: 0
Z: 0
Pose Color: 255; 85; 255
Pose Style: None
Queue Size: 10
Radius: 0.029999999329447746
Shaft Diameter: 0.10000000149011612
Shaft Length: 0.10000000149011612
Topic: /vins_estimator/path
Unreliable: false
Value: true
- Angle Tolerance: 0.10000000149011612
Class: rviz/Odometry
Covariance:
Orientation:
Alpha: 0.5
Color: 255; 255; 127
Color Style: Unique
Frame: Local
Offset: 1
Scale: 1
Value: true
Position:
Alpha: 0.30000001192092896
Color: 204; 51; 204
Scale: 1
Value: true
Value: true
Enabled: true
Keep: 1
Name: Odometry
Position Tolerance: 0.10000000149011612
Queue Size: 10
Shape:
Alpha: 1
Axes Length: 0.5
Axes Radius: 0.20000000298023224
Color: 255; 25; 0
Head Length: 0.30000001192092896
Head Radius: 0.10000000149011612
Shaft Length: 1
Shaft Radius: 0.05000000074505806
Value: Axes
Topic: /vins_estimator/odometry
Unreliable: false
Value: true
Enabled: true
Global Options:
Background Color: 255; 255; 255
Default Light: true
Fixed Frame: world
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Theta std deviation: 0.2617993950843811
Topic: /initialpose
X std deviation: 0.5
Y std deviation: 0.5
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/ThirdPersonFollower
Distance: 14.900397300720215
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Field of View: 0.7853981852531433
Focal Point:
X: -1.706774115562439
Y: -2.435426712036133
Z: 5.149927346792538e-06
Focal Shape Fixed Size: true
Focal Shape Size: 0.05000000074505806
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.009999999776482582
Pitch: 1.0197973251342773
Target Frame:
Yaw: 3.5065858364105225
Saved:
- Class: rviz/FPS
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Invert Z Axis: false
Name: FPS
Near Clip Distance: 0.009999999776482582
Pitch: 0.4000000059604645
Position:
X: -11
Y: 0
Z: 8
Roll: 0
Target Frame: my_view
Yaw: 0
- Class: rviz/FPS
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Invert Z Axis: false
Name: FPS
Near Clip Distance: 0.009999999776482582
Pitch: 0.5
Position:
X: -10
Y: 0
Z: 10
Roll: 0
Target Frame: my_view
Yaw: 0
- Class: rviz/FPS
Enable Stereo Rendering:
Stereo Eye Separation: 0.05999999865889549
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Invert Z Axis: false
Name: FPS
Near Clip Distance: 0.009999999776482582
Pitch: 0.6000000238418579
Position:
X: -10
Y: 0
Z: 10
Roll: 0
Target Frame: my_view
Yaw: 0
Window Geometry:
Displays:
collapsed: false
Height: 668
Hide Left Dock: false
Hide Right Dock: false
Image:
collapsed: false
QMainWindow State: 000000ff00000000fd00000004000000000000017b00000242fc0200000024fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073000000003d00000242000000c900fffffffb0000000a0049006d006100670065000000015d000001220000001600fffffffb0000000a0056006900650077007300000001ee000000ad000000a400fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000c00430061006d00650072006100000001d1000000b50000000000000000fb0000000a00640065007000740068000000031d000002310000001600fffffffb0000000a0049006d0061006700650100000415000000f80000000000000000fb0000000a0049006d00610067006501000003f4000001190000000000000000fb0000000a0064006500700074006800000004a2000000ac0000000000000000fb0000000a0064006500700074006800000003b4000001b60000000000000000fb0000000a0064006500700074006800000004b9000000950000000000000000fb0000000a006400650070007400680000000481000000cd0000000000000000fb0000000a006400650070007400680000000429000001250000000000000000fb0000000a0064006500700074006800000003b7000000af0000000000000000fb0000000a0064006500700074006800000003d5000000b50000000000000000fb0000000a006400650070007400680000000444000001260000000000000000fb0000000a00640065007000740068000000041f0000014b0000000000000000fb0000000a0064006500700074006800000001b8000000160000000000000000fb0000000a0064006500700074006800000001c1000000160000000000000000fb0000000a0064006500700074006800000004b1000000550000000000000000fb0000000a006400650070007400680000000505000000650000000000000000fb0000000a006400650070007400680000000502000000680000000000000000fb0000000a0064006500700074006800000004f9000000710000000000000000fb0000000a0064006500700074006800000004e9000000810000000000000000fb0000000a0064006500700074006800000004de0000008c0000000000000000fb0000000a0064006500700074006800000004cc0000009e0000000000000000fb0000000a0064006500700074006800000004bb000000af0000000000000000fb0000000a0064006500700074006800000004aa000000c00000000000000000fb0000000a006400650070007400680000000498000000d20000000000000000fb0000000a0049006d00610067006500000003fa000001540000000000000000000000010000010f00000385fc0200000002fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000006100000003bfc0100000002fb0000000800540069006d00650000000000000006100000041800fffffffb0000000800540069006d00650100000000000004500000000000000000000002600000024200000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: false
Width: 608
X: 1265
Y: 60
depth:
collapsed: false
修改完成后保存即可!
接下来我们先运行 Realsense 和 VINS-Fusion-gpu,如果没有安装 Realsense 和 VINS-Fusion-gpu,参考以下两篇文章
Jetson Orin NX 开发指南(4): 安装 CUDA 和 Realsense_想要个小姑娘的博客-CSDN博客
Jetson Orin NX 开发指南(6): VINS-Fusion-gpu 的编译和运行_想要个小姑娘的博客-CSDN博客
首先打开超级终端,划分为四个终端,
然后在第一个终端输入
roslaunch realsense2_camera rs_camera.launch
在第二个终端输入
source ~/catkin_ws/src/vins-fusion-gpu/devel/setup.bash
roslaunch vins realsense_d435i.launch
第三个终端输入
source ~/catkin_ws/src/ego-planner-swarm/devel/setup.bash
roslaunch ego_planner single_run_in_exp.launch
第四个终端输入
source ~/catkin_ws/src/ego-planner-swarm/devel/setup.bash
roslaunch ego_planner rviz_exp.launch
如下所示
依次运行后显示如下结果