Task Description: please refer to ./docs/ME5413_Final_Project.pdf.
You can read our report for more details.
Demo:
For the insturcitons of the original simulation environment that this project relies on, please refer to ME5413_Final_Project-Github.
If you have any questions, please feel free to contact us: smkk00715@gmail.com
- SLAM
- Cartographer
- Fast-LIO2
- Map Fusion
- Planning and Control (PnC)
- A*
- Theta*
- DWA
- TEB
- Model Predictive Control (MPC)
- Perception: EasyOCR
- Decision and Exploration
- Finite State Machine (FSM)
- Frontier and occupancy grid map-based exploration
- Pipeline: Highly modular, automated, and configurable
.
├── final_fsm # Finite State Machine package
├── final_percep # Perception package
├── final_pnc # Navigation package
├── final_slam # SLAM package
├── interactive_tools # Interactive tools for rviz
├── jackal # Jackal package
├── jackal_description # Modified Jackal model package
├── me5413_world # Gazebo simulation package
└── third_party # Third-party packages. We have modified or tailored some of them.
- Ubuntu 20.04
- ROS Noetic
- C++11 and above
Recommend to use the following script if you haven't installed ROS yet:
wget http://fishros.com/install -O fishros && . fishros
Super simple installation! Just run:
cd ~; git clone https://github.com/brian00715/Autonomous-Robot-Navigation me5413_final_ws
cd ~/me5413_final_ws; bash ./install.sh
-
Some useful commands installed
gazebok
: kill gazebo immediately.rosk
: kill all ros-related programs immediately.
cp -r ~/me5413_final_ws/src/me5413_world/models/* ~/.gazebo/models
cd ~/me5413_final_ws
catkin init
catkin config -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCMAKE_BUILD_TYPE=RelWithDebInfo
Note: You can choose to install the relied SLAM packages. No need to install all of them.
-
Install Abseil-cpp Library
~/me5413_final_ws/src/third_party/cartographer/cartographer/scripts/install_abseil.sh
-
Build:
cd ~/me5413_final_ws catkin build cartographer*
-
Build
cd ~/me5413_final_ws catkin build fast_lio
Note: the SLAM packages should be built before this step.
catkin build
echo "source ~/me5413_final_ws/devel/setup.bash" >> ~/.bashrc
bash
Please install conda
first.
conda create -n me5413 python=3.8
conda activate me5413
conda install pytorch==2.1.1 torchvision==0.16.1 pytorch-cuda=12.1 -c pytorch -c nvidia
conda install -c conda-forge opencv rosdep rospkg easyocr decorator pexpect numpy defusedxml ipdb
export PYTHONPATH=$PYTHONPATH:/usr/lib/python3.8/dist-packages
Note: please confirm the conda environment and Cartographer have already been installed and built scuccessfully before running the one-click launch.
rosrun final_fsm start.sh
rosrun final_fsm start.sh -e -r # enable EKF and enable screen recording
You can simply kill all the programs immediately by running:
tmux kill-server
export ENABLE_EKF=false # set to false means using the ground truth odometry, otherwise the EKF odometry fusing IMU the wheel odometry
roslaunch me5413_world me5413_world.launch
-
Cartographer
roslaunch final_slam mapping_carto.launch # default Mapping configuration roslaunch final_slam mapping_carto_2d.launch # 2D Cartographer Mapping roslaunch final_slam mapping_carto_3d.launch # 3D Cartographer Mapping
An example of mapping by 2D Cartographer is shown as follows:
-
Fast-LIO
source ~/me5413_final_ws/devel/setup.bash roslaunch final_slam mapping_fast_lio.launch
An example of point cloud by FastLIO is shown as follows:
-
Point Cloud to Map
After mapping with Fast-LIO, we offer a ROS package called
pcd2pgm
to convert the.pcd
files generated by Fast-Lio (located insrc/third_party/FAST_LIO/PCD
) into standard.pgm
map files. To compile this package, please execute:cd ~/me5413_final_ws catkin build pcd2pgm
To generate the map, run the following command:
source ~/me5413_final_ws/devel/setup.bash roslaunch pcd2pgm pcd2pgm.launch
After seeing 'data size =' displayed in the terminal, open a new terminal in your map folder and execute:
rosrun map_server map_saver
Then you can obtain the
.pgm
map file. An example is shown as follows:
-
-
Map Fusion
To fully utilize the maps generated both by Cartographer and Fast-LIO, we provide a simple Python script that uses image processing methods to fuse these two high-quality maps into one. To perform this, execute:
cd ~/me5413_final_ws/src/final_slam/scripts chmod +x map_fusion.py python3 map_fusion
You will obtain the fused map named
fusion_map.pgm
infinal_slam/maps
. The result is shown as follows:
roslaunch final_slam localization_carto.launch # cartographer by default
roslaunch final_pnc pnc.launch
roslaunch final_fsm fsm.launch
Someone may encounter the issue that the RViz runs extremely slow when visualizing the point cloud. To accelerate the point cloud processing, you can edit the Velodyne description file:
roscd velodyne_description/urdf
Open the VLP-16.urdf.xacro
and HDL-32E.urdf.xacro
, change the gpu:=false
to gpu:=true
on line 4.
To change to map used for localization, modify the map_file
parameter in final_slam/launch/localization_carto.launch
.
You can choose which global planner or local planner to use in final_pnc/launch/pnc.launch
.
Note: For the current version, if you want to use the DWA or TEB local planner, you should set arg
local_planner
to a value other thanmpc
. Uncomment the corresponding local planner from lines 40-47 and comment out lines 49-50 infinal_pnc/launch/pnc.launch
.
You can modify the parameters in final_pnc/config/*/*.yaml
to adjust the performance. For exmaple, you can adjust the max_vel
in final_pnc/config/nav_params/mpc.yaml
to change the maximum velocity of MPC local planner.
We would like to thank the following open-source projects:
- ME5413_Final_Project
- Cartographer
- Fast-LIO
- ros_motion_planning
- pcd2pgm_package
- PA-DMPC-UAV-Ad-Hoc
- EasyOCR
- occ_grid_mapping