This the example code for project 1: mapping and localization.
Pre-requisite
sudo apt install ros-noetic-jsk-rviz-plugins
sudo apt install -y libpcap-dev
sudo apt-get install pcl-toolsDownload the code. Open a terminal and use the command below:
cd ~
mkdir -p catkin_ws/src
cd catkin_ws/src
git clone https://github.com/ros-drivers/velodyne.git
git clone https://github.com/xiaxin2000/aeng_563_localization.git
cd ~/catkin_ws
catkin_make
Download the data from Google Drive:
-
ROSBag sample: rosbag link
-
Point cloud map sample: map.pcd
Then, save the ROSBag and point cloud map into ~/catkin_ws
Mapping based on LIDAR using Normal Distribution Transformation algorithm
Change the line 3 of the file in ~/catkin_ws/src/aeng_563/lidar_localizer/launch/ndt_mapping.launch to your own workspace.
Open a terminal and use the command below:
cd ~/catkin_ws
source devel/setup.bash
roslaunch lidar_localizer ndt_mapping.launch
You will see:
Open another terminal:
cd ~/catkin_ws
rosbag play -r 0.2 2023-03-08-18-32-45.bagOpen a third terminal after a few seconds:
rostopic pub -r 1 /savemap std_msgs/Bool "data: true"The map will be save in your specified path.
Try to tune other parameters in the launch file and see what will happen.
After you see the map in the corresponding folder, you can check the map in a terminal using the command below:
pcl_viewer map.pcdYou will see:
Localization based on LIDAR using Normal Distribution Transformation algorithm and existing generated map
Change the line 10 of the file in ~/catkin_ws/src/aeng_563/lidar_localizer/launch/ndt_matching.launch to your own workspace.
Open a terminal and use the command below:
cd ~/ catkin_ws
source devel/setup.bash
roslaunch lidar_localizer ndt_matching.launch
Open another terminal:
cd ~/catkin_ws
rosbag play -r 0.2 2023-03-08-18-32-45.bag
You will see the following results:


