Use this
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/robopeak/rplidar_ros.git
git clone https://github.com/robopeak/rplidar_ros.git
*This code doesn't support in ros2
(developed in ros1 is still working)

Enter the code instead of above
git clone -b ros2 https://github.com/Slamtec/rplidar_ros.git
If you mistake at git clone, command this
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
full command

If you use "robopeak/rplidar_ros.git"
ros2 launch rplidar_ros rplidar.launch.py

If you see this error change command "Slamtec/rplidar_ros.git"
(We are using Slamtec/rplidar_ros.git now. )
ros2 launch rplidar_ros rplidar_a1_launch.py
_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'].
_

check your use port name
ls /dev/ttyUSB*
Group Edit
sudo usermod -a -G dialout $USER
Check group
groups $USER
Give Authority to usb port
sudo chmod 666 /dev/ttyUSB0
Edit rplidar_a1_launch.py
nano ~/ros2_ws/src/rplidar_ros/launch/rplidar_a1_launch.py

In this code(ros2_ws/src/rplidar_ros/launch/rplidar_a1_launch.py), I edit "serial port" & "serial_baudrate" & "laser_frame" & "inverted = False" & "angle_compensate: True"
Finally "Rplidar a1" work well!!
