myAGV-cartographer real-time map building

1. Open the slam laser scan launch file

After opening the car, open the console terminal (shortcut Ctrl+Alt+T),and enter the following command in the command line:

cd myagv_ros
roslaunch myagv_odometry myagv_active.launch

Note: Before opening the launch file, please place the car at a suitable starting point in the environment where you need to build the map, because opening the launch file will open the IMU sensor and odometer of the car, and moving the car artificially will cause distortion of the car build.

Open the launch file required for the carriage slam laser scan, if it shows

Now YDLIDAR is scanning ......

Then the car lidar file is opened successfully and the status is displayed in the terminal as follows:


2. Open the cartographer build launch file

Open a new console terminal and enter the following command at the command line:

cd myagv_ros
roslaunch cartographer_ros demo_myagv.launch

Open the launch file required for the cartographer build. If the terminal keeps scrolling the output data, the cartographer build file is successfully opened, and the terminal displays the following status:


If an error is reported in the terminal, use the shortcut Ctrl+C to close the terminal, move the carriage slightly, and then re-enter the build command. The error message in the terminal is as follows:


When the code runs successfully, rviz will be opened, and the map and lidar information will be displayed in rviz, and the red arrow is the direction of the car. The interface is shown in the figure.


Note: If Rviz emulation cannot be opened, you can check if the last 2-4 lines of demo_myagv.launch file are commented out, the directory of the file is /home/ubuntu/google_ws/src/cartographer_ros/cartographer_ros/launch/. If it is commented, just uncomment it to open it.

3.Open the keyboard control file

Reopen a console terminal and in the terminal command line type.

cd myagv_ros
roslaunch myagv_teleop myagv_teleop.launch


Directional keys: Keystrokes | Directions -------- | ----- i | forward , | Backward j | Move left l | Move right u|Rotate counterclockwise o|clockwise rotation k|stop

4.Start building a map

Now the car can start to move under the control of the keyboard, control the car around the space where you want to build the map. At the same time, you can see our map in the Rviz space will follow the car's movement and build the map a little bit. Note: When using the keyboard to operate the car, make sure that the terminal running the myagv_teleop.launch file is the currently selected window, otherwise the keyboard control program will not recognize the keyboard keys.


5.Save the constructed map

Open another new console terminal and enter the following command on the command line to save the completed map from the car scan.

rosrun map_server map_saver

After running successfully the terminal displays the following:


Here you can see that we have drawn a red circle for the two files generated after saving the map, map.pgm and map.yaml, which will be saved in the home directory by default. Typing cd in the same terminal will bring us to our home directory, and then typing ls will bring us to our home directory where the generated map files have been created.


results matching ""

    No results matching ""