Launch Cartographer with 2D LIDAR
Prerequisites
Connect a Slamtec* RPLIDAR A3 2D LIDAR to your system.
Before you run the sample application, you must add a udev rule.
- Enter the command:sudo nano /etc/udev/rules.d/rpildar.rules
- Add these lines:# set the udev rule, make the device_port be fixed by rplidar # KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0777", SYMLINK+="rplidar"
- Reload the rules:sudo udevadm control --reload-rules sudo udevadm trigger
Run the Sample Application
- Go to theAMR_containersfolder:cd <edge_insights_for_amr_path>/Edge_Insights_for_Autonomous_Mobile_Robots_<version>/AMR_containers
- Open a terminal. Run the command below to start the Docker* container../run_interactive_docker.sh amr-ubuntu2004-full-flavour-sdk:<TAG> eiforamr ros2 launch rplidar_ros2 view_rplidar_a3_launch.py
- Open another terminal. Attach to the running container and get the container ID of your running Docker image:docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ad0af7a34051 ger-is-registry.caas.intel.com/sunsetlake/amr-ubuntu2004-full-flavour-sdk "/docker_entrypoint.…" 3 hours ago Up 3 hours amr_sdk_docker docker exec -it <container_id> /bin/bash # (e.g. docker exec -it ad0af7a34051 /bin/bash)
- Within the Docker container, run the commands:source /ros_entrypoint.sh ros2 run cartographer_ros cartographer_node -configuration_directory /opt/ros/foxy/share/cartographer/configuration_files/ -configuration_basename rplidar_a3.lua
- Go to rviz2 that is already open and uncheckLaserScanon the left side.
- ClickAddin lower left corner, click by topic and addPointCloud2from the/scan_matched_points2topic.
Troubleshooting
If the following error is encountered:
$ ./run_interactive_docker.sh amr-ubuntu2004-full-flasvour-sdk:<TAG> eiforamr
bash: ./run_interactive_docker.sh Permission denied
Give executable permission to the script:
$ chmod 755 run_interactive_docker.sh
Summary and Next Steps
In this tutorial, you learned how to launch the Cartographer application
with 2D LIDAR.
As a next step, see the Run FastMapping Algorithm
tutorial.