README
iRobot® Create® 3 LIDAR SLAM demo
This example sets up LIDAR SLAM with a Create® 3 robot and Slamtec RPLIDAR spinning laser rangefinder.
Parts List
Setup
Hardware Setup
The files in this example assume the RPLIDAR is mounted 12 mm behind the center of rotation on the top of the Create 3 robot, in the arrangement shown below.
The SLAM solver relies on a proper tf
tree; if you wish to mount the sensor in another location, you will need to modify the parameters in the static transform publisher launched from launch/sensors_launch.py
.
Note that all STLs of brackets referenced in this example are found in our create3_docs repository.
Affix a LIDAR to your robot. STLs are available to mount an RPLidar A1M8 as well as its USB adapter. The LIDAR can be attached to the mounting plate using qty. 4 of M2.5 x 8 screws. The USB adapter can be attached to its mounting plate by heat staking (we used a soldering iron with an old tip in a well-ventilated space). Both mounting plates can be attached to the Create® 3 faceplate with M3 x 10 self-tapping screws.
Affix a single board computer (abbreviated as SBC for this guide) to your robot. In this example, we use a Raspberry Pi® 4, but other devices should work. STLs are available to mount a Raspberry Pi® to the Create® 3 robot. The Raspberry Pi® can be attached to the mounting plate using qty. 4 of M2.5 x 6 self-tapping screws. The mounting plate can be attached to the Create® 3 cargo bay with M3 x 10 self-tapping screws.
Connect the LIDAR to the SBC with a USB Micro B to USB A cable. Thread the cable through the passthrough in the top of the robot.
Connect the SBC to the Create® 3 adapter board with a USB-C® to USB-C® cable.
SBC Setup
On the SBC, clone and build the create3_examples repository.
Source the setup shell scripts in EVERY terminal you open:
source ~/create3_examples_ws/install/local_setup.sh
Run the sensors launch script, which includes the LIDAR driver and transform from the laser scan to the robot:
ros2 launch create3_lidar_slam sensors_launch.py
If your robot is using a namespace, you should add namespace:='ROBOTNAMESPACE'
to the previous command, where ROBOTNAMESPACE
is the namespace of your robot
In a separate terminal run slam toolbox:
ros2 launch create3_lidar_slam slam_toolbox_launch.py
If your robot is using a namespace, you should add namespace:='ROBOTNAMESPACE'
to the previous command, where ROBOTNAMESPACE
is the namespace of your robot.
There may be some warnings and errors on startup, but the following message will be printed once everything is ready:
[async_slam_toolbox_node-1] Registering sensor: [Custom Described Lidar]
In a third terminal, drive the robot around:
ros2 run teleop_twist_keyboard teleop_twist_keyboard
If your robot is using a namespace, you should add --ros-args -r __ns:=/ROBOTNAMESPACE
to the previous command, where ROBOTNAMESPACE
is the namespace of your robot.
Computer Setup
Clone and build the create3_examples repository. Then source the setup shell scripts.
source ~/create3_examples_ws/install/local_setup.sh
Run the rviz launch script, which launches rviz2 with the appropriate configuration:
ros2 launch create3_lidar_slam rviz_launch.py
If your robot is using a namespace, you should add namespace:='ROBOTNAMESPACE'
to the previous command, where ROBOTNAMESPACE
is the namespace of your robot.
The rviz2 configuration this command imports will configure rviz2 to subscribe to the laser, the occupancy map, and display the base_footprint
tf frame that the laser is building off of from the map frame.
Tips and Tricks
Limit rotation speed for best results.
Troubleshooting
Ensure the robot, SBC, and computer are all on the same network, using the same middleware.
If using CycloneDDS, and you are using multiple network interfaces on either the SBC or the computer, be sure to set up your XML profile(s) properly.
Check your tf tree and make sure it has all the same transforms as this sample tree.