Limo is a smart educational robot published by AgileX Robotics. More details please visit: https://global.agilex.ai/
Four steering modes make LIMO substantially superior to other robots in its class. The available modes are: Omni-Wheel Steering, Tracked Steering, Four-Wheel Differential Steering and Ackermann Steering. These advanced steering modes plus a built-in 360° scanning LiDAR and RealSense infrared camera make the platform perfect for industrial and commercial tasks in any scenario. With these incredible features, LIMO can achieve precise self-localization, SLAM mapping, route planning and autonomous obstacle avoidance, reverse parking, traffic light recognition, and more.
Mapping
Gmapping
Gmapping is a widely adopted open-source SLAM algorithm that operates within the filtering SLAM framework. It effectively uses wheel odometry data and does not heavily rely on high-frequency laser LiDAR scans. When constructing a map of a smaller environment, Gmapping requires minimal computational resources to maintain high accuracy. Here the ROS encapsulated Gmapping package is used to achieve the Gmapping for Limo.
Note: The speed of limo should be slow in the process of mapping. If the speed is too fast, the effect of mapping will be affected.
Run the command in a new terminal. It launches the LiDAR.
roslaunch limo_bringup limo_start.launch pub_odom_tf:=false
Then launch the gmapping algorithm. Open another new terminal, and enter the command:
roslaunch limo_bringup limo_gmapping.launch
After launching successfully, the rviz visualization tool will start up. The interface is shown in the figure.
At this time, the handle can be set to remote control mode and control limo mapping.
After building the map, run the following command to save the map to the specified directory:
- Switch to the directory where you need to save the map, save the map to ~/agilex_ws/src/limo_ros/limo_bringup/maps/, and enter the command in the terminal:
cd ~/agilex_ws/src/limo_ros/limo_bringup/maps/
- After switching to /agilex_ws/limo_bringup/maps, continue to enter the command in the terminal:
rosrun map_server map_saver –f map1
Note: map1 is the name of the saved map, and duplicate names should be avoided when saving the map.
Cartographer
Cartographer is a set of SLAM algorithms based on image optimization launched by Google. The main goal of this algorithm is to achieve low computing resource consumption and achieve the purpose of real-time SLAM. The algorithm is mainly divided into two parts. The first part is called Local SLAM. This part establishes and maintains a series of Submaps through each frame of the Laser Scan, and the so-called submap is a series of Grid Maps. The second part called Global SLAM, is to perform closed-loop detection through Loop Closure to eliminate accumulated errors: when a submap is built, no new laser scans will be inserted into the submap. The algorithm will add the submap to the closed-loop detection.
Note: Before running the command, please make sure that the programs in other terminals have been terminated. The termination command is: Ctrl+c.
Note: The speed of limo should be slow in the process of mapping. If the speed is too fast, the effect of mapping will be affected.
Launch a new terminal and enter the command:
roslaunch limo_bringup limo_start.launch pub_odom_tf:=false
Then start the cartographer mapping algorithm. Open another new terminal and enter the command:
roslaunch limo_bringup limo_cartographer.launch
After launching successfully, the rviz visualization interface will be shown as the figure below:
After building the map, it is necessary to save it. Three following commands need to be entered in the terminal:
(1)After completing the trajectory, no further data should be accepted.
rosservice call /finish_trajectory 0
(2)Serialize and save its current state.
rosservice call /write_state "{filename: '${HOME}/agilex_ws/src/limo_ros/limo_bringup/maps/mymap.pbstream'}"
(3)Convert pbstream to pgm and yaml
rosrun cartographer_ros cartographer_pbstream_to_ros_map -map_filestem=${HOME}/agilex_ws/src/limo_ros/limo_bringup/maps/mymap.pbstream -pbstream_filename=${HOME}/agilex_ws/src/limo_ros/limo_bringup/maps/mymap.pbstream -resolution=0.05
Generate the corresponding pgm and yaml, and put them in the directory:
${HOME}/agilex_ws/src/limo_ros/limo_bringup/maps/mymap.pbstream
Note: During the process of mapping, some warnings will appear in the terminal. This is caused by the excessive speed and the delayed data processing, which can be ignored.
Navigation
Navigation framework
The key to navigation is robot positioning and path planning. For these, ROS provides the following two packages.
(1)move_base:achieve the optimal path planning in robot navigation.
(2)amcl:achieve robot positioning in a two-dimensional map.
On the basis of the above two packages, ROS provides a complete navigation framework.
The robot only needs to publish the necessary sensor information and navigation goal position, and ROS can complete the navigation function. In this framework, the move_base package provides the main operation and interactive interface of navigation. In order to ensure the accuracy of the navigation path, the robot also needs to accurately locate its own position. This part of the function is implemented by the amcl package.
1.1 Move_base package
move_base is a package for path planning in ROS, which is mainly composed of the following two planners.
(1) Global path planning (global_planner). Global path planning is to plan the overall path according to a given goal position and global map. In navigation, Dijkstra or A* algorithm is used for global path planning, and the optimal route from the robot to the goal position is calculated as the robot’s global path.
(2) Local real-time planning (local_planner). In practice, robots often cannot strictly follow the global path. So it is necessary to plan the path that the robot should travel in each cycle according to the map information and obstacles that may appear near the robot at any time. So that it conforms to the global optimal path as much as possible.
1.2 Amcl package
Autonomous positioning means that the robot can calculate its position on the map in any state. ROS provides developers with an adaptive (or kld sampling) Monte Carlo localization (amcl), which is a probabilistic positioning system that locates mobile robots in 2D. It implements an adaptive (or KLD-sampling) Monte Carlo localization, using particle filtering to track the pose of the robot on a known map.
1.3 Introduction of DWA_planner and TEB_planner
DWA_planner
The full name of DWA is Dynamic Window Approaches. The algorithm can search for multiple paths to avoid and travel, select the optimal path based on various evaluation criteria (whether it will hit an obstacle, the time required, etc.), and calculate the linear velocity and angular velocity during the driving cycle to avoid collisions with dynamic obstacles.
TEB_planner
The full name of “TEB” is Time Elastic Band Local Planner. This method performs subsequent modifications to the initial trajectory generated by the global path planner to optimize the robot’s motion trajectory and belongs to local path planning. In the process of trajectory optimization, the algorithm has a variety of optimization goals, including but not limited to: overall path length, trajectory running time, distance to obstacles, passing intermediate path points, and compliance with robot dynamics, kinematics, and geometric constraints. The“TEB method” explicitly considers the dynamic constraints of time and space in the state of motion, for example, the velocity and acceleration of the robot are limited.
Limo navigation
Note: In the four-wheel differential mode, the omnidirectional wheel mode and the track mode, the file run for the navigation is the same.
Note: Before running the command, please make sure that the programs in other terminals have been terminated. The termination command is: Ctrl+c.
(1)First launch the LiDAR and enter the command in the terminal:
roslaunch limo_bringup limo_start.launch pub_odom_tf:=false
(2)Launch the navigation and enter the command in the terminal:
roslaunch limo_bringup limo_navigation_diff.launch
Note: If it is Ackermann motion mode, please run:
roslaunch limo_bringup limo_navigation_ackerman.launch
After launching successfully, the rviz interface will be shown in the figure below:
Note: If you need to customize the opened map, please open the limo_navigation_diff.launch file to modify the parameters. The file directory is: ~/agilex_ws/src/limo_ros/limo_bringup/launch. Please modify map02 to the name of the map that needs to be replaced.
3)After launching the navigation, it may be observed that the laser-scanned shape does not align with the map, requiring manual correction. To rectify this, adjust the actual position of the chassis in the scene displayed on the rviz map. Use the rviz tools to designate an approximate position for the vehicle, providing it with a preliminary estimation. Subsequently, use the handle tool to remotely rotate the vehicle until automatic alignment is achieved. Once the laser shape overlaps with the scene shape on the map, the correction process is concluded. The operational steps are outlined as follows:
The correction is completed:
(4)Set the navigation goal point through 2D Nav Goal.
A purple path will be generated on the map. Switch the handle to command mode, and Limo will automatically navigate to the goal point.
Limo path inspection
(1)First launch the LiDAR and enter the command in the terminal:
roslaunch limo_bringup limo_start.launch pub_odom_tf:=false
(2)Launch the navigation and enter the command in the terminal:
roslaunch limo_bringup limo_navigation_diff.launch
Note: If it is Ackermann motion mode, please run:
roslaunch limo_bringup limo_navigation_ackerman.launch
(3)Launch the path recording function. Open a new terminal, and enter the command in the terminal:
roslaunch agilex_pure_pursuit record_path.launch
After the path recording is completed, terminate the path recording program, and enter the command in the terminal: Ctrl+c.
(4)Launch the path inspection function. Open a new terminal, and enter the command in the terminal:
Note: Switch the handle to command mode.
roslaunch agilex_pure_pursuit pure_pursuit.launch