Lidar based localization is a localization approach that specifically develop for the Autobin project. The purpose is to estimate the position of the vessels and its ego pose with respect to the environment given. This project is developed in ROS2 foxy.
Assumed the ROS2 package already in your system. Clone this git repositiory.
git clone https://github.com/khalisfadil/ROS2-Slam-EKF-application.git
to build. we assume that your ROS2 foxy package is in /opt
directory,
cd dev2_ws
source /opt/ros/foxy/setup.bash
. install/setup.bash
colcon build
This project is not running in a real-time. Thus, we are using a rosbag to play the point cloud data. It is important to run a point cloud data in form of rosbag. In this project, the rosbag is generated by using ROS1 and not ROS2. Thus a small modification is needed to a play a bag from ROS1 within a ROS2 system.
To play a rosbag of ROS1 in a ROS2 system, you need to have a ROS1 package installed in your working platform. This project use ros-neotic.
Each time you want to run a ROS1 bag in ROS2 system, you need to do as follows:
- open new terminal (make sure ther new terminal is not sourced into ROS2)
- source ROS1 package
source /opt/ros/noetic/setup.bash;
- source your ROS2 package
source /opt/ros/foxy/setup.bash;
- and run your ROS1 bag as example follows:
ros2 bag play -s rosbag_v2 30.bag --topics front_lidar /odom;
you can see in the example that specific topic is describe. This is really important to know what is topic that is inside your bag. This repisotory will subscribe for a PointCloud2 topic. If the topic in your bag is not similar as the example above, you can always change it in the launch file.
cd dev2_ws/src/my_package/launch/slam.launch.py
change the topic respectively to your topic:
slam = launch_ros.actions.Node(
package='my_package',
executable='my_slam_node',
parameters=[slam_param_dir],
remappings=[('cloud_topic','front_lidar'),('odom_topic','/odom')],
output='screen'
)
you need to be famialiarized with the data structure and working princpiple of ROS. In the dev2_ws
you will find all the necessary component for localization process. The application can be run by using a single launch file.
ros2 launch my_package slam.launch.py
This project consist of a launch of ROS nodes, playing a rosbag from ROS1 and recording an output rosbag with ROS2. Thus, generating a Shell scripts is really helpful in order to launch a multiple nodes within a separate Terminal by only using a single command. We have prepared the shell scripts which can be found in the script
file. To launch the script file, you can do as follows:
./rosbagplay.sh
if you have some problem run the shell script, try
chmod +x rosbagplay.sh
This project use packages from other repisotory. These packages are imported and installed under the src
file. The packages is listed below:
Lidar base Localization is using the Point cloud data to estimate the pose when GPS is not available. However, to depend only on the scan registration is not possible. Thus, the system is supported by the motion model which deplyoed within the Kalman Filter.
The motion model considered is constant velocity (CV) mode and constant acceleration (CA) model.