3) Package environment Settings:
Note: Add permanent workspace environment variables. It will be very convenient if
ROS environment variables are automatically added to your bash session every time you
start a new shell:
4) Verify that your package path is set, echo the ROS_PACKAGE_PATH variable.
5) You should see something like this: /home/tony/ydlidar_ws/src:/opt/ros/melodic/share
Create Serial Port Alias [Optional]
Note: After completing the previous operation, re-insert the LiDAR again.
3.4 Run the ydlidar_ros_driver
Run ydlidar_ros_driver with startup file, as shown below:
3.5 RVIZ View Scan Results
Run the launch file and open rviz to view the G2 scan results, as shown in the figure
below:
Note: G4 lidar is taken as an example by default. If other types of lidars are used, lidar.launch in the
lidar_view.launch file needs to be changed to the corresponding **.launch file. (If G2 radar is
used, it needs to be changed to G2.launch)