Developing Self Driving with Jetson Nano · Phase 0 · ROS2 Foxy (archived) · ROS2 Setup (2)
Goal: Build a ROS2 workspace with the
rplidar_rosdriver and get the RPLIDAR A1 running.
Result: ❌ Failed / abandoned — the LiDAR worked on ROS2 after the port fix, but the project moved to ROS1 Noetic (LiDAR again in Jetson Project #4).
Final code: not used in the final code (ROS2 driver; the ROS1 LiDAR setup issrc/robot_bringup/launch/lidar.launch).
Env: Jetson Nano B01 · Ubuntu 20.04 · ROS2 Foxy
🔧 Problem:
rplidar_nodedied withError, unexpected error, code: 80008004.
Cause: the driver could not talk to the LiDAR over the serial port (port name / permission / settings).
Fix: check the port, add the user todialout,chmod 666 /dev/ttyUSB0, and set the port, baud rate and frame in the launch file.
❌ Tried:
git clone https://github.com/robopeak/rplidar_ros.git→ this repository is the ROS1 driver (it still works on ROS1), sorosdep installfails on ROS2:
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
rplidar_ros: Cannot locate rosdep definition for [rosconsole]
Continuing to install resolvable dependencies...

✅ Use the ros2 branch of the Slamtec repository instead:
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone -b ros2 https://github.com/Slamtec/rplidar_ros.git
If you already cloned the wrong repository, delete it first and clone again:
cd ~/ros2_ws/src
rm -rf rplidar_ros
git clone -b ros2 https://github.com/Slamtec/rplidar_ros.git

cd ~/ros2_ws
rosdep update
rosdep install --from-paths src --ignore-src -r -y

colcon build
source install/setup.bash
All commands of steps 2–4:

With the robopeak repository the launch file is rplidar.launch.py:
ros2 launch rplidar_ros rplidar.launch.py

If you see this error, switch to
Slamtec/rplidar_ros(-b ros2) as in Step 1.
With Slamtec/rplidar_ros (used from here on) the A1 has its own launch file:
ros2 launch rplidar_ros rplidar_a1_launch.py
code: 80008004Output:
jetson@nano:~/ros2_ws$ ros2 launch rplidar_ros rplidar_a1_launch.py
[INFO] [launch]: All log files can be found below /home/jetson/.ros/log/2024-11-18-19-01-13-608322-nano-15970
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [rplidar_node-1]: process started with pid [15976]
[rplidar_node-1] [INFO] [1731952874.222439109] [rplidar_node]: RPLidar running on ROS2 package rplidar_ros. RPLIDAR SDK Version:2.1.0
[rplidar_node-1] [ERROR] [1731952874.222796098] [rplidar_node]: Error, unexpected error, code: 80008004
[ERROR] [rplidar_node-1]: process has died [pid 15976, exit code 255, cmd '/home/jetson/ros2_ws/install/rplidar_ros/lib/rplidar_ros/rplidar_node --ros-args -r __node:=rplidar_node --params-file /tmp/launch_params_68htuxzc'].

ls /dev/ttyUSB*
dialout groupsudo usermod -a -G dialout $USER
Check the groups:
groups $USER
sudo chmod 666 /dev/ttyUSB0
rplidar_a1_launch.pynano ~/ros2_ws/src/rplidar_ros/launch/rplidar_a1_launch.py
I changed serial_port, serial_baudrate, frame_id, inverted = False and angle_compensate = True in the Node(...) part:

📄 ~/ros2_ws/src/rplidar_ros/launch/rplidar_a1_launch.py (the Node part, transcribed from the screenshot)
Node(
package='rplidar_ros',
executable='rplidar_node',
name='rplidar_node',
parameters=[{'channel_type': channel_type,
'serial_port': '/dev/ttyUSB0',
'serial_baudrate': 115200,
'frame_id': 'laser_frame',
'inverted': False,
'angle_compensate': True}],
output='screen'),
⚠️ In the screenshot
/dev/ttyUSB0andlaser_framehave no quotes. They have to be Python strings ('/dev/ttyUSB0','laser_frame'), otherwise the launch file does not load.
💡 The same file already declares launch arguments (
serial_port,serial_baudrate,frame_id,inverted,angle_compensate). With the unedited file you can pass the values on the command line instead:
ros2 launch rplidar_ros rplidar_a1_launch.py serial_port:=/dev/ttyUSB0 frame_id:=laser_frame
Finally the RPLIDAR A1 works:

rplidar_node: health status OK, scanning at 10 Hz
➡️ Next: Ros2 Cartographer Setup(2)_custom serial communication node