Welcome to EAI X3 Pro LiDAR repository
1.Preparation
Preparation
1. Install SDK
Unzip YDLidar-SDK-master.tar.xz in the source code folder to get YDLidar-SDK-master.
Input following command:
mkdir buildcd buildcmake ..make -j4sudo make install
2.Compilation Function Package
Unzip ydlidar in the source folder_ ROS2_ Driver master, obtain ydlidar_ ROS2_ Driver master feature pack.
Copy ydlidar_ ROS2_ Drive master to the src directory of your own workspace
Using the workspace ydlidar_ Ws is an example, rplidar_ Ws is located in the ~ directory.
Then, go back to the workspace directory and compile it,
xxxxxxxxxxcd ~/ydlidar_wscolcon build --symlink-install

The above screen indicates that the compilation has passed.
Input following command to set the environment variable.
xxxxxxxxxxecho "source ~/ydlidar_ws/install/setup.bash --extend" >> ~/.bashrcInput the following command to bind lidar port name
xxxxxxxxxxcd /home/yahboom/ydlidar_ws/src/ydlidar_ros2_driver-master/startupsudo chmod 777 initenv.shsudo bash initenv.shThen, re-plug the lidar wiring and enter the command ll /dev/rplidar in the terminal.

The above content indicates that the binding is successful. The end is not necessarily 0 and changes according to the order in which the devices are inserted.
3. Run launch
Input following command:
xxxxxxxxxx#x3/x3pro lidarros2 launch ydlidar_ros2_driver x3_ydlidar_launch.py#4ros lidarros2 launch ydlidar_ros2_driver 4ros_ydlidar_launch.pyView lidar data with rostopic tool.
xxxxxxxxxxros2 topic echo /scan

ctrl+ c closes the terminal that just drove the lidar.
Then enter the following statement in the terminal to drive the lidar, and open rviz to display the point cloud.
x
#x3/x3pro lidarros2 launch ydlidar_ros2_driver ydlidar_x3_view_launch.py#4ros lidarros2 launch ydlidar_ros2_driver ydlidar_4ros_view_launch.py