Ros2 Cartographer Setup(1)_ workspace build using Rplidar A1

mseokq23·2024년 11월 18일
2

1.Build workspace. Use the rplidar_ros package to interface with the RPLIDAR

Use this

mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/robopeak/rplidar_ros.git
  • But,
git clone https://github.com/robopeak/rplidar_ros.git

*This code doesn't support in ros2
(developed in ros1 is still working)

1.1 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...

1.2 Solution!

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

2. Install Dependency

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

3. Build Package

colcon build

4. Sourcing Workspace

source install/setup.bash

full command

5.Launch RPLIDAR node

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"

5.1 Else if you are using "Slamtec/rplidar_ros.git", command this instead.

(We are using Slamtec/rplidar_ros.git now. )

ros2 launch rplidar_ros rplidar_a1_launch.py

5.2 Trouble shooting when you faced with this error(1)

_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!!

0개의 댓글