### VLAN Configuration - Virtual NIC Setup Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/07_online_lidar_advanced_topics.md Commands to set up a virtual NIC for handling VLAN-tagged packets. This involves installing the vlan package, loading the 8021q module, and configuring the virtual interface. ```bash sudo apt-get install vlan -y sudo modprobe 8021q sudo vconfig add eno1 80 sudo ifconfig eno1.80 192.168.1.102 up ``` -------------------------------- ### Install libyaml-cpp-dev Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/README.md Install the libyaml-cpp-dev package, which is essential for rslidar_sdk. This can be skipped if ros-distro-desktop-full is installed. ```sh sudo apt-get update sudo apt-get install -y libyaml-cpp-dev ``` -------------------------------- ### Install libpcap-dev Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/README.md Install the libpcap-dev package, which is essential for rslidar_sdk. ```sh sudo apt-get install -y libpcap-dev ``` -------------------------------- ### Install Eigen Library Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/10_how_to_use_coordinate_transformation.md Install the libeigen library, which is a dependency for coordinate transformation in rslidar_sdk. ```bash sudo apt-get install libeigen3-dev ``` -------------------------------- ### Create Debian Package Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/12_how_to_create_deb.md Run this shell script to generate the .deb installable file. The file will be created in the parent directory of the rslidar_sdk project. ```shell ./create_debian.sh ``` -------------------------------- ### ROS 2 Specific Dependencies and Installation Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/CMakeLists.txt Specifies ROS 2 dependencies and installation paths for the executable and related launch/RViz files if rclcpp is found. ```cmake if(rclcpp_FOUND) ament_target_dependencies(rslidar_sdk_node rclcpp std_msgs sensor_msgs rslidar_msg) install(TARGETS rslidar_sdk_node DESTINATION lib/${PROJECT_NAME}) install(DIRECTORY launch rviz DESTINATION share/${PROJECT_NAME}) ament_package() endif(rclcpp_FOUND) ``` -------------------------------- ### ROS Launch File for rslidar_sdk Node Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/12_how_to_create_deb.md This ROS launch file configures and starts the rslidar_sdk node. It allows specifying a custom config_path; if left empty, it defaults to config.yaml in the ROS package path. It also includes a node for launching RViz with a specified configuration. ```xml ``` -------------------------------- ### ROS Specific Linking and Installation Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/CMakeLists.txt Conditionally links ROS libraries and installs the executable to the appropriate ROS package destinations if roscpp is found. ```cmake if(roscpp_FOUND) target_link_libraries(rslidar_sdk_node ${ROS_LIBS}) install(TARGETS rslidar_sdk_node RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}) endif(roscpp_FOUND) ``` -------------------------------- ### ROS Topic Configuration Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/06_how_to_decode_online_lidar.md Define ROS topics for receiving/sending packets and publishing IMU data and point clouds. Customize topic names as needed for your ROS setup. ```yaml ros: ros_frame_id: rslidar ros_recv_packet_topic: /rslidar_packets ros_send_packet_topic: /rslidar_packets ros_send_imu_data_topic: /rslidar_imu_data ros_send_point_cloud_topic: /rslidar_points ``` -------------------------------- ### VLAN Configuration - Driver Setup Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/07_online_lidar_advanced_topics.md Configure the LiDAR driver to use the virtual NIC created for VLAN stripping. The driver receives packets without the VLAN layer. ```yaml lidar: - driver: lidar_type: RSAIRY msop_port: 6699 difop_port: 7788 imu_port: 6688 ``` -------------------------------- ### Source DDS Modification Script Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/13_how_to_solve_ROS2_humble_frame_rate_drop.md Executes the dds_mod.sh script to install a new DDS and configure environment variables globally. This requires recompiling after execution. ```bash source dds_mod.sh ``` -------------------------------- ### Compile and Run with ROS Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/README.md Compile the rslidar_sdk in a ROS workspace using catkin_make and launch the driver. Ensure your setup.bash is sourced. ```sh catkin_make source devel/setup.bash roslaunch rslidar_sdk start.launch ``` -------------------------------- ### Download rslidar_sdk with Submodules Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/README.md Clone the rslidar_sdk repository and initialize/update its submodules, including the rs_driver core. ```sh git clone https://github.com/RoboSense-LiDAR/rslidar_sdk.git cd rslidar_sdk git submodule init git submodule update ``` -------------------------------- ### Launch ROS2 Humble Node Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/13_how_to_solve_ROS2_humble_frame_rate_drop.md Launches the rslidar_sdk node with specific DDS configurations for ROS2 Humble. This method is node-specific and does not affect the global environment. ```bash ros2 launch rslidar_sdk humble_start.py ``` -------------------------------- ### Common Configuration Parameters Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/06_how_to_decode_online_lidar.md Configure general message source and ROS publishing options. Set 'msg_source' to 1 for LiDAR data and 'send_point_cloud_ros' to true to publish point clouds. ```yaml common: msg_source: 1 send_packet_ros: false send_point_cloud_ros: true ``` -------------------------------- ### Common Configuration Parameters Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/intro/03_hiding_parameters_intro.md These parameters control message source and how data is sent in ROS and Protobuf formats. Set 'msg_source' to 1 for network input. 'send_packet_ros' and 'send_point_cloud_ros' control ROS packet and point cloud publishing, respectively. 'send_point_cloud_proto' controls Protobuf point cloud publishing. ```yaml common: msg_source: 1 send_packet_ros: false send_point_cloud_ros: false send_point_cloud_proto: false ``` -------------------------------- ### Compile and Run with ROS2 Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/README.md Compile the rslidar_sdk in a ROS2 workspace using colcon build. Ensure the rslidar_msg package is also present and your setup.bash is sourced. ```sh colcon build source install/setup.bash ros2 launch rslidar_sdk start.py ``` -------------------------------- ### Configure First LiDAR (RSM1) Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/intro/02_parameter_intro.md This snippet shows the configuration for the first LiDAR unit, an RSM1. It specifies driver parameters like ports, distance limits, and timestamping, along with ROS integration settings for topics and frame IDs. ```yaml common: msg_source: 1 send_packet_ros: false send_point_cloud_ros: true lidar: - driver: lidar_type: RSM1 # LiDAR type - RS16, RS32, RSBP, RSAIRY, RSHELIOS, RSHELIOS_16P, RS128, RS80, RS48, RSP128, RSP80, RSP48, # RSM1, RSM1_JUMBO, RSM2, RSM3, RSE1, RSMX, RSFAIRY, RSEMX. msop_port: 6699 # Msop port of lidar difop_port: 7788 # Difop port of lidar (Note that: For RSEMX, use the port num of DIFOP2 if both DIFOP1 & DIFOP2 exist. Default 7766.) imu_port: 0 # IMU port of lidar(only for RSAIRY, RSE1), 0 means no imu. # If you want to use IMU, please first set ENABLE_IMU_DATA_PARSE to ON in CMakeLists.txt user_layer_bytes: 0 # Bytes of user layer. thers is no user layer if it is 0 tail_layer_bytes: 0 # Bytes of tail layer. thers is no tail layer if it is 0 min_distance: 0.2 # Minimum distance of point cloud max_distance: 200 # Maximum distance of point cloud (Note that: 200 normally, 300 for RSEMX) use_lidar_clock: true # true--Use the lidar clock as the message timestamp # false-- Use the system clock as the timestamp dense_points: false # true: discard NAN points; false: reserve NAN points ts_first_point: true # true: time-stamp point cloud with the first point; false: with the last point; # these parameters are used from mechanical lidar start_angle: 0 # Start angle of point cloud end_angle: 360 # End angle of point cloud # When msg_source is 3, the following parameters will be used pcap_repeat: true # true: The pcap bag will repeat play pcap_rate: 1.0 # Rate to read the pcap file pcap_path: /home/robosense/lidar.pcap #The path of pcap file ros: ros_frame_id: rslidar #Frame id of packet message and point cloud message ros_recv_packet_topic: /left/rslidar_packets #Topic used to receive lidar packets from ROS ros_send_packet_topic: /left/rslidar_packets #Topic used to send lidar packets through ROS ros_send_imu_data_topic: /left/rslidar_imu_data #Topic used to send imu data through ROS ros_send_point_cloud_topic: /left/rslidar_points #Topic used to send point cloud through ROS ``` -------------------------------- ### Common Configuration Parameters Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/intro/02_parameter_intro.md Defines the source of LiDAR data and where to publish point clouds and packets. Ensure correct indentation when modifying. ```yaml common: msg_source: 1 send_packet_ros: false send_point_cloud_ros: false ``` -------------------------------- ### LiDAR Configuration Parameters Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/intro/02_parameter_intro.md This snippet shows the structure and common parameters for configuring a Robosense LiDAR. Adjust these settings based on your specific LiDAR model and requirements. ```yaml lidar: - driver: lidar_type: RSM1 # LiDAR type - RS16, RS32, RSBP, RSAIRY, RSHELIOS, RSHELIOS_16P, RS128, RS80, RS48, RSP128, RSP80, RSP48, # RSM1, RSM1_JUMBO, RSM2, RSM3, RSE1, RSMX, RSFAIRY, RSEMX. msop_port: 6699 # Msop port of lidar difop_port: 7788 # Difop port of lidar (Note that: For RSEMX, use the port num of DIFOP2 if both DIFOP1 & DIFOP2 exist. Default 7766.) imu_port: 0 # IMU port of lidar(only for RSAIRY, RSE1), 0 means no imu. # If you want to use IMU, please first set ENABLE_IMU_DATA_PARSE to ON in CMakeLists.txt user_layer_bytes: 0 # Bytes of user layer. thers is no user layer if it is 0 tail_layer_bytes: 0 # Bytes of tail layer. thers is no tail layer if it is 0 min_distance: 0.2 # Minimum distance of point cloud max_distance: 200 # Maximum distance of point cloud (Note that: 200 normally, 300 for RSEMX) use_lidar_clock: true # true--Use the lidar clock as the message timestamp # false-- Use the system clock as the timestamp dense_points: false # true: discard NAN points; false: reserve NAN points ts_first_point: true # true: time-stamp point cloud with the first point; false: with the last point; # these parameters are used from mechanical lidar start_angle: 0 # Start angle of point cloud end_angle: 360 # End angle of point cloud # When msg_source is 3, the following parameters will be used pcap_repeat: true # true: The pcap bag will repeat play pcap_rate: 1.0 # Rate to read the pcap file pcap_path: /home/robosense/lidar.pcap #The path of pcap file ros: ros_frame_id: rslidar #Frame id of packet message and point cloud message ros_recv_packet_topic: /rslidar_packets #Topic used to receive lidar packets from ROS ros_send_packet_topic: /rslidar_packets #Topic used to send lidar packets through ROS ros_send_imu_data_topic: /rslidar_imu_data #Topic used to send imu data through ROS ros_send_point_cloud_topic: /rslidar_points #Topic used to send point cloud through ROS ``` -------------------------------- ### Configure Packet Source for Replay Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/11_how_to_record_replay_packet_rosbag.md Set 'msg_source' to 2 to indicate that packets should be read from ROS. Ensure 'send_point_cloud_ros' is true if you want to publish reconstructed point clouds. ```yaml common: msg_source: 2 send_packet_ros: false send_point_cloud_ros: true ``` -------------------------------- ### Single Lidar Configuration for ROS Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/intro/02_parameter_intro.md This YAML configuration is used to set up a single Robosense LiDAR (RSM1) to send point cloud data to ROS. It specifies message sources, ROS integration options, and detailed driver parameters for the LiDAR. ```yaml common: msg_source: 1 # 0: not use Lidar # 1: packet message comes from online Lidar # 2: packet message comes from ROS or ROS2 # 3: packet message comes from Pcap file send_packet_ros: false # true: Send packets through ROS or ROS2(Used to record packet) send_point_cloud_ros: true # true: Send point cloud through ROS or ROS2 lidar: - driver: lidar_type: RSM1 # LiDAR type - RS16, RS32, RSBP, RSAIRY, RSHELIOS, RSHELIOS_16P, RS128, RS80, RS48, RSP128, RSP80, RSP48, # RSM1, RSM1_JUMBO, RSM2, RSM3, RSE1, RSMX, RSFAIRY, RSEMX. msop_port: 6699 # Msop port of lidar difop_port: 7788 # Difop port of lidar (Note that: For RSEMX, use the port num of DIFOP2 if both DIFOP1 & DIFOP2 exist. Default 7766.) imu_port: 0 # IMU port of lidar(only for RSAIRY, RSE1), 0 means no imu. # If you want to use IMU, please first set ENABLE_IMU_DATA_PARSE to ON in CMakeLists.txt user_layer_bytes: 0 # Bytes of user layer. thers is no user layer if it is 0 tail_layer_bytes: 0 # Bytes of tail layer. thers is no tail layer if it is 0 min_distance: 0.2 # Minimum distance of point cloud max_distance: 200 # Maximum distance of point cloud (Note that: 200 normally, 300 for RSEMX) use_lidar_clock: true # true--Use the lidar clock as the message timestamp # false-- Use the system clock as the timestamp dense_points: false # true: discard NAN points; false: reserve NAN points ts_first_point: true # true: time-stamp point cloud with the first point; false: with the last point; # these parameters are used from mechanical lidar start_angle: 0 # Start angle of point cloud end_angle: 360 # End angle of point cloud # When msg_source is 3, the following parameters will be used pcap_repeat: true # true: The pcap bag will repeat play pcap_rate: 1.0 # Rate to read the pcap file pcap_path: /home/robosense/lidar.pcap #The path of pcap file ros: ros_frame_id: rslidar #Frame id of packet message and point cloud message ros_recv_packet_topic: /rslidar_packets #Topic used to receive lidar packets from ROS ros_send_packet_topic: /rslidar_packets #Topic used to send lidar packets through ROS ros_send_imu_data_topic: /rslidar_imu_data #Topic used to send imu data through ROS ros_send_point_cloud_topic: /rslidar_points #Topic used to send point cloud through ROS ``` -------------------------------- ### Multiple LiDARs - Different Remote IPs Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/07_online_lidar_advanced_topics.md Configure multiple LiDARs by assigning different host IP addresses to each driver instance, assuming the host has multiple NICs. ```yaml lidar: - driver: lidar_type: RSAIRY msop_port: 6699 difop_port: 7788 imu_port: 6688 host_address: 192.168.1.102 - driver: lidar_type: RSAIRY msop_port: 6699 difop_port: 7788 imu_port: 6688 host_address: 192.168.1.103 ``` -------------------------------- ### Multiple LiDARs - Different Remote Ports Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/07_online_lidar_advanced_topics.md Configure multiple LiDARs by assigning different MSOP, DIFOP, and IMU ports for each driver instance. ```yaml lidar: - driver: lidar_type: RSAIRY msop_port: 6699 difop_port: 7788 imu_port: 6688 - driver: lidar_type: RSAIRY msop_port: 6698 difop_port: 7789 imu_port: 6689 ``` -------------------------------- ### Configure Second LiDAR (RSE1) Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/intro/02_parameter_intro.md This snippet configures the second LiDAR unit, an RSE1. It mirrors the structure of the first LiDAR's configuration but uses different ROS topics to distinguish its data stream. Ensure the indentation of the 'lidar' part is correct. ```yaml - driver: lidar_type: RSE1 # LiDAR type - RS16, RS32, RSBP, RSAIRY, RSHELIOS, RSHELIOS_16P, RS128, RS80, RS48, RSP128, RSP80, RSP48, # RSM1, RSM1_JUMBO, RSM2, RSM3, RSE1, RSMX, RSFAIRY, RSEMX. msop_port: 6699 # Msop port of lidar difop_port: 7788 # Difop port of lidar (Note that: For RSEMX, use the port num of DIFOP2 if both DIFOP1 & DIFOP2 exist. Default 7766.) user_layer_bytes: 0 # Bytes of user layer. thers is no user layer if it is 0 tail_layer_bytes: 0 # Bytes of tail layer. thers is no tail layer if it is 0 min_distance: 0.2 # Minimum distance of point cloud max_distance: 200 # Maximum distance of point cloud use_lidar_clock: true # true--Use the lidar clock as the message timestamp # false-- Use the system clock as the timestamp dense_points: false # true: discard NAN points; false: reserve NAN points ts_first_point: true # true: time-stamp point cloud with the first point; false: with the last point; # these parameters are used from mechanical lidar start_angle: 0 # Start angle of point cloud end_angle: 360 # End angle of point cloud # When msg_source is 3, the following parameters will be used pcap_repeat: true # true: The pcap bag will repeat play pcap_rate: 1.0 # Rate to read the pcap file pcap_path: /home/robosense/lidar.pcap #The path of pcap file ros: ros_frame_id: rslidar #Frame id of packet message and point cloud message ros_recv_packet_topic: /right/rslidar_packets #Topic used to receive lidar packets from ROS ros_send_packet_topic: /right/rslidar_packets #Topic used to send lidar packets through ROS ``` -------------------------------- ### Compile with ENABLE_TRANSFORM ON Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/10_how_to_use_coordinate_transformation.md Enable coordinate transformation by setting the CMake option ENABLE_TRANSFORM to ON during compilation. ```bash cmake -DENABLE_TRANSFORM=ON .. ``` ```bash catkin_make -DENABLE_TRANSFORM=ON ``` ```bash colcon build --cmake-args '-DENABLE_TRANSFORM=ON' ``` -------------------------------- ### ROS Configuration for Point Cloud Output Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/08_how_to_decode_pcap_file.md Configure ROS-specific settings for publishing LiDAR data. Set the frame ID and topic names for receiving packets, sending packets, IMU data, and point clouds. ```yaml ros: ros_frame_id: rslidar ros_recv_packet_topic: /rslidar_packets ros_send_packet_topic: /rslidar_packets ros_send_imu_data_topic: /rslidar_imu_data ros_send_point_cloud_topic: /rslidar_points ``` -------------------------------- ### PointXYZIF Structure and ROS PointCloud2 Conversion Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/05_how_to_change_point_type.md Defines the PointXYZIF structure and illustrates its conversion to a ROS PointCloud2 message. Conditionally adds a 'feature' field based on defined types. ```c++ struct PointXYZIF { float x; float y; float z; uint8_t intensity; uint16_t ring; double timestamp; }; ``` ```c++ sensor_msgs::PointCloud2 ros_msg; int offset = 0; offset = addPointField(ros_msg, "x", 1, sensor_msgs::PointField::FLOAT32, offset); offset = addPointField(ros_msg, "y", 1, sensor_msgs::PointField::FLOAT32, offset); offset = addPointField(ros_msg, "z", 1, sensor_msgs::PointField::FLOAT32, offset); offset = addPointField(ros_msg, "intensity", 1, sensor_msgs::PointField::FLOAT32, offset); #if defined(POINT_TYPE_XYZIF) || defined(POINT_TYPE_XYZIRTF) offset = addPointField(ros_msg, "feature", 1, sensor_msgs::PointField::UINT8, offset); #endif // // copy points from point cloud of `PointXYZIF` to `PointCloud2` // ... ``` -------------------------------- ### Make Script Executable Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/13_how_to_solve_ROS2_humble_frame_rate_drop.md Grants execute permissions to the dds_mod.sh script, which is necessary before running it. ```bash chmod +x dds_mod.sh ``` -------------------------------- ### Multi-Lidar ROS Topic Configuration Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/intro/02_parameter_intro.md Assign ROS topics for IMU and point cloud data when using multiple LiDAR sensors. Ensure unique topic names for each sensor to avoid data conflicts. ```yaml ros_send_imu_data_topic: /right/rslidar_imu_data #Topic used to send imu data through ROS ros_send_point_cloud_topic: /right/rslidar_points #Topic used to send point cloud through ROS ``` -------------------------------- ### Define Executable and Link Libraries Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/CMakeLists.txt Defines the main executable for the ROS node and links necessary libraries including YAML-CPP and the rslidar driver libraries. ```cmake add_executable(rslidar_sdk_node node/rslidar_sdk_node.cpp src/manager/node_manager.cpp) target_link_libraries(rslidar_sdk_node ${YAML_CPP_LIBRARIES} ${rs_driver_LIBRARIES}) ``` -------------------------------- ### PointXYZI Structure and ROS PointCloud2 Conversion Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/05_how_to_change_point_type.md Defines the PointXYZI structure and demonstrates how it's converted to a ROS PointCloud2 message. Note that 'intensity' is converted to float for compatibility with most ROS applications. ```c++ struct PointXYZI { float x; float y; float z; uint8_t intensity; }; ``` ```c++ sensor_msgs::PointCloud2 ros_msg; int offset = 0; offset = addPointField(ros_msg, "x", 1, sensor_msgs::PointField::FLOAT32, offset); offset = addPointField(ros_msg, "y", 1, sensor_msgs::PointField::FLOAT32, offset); offset = addPointField(ros_msg, "z", 1, sensor_msgs::PointField::FLOAT32, offset); offset = addPointField(ros_msg, "intensity", 1, sensor_msgs::PointField::FLOAT32, offset); // // copy points from point cloud of `PointXYZI` to `PointCloud2` // ... ``` -------------------------------- ### Common Configuration for PCAP Decoding Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/08_how_to_decode_pcap_file.md Configure the common settings for processing PCAP files. Set 'msg_source' to 3 for PCAP input and 'send_point_cloud_ros' to true to publish point clouds to ROS. ```yaml common: msg_source: 3 send_packet_ros: false send_point_cloud_ros: true ``` -------------------------------- ### Set Coordinate Transformation Parameters in config.yaml Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/10_how_to_use_coordinate_transformation.md Configure the coordinate transformation by setting the x, y, z, roll, pitch, and yaw parameters within the 'lidar-driver' section of the config.yaml file. ```yaml common: msg_source: 1 send_packet_ros: false send_point_cloud_ros: true lidar: - driver: lidar_type: RSAIRY msop_port: 6699 difop_port: 7788 imu_port: 6688 start_angle: 0 end_angle: 360 min_distance: 0.2 max_distance: 200 use_lidar_clock: true pcap_path: /home/robosense/lidar.pcap x: 1 y: 0 z: 2.5 roll: 0.1 pitch: 0.2 yaw: 1.57 ``` -------------------------------- ### LiDAR Driver Configuration Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/06_how_to_decode_online_lidar.md Specify LiDAR type, port numbers, and angle/distance ranges. Ensure 'lidar_type' matches your device and ports are correctly set. ```yaml lidar: - driver: lidar_type: RS128 msop_port: 6699 difop_port: 7788 imu_port: 6688 start_angle: 0 end_angle: 360 min_distance: 0.2 max_distance: 200 use_lidar_clock: true ``` -------------------------------- ### PointXYZIRT Structure and ROS PointCloud2 Conversion Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/05_how_to_change_point_type.md Defines the PointXYZIRT structure and shows its transformation into a ROS PointCloud2 message. Includes 'ring' and 'timestamp' fields, conditionally added based on defined types. ```c++ struct PointXYZIRT { float x; float y; float z; uint8_t intensity; uint16_t ring; double timestamp; }; ``` ```c++ sensor_msgs::PointCloud2 ros_msg; int offset = 0; offset = addPointField(ros_msg, "x", 1, sensor_msgs::PointField::FLOAT32, offset); offset = addPointField(ros_msg, "y", 1, sensor_msgs::PointField::FLOAT32, offset); offset = addPointField(ros_msg, "z", 1, sensor_msgs::PointField::FLOAT32, offset); offset = addPointField(ros_msg, "intensity", 1, sensor_msgs::PointField::FLOAT32, offset); #if defined(POINT_TYPE_XYZIRT) || defined(POINT_TYPE_XYZIRTF) offset = addPointField(ros_msg, "ring", 1, sensor_msgs::PointField::UINT16, offset); offset = addPointField(ros_msg, "timestamp", 1, sensor_msgs::PointField::FLOAT64, offset); #endif // // copy points from point cloud of `PointXYZIRT` to `PointCloud2` // ... ``` -------------------------------- ### Robosense LiDAR Driver Configuration Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/intro/03_hiding_parameters_intro.md YAML configuration for Robosense LiDAR driver settings. This includes sensor type, network ports, data processing options, and angle ranges. ```yaml lidar: - driver: lidar_type: RSM1 # LiDAR type - RS16, RS32, RSBP, RSAIRY, RSHELIOS, RSHELIOS_16P, RS128, RS80, RS48, RSP128, RSP80, RSP48, # RSM1, RSM1_JUMBO, RSM2, RSM3, RSE1, RSMX, RSFAIRY, RSEMX. msop_port: 6699 # Msop port of lidar difop_port: 7788 # Difop port of lidar (Note that: For RSEMX, use the port num of DIFOP2 if both DIFOP1 & DIFOP2 exist. Default 7766.) imu_port: 0 # IMU port of lidar(only for RSAIRY, RSE1), 0 means no imu. # If you want to use IMU, please first set ENABLE_IMU_DATA_PARSE to ON in CMakeLists.txt group_address: 0.0.0.0 host_address: 0.0.0.0 user_layer_bytes: 0 # Bytes of user layer. thers is no user layer if it is 0 tail_layer_bytes: 0 # Bytes of tail layer. thers is no tail layer if it is 0 min_distance: 0.2 # Minimum distance of point cloud max_distance: 200 # Maximum distance of point cloud (Note that: 200 normally, 300 for RSEMX) use_lidar_clock: true # true--Use the lidar clock as the message timestamp # false-- Use the system clock as the timestamp dense_points: false # true: discard NAN points; false: reserve NAN points ts_first_point: true # true: time-stamp point cloud with the first point; false: with the last point; # these parameters are used from mechanical lidar start_angle: 0 # Start angle of point cloud end_angle: 360 # End angle of point cloud # When msg_source is 3, the following parameters will be used pcap_repeat: true # true: The pcap bag will repeat play pcap_rate: 1.0 # Rate to read the pcap file pcap_path: /home/robosense/lidar.pcap #The path of pcap file use_vlan: false x: 0 y: 0 z: 0 roll: 0 pitch: 0 yaw: 0 ros: ros_frame_id: rslidar #Frame id of packet message and point cloud message ros_recv_packet_topic: /rslidar_packets #Topic used to receive lidar packets from ROS ros_send_packet_topic: /rslidar_packets #Topic used to send lidar packets through ROS ros_send_imu_data_topic: /rslidar_imu_data #Topic used to send imu data through ROS ros_send_point_cloud_topic: /rslidar_points #Topic used to send point cloud through ROS ros_send_by_rows: false ``` -------------------------------- ### Configure User and Tail Layer Stripping Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/07_online_lidar_advanced_topics.md Configure the RSLidar driver to strip user and tail layers by specifying their lengths in bytes. This is useful when custom data is added before or after the standard lidar packets. ```yaml lidar: - driver: lidar_type: RSAIRY msop_port: 6699 difop_port: 7788 imu_port: 6688 user_layer_bytes: 8 tail_layer_bytes: 4 ``` -------------------------------- ### Multicast Mode Configuration Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/07_online_lidar_advanced_topics.md Configure the LiDAR to send packets in multicast mode. The host machine joins the specified multicast group address. ```yaml lidar: - driver: lidar_type: RSAIRY msop_port: 6699 difop_port: 7788 imu_port: 6688 group_address: 224.1.1.1 host_address: 192.168.1.102 ``` -------------------------------- ### Broadcast Mode Configuration Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/07_online_lidar_advanced_topics.md Configure the LiDAR to send packets in broadcast mode. The host machine binds to the specified MSOP port. ```yaml common: msg_source: 1 send_point_cloud_ros: true lidar: - driver: lidar_type: RSAIRY msop_port: 6699 difop_port: 7788 imu_port: 6688 ros: ros_frame_id: rslidar ros_send_point_cloud_topic: /rslidar_points ``` -------------------------------- ### Configure Packet Sending to ROS Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/11_how_to_record_replay_packet_rosbag.md Set 'send_packet_ros' to true to enable sending MSOP/DIFOP packets to ROS. This is required for recording packets. ```yaml common: msg_source: 1 send_packet_ros: true send_point_cloud_ros: true ``` -------------------------------- ### Configure ROS Packet Topic Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/11_how_to_record_replay_packet_rosbag.md Set 'ros_send_packet_topic' to specify the topic where MSOP and DIFOP packets will be published. This topic is used for recording. ```yaml ros: ros_frame_id: rslidar ros_recv_packet_topic: /rslidar_packets ros_send_packet_topic: /rslidar_packets ros_send_imu_data_topic: /rslidar_imu_data ros_send_point_cloud_topic: /rslidar_points ``` -------------------------------- ### PointXYZIRTF Structure and ROS PointCloud2 Conversion Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/05_how_to_change_point_type.md Defines the PointXYZIRTF structure and shows its conversion to a ROS PointCloud2 message. This type includes 'ring', 'timestamp', and 'feature' fields, added conditionally. ```c++ struct PointXYZIRTF { float x; float y; float z; uint8_t intensity; uint16_t ring; double timestamp; }; ``` ```c++ sensor_msgs::PointCloud2 ros_msg; int offset = 0; offset = addPointField(ros_msg, "x", 1, sensor_msgs::PointField::FLOAT32, offset); offset = addPointField(ros_msg, "y", 1, sensor_msgs::PointField::FLOAT32, offset); offset = addPointField(ros_msg, "z", 1, sensor_msgs::PointField::FLOAT32, offset); offset = addPointField(ros_msg, "intensity", 1, sensor_msgs::PointField::FLOAT32, offset); #if defined(POINT_TYPE_XYZIRT) || defined(POINT_TYPE_XYZIRTF) offset = addPointField(ros_msg, "ring", 1, sensor_msgs::PointField::UINT16, offset); offset = addPointField(ros_msg, "timestamp", 1, sensor_msgs::PointField::FLOAT64, offset); #endif #if defined(POINT_TYPE_XYZIF) || defined(POINT_TYPE_XYZIRTF) offset = addPointField(ros_msg, "feature", 1, sensor_msgs::PointField::UINT8, offset); #endif // // copy points from point cloud of `PointXYZIRTF` to `PointCloud2` // ... ``` -------------------------------- ### PCAP Decoding with User and Tail Layers Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/09_pcap_file_advanced_topics.md Use this configuration when your PCAP file packets have extra user-defined layers before or after the standard MSOP/DIFOP packets. Specify the lengths of these layers in bytes using 'user_layer_bytes' and 'tail_layer_bytes'. ```yaml lidar: - driver: lidar_type: RSAIRY pcap_path: /home/robosense/lidar.pcap msop_port: 6699 difop_port: 7788 imu_port: 6688 user_layer_bytes: 8 tail_layer_bytes: 4 ``` -------------------------------- ### LiDAR Driver Configuration for PCAP Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/08_how_to_decode_pcap_file.md Configure the LiDAR driver settings for PCAP file processing. Specify the PCAP file path, LiDAR type, and network ports. Ensure 'pcap_path' points to your PCAP file. ```yaml lidar: - driver: lidar_type: RSAIRY msop_port: 6699 difop_port: 7788 imu_port: 6688 start_angle: 0 end_angle: 360 min_distance: 0.2 max_distance: 200 use_lidar_clock: true pcap_path: /home/robosense/lidar.pcap ``` -------------------------------- ### Record ROS Bag Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/11_how_to_record_replay_packet_rosbag.md Use the rosbag record command to save messages from the specified topic (e.g., /rslidar_packets) to a rosbag file. ```sh rosbag record /rslidar_packets -O bag ``` -------------------------------- ### Unicast Mode Configuration Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/07_online_lidar_advanced_topics.md Configure the LiDAR to send packets in unicast mode for reduced network load. The configuration is identical to broadcast mode in the YAML file. ```yaml lidar: - driver: lidar_type: RSAIRY msop_port: 6699 difop_port: 7788 imu_port: 6688 ``` -------------------------------- ### General PCAP Decoding Configuration Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/09_pcap_file_advanced_topics.md Use this configuration for decoding PCAP files in broadcast, multicast, or unicast modes, especially when multiple LiDars are present. Ensure the 'pcap_path' points to your LiDAR data file. ```yaml common: msg_source: 3 send_point_cloud_ros: true lidar: - driver: lidar_type: RSAIRY pcap_path: /home/robosense/lidar.pcap msop_port: 6699 difop_port: 7788 imu_port: 6688 ros: ros_frame_id: rslidar ros_send_point_cloud_topic: /rslidar_points ``` -------------------------------- ### Set Custom Point Type in CMakeLists.txt Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/05_how_to_change_point_type.md Modify the POINT_TYPE variable in your project's CMakeLists.txt to select the desired point cloud data structure. Remember to rebuild the project after making changes. ```cmake #======================================= # Custom Point Type (XYZI,XYZIRT, XYZIF, XYZIRTF) #======================================= set(POINT_TYPE XYZI) ``` -------------------------------- ### PCAP Decoding with VLAN Layer Stripping Source: https://github.com/robosense-lidar/rslidar_sdk/blob/main/doc/howto/09_pcap_file_advanced_topics.md Configure this when your PCAP file contains packets with a VLAN layer. Set 'use_vlan: true' to enable the driver to strip the VLAN layer during decoding. ```yaml lidar: - driver: lidar_type: RSAIRY pcap_path: /home/robosense/lidar.pcap msop_port: 6699 difop_port: 7788 imu_port: 6688 use_vlan: true ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.