Skip to content

mjlee111/laser_scan_merger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laser Scan Merger ROS Package

Overview

The laser_scan_merger package allows you to merge multiple LaserScan messages from different LiDAR sensors into a single LaserScan or PointCloud message. This is useful for applications where data from multiple sensors need to be aggregated for use in mapping, navigation, or object detection.

Features

  • Merges multiple sensor_msgs/LaserScan topics into one.
  • Converts merged sensor_msgs/LaserScan into sensor_msgs/PointCloud (optional).
  • Configurable through a YAML configuration file.
  • Supports transformation of LiDAR frames using a 6DOF transformation (translation + rotation).

Prerequisites

ROS (Robot Operating System)

Ensure that you have a working ROS installation. You can install ROS by following the instructions at: ROS Installation Guide

YAML-cpp

This package depends on yaml-cpp for parsing the configuration files in YAML format.

To install yaml-cpp:

$ sudo apt-get install libyaml-cpp-dev

PCL (Point Cloud Library)

If you wish to use the PointCloud merging feature, the package requires the Point Cloud Library (PCL).

To install PCL:

$ sudo apt-get install libpcl-dev

Installation

  1. Clone the repository into your catkin workspace:
    $ cd ~/catkin_ws/src
    $ git clone https://github.com/mjlee111/laser_scan_merger.git
  2. Install dependencies using rosdep:
    $ rosdep install --from-paths src --ignore-src -r -y
  3. Build the workspace:
    $ cd ~/catkin_ws
    $ catkin_make
  4. Source your workspace:
    $ source devel/setup.bash

Usage

Default Config file with rosrun

You can start the laser_scan_merger node using the following command:

$ rosrun laser_scan_merger laser_scan_merger_node

Ensure that you have configured the config/laser_config.yaml file to define the topics, frames, and transformations for each of your LiDAR sensors.

Other Config file with roslaunch

You can start the laser_scan_merger node with other config files using the following command:

$ roslaunch laser_scan_merger laser_scan_merger.launch config_file_path:=${CONFIG_FILE_PATH}

Example Configuration (YAML)

merger:
  mergeFrameID: "/base_link"
  mergeLaserScanTopic: "/laserscan/merged"
  mergeLaserScanNum: 2
  mergeTimeout: 0.2
  publishPointCloud: true
  pointCloudTopic: "/laserscan/merged/points"

lidar1:
  laserScanTopic: "/laserscan1"
  laserScanframeID: "/laserscan1"
  tf: "1.0 0.0 0.2 0.0 0.0 0.0"

lidar2:
  laserScanTopic: "/laserscan2"
  laserScanframeID: "/laserscan2"
  tf: "2.0 0.0 0.2 0.0 0.0 0.0"

YAML Configuration Table

Parameter Type Description Example Value
merger.mergeFrameID string The frame ID for the merged output. "/base_link"
merger.mergeLaserScanTopic string The topic name where the merged LaserScan data will be published. "/laserscan/merged"
merger.mergeLaserScanNum int The number of LaserScan topics to merge. 2
merger.mergeTimeout float Timeout for merging LaserScan [s] 0.2
merger.publishPointCloud bool A flag to enable or disable PointCloud publishing. true
merger.pointCloudTopic string The topic name where the merged PointCloud data will be published. This is required if PointCloud is enabled. "/laserscan/merged/points"
lidarX.laserScanTopic string The ROS topic name for the LaserScan data from LiDAR sensor X. "/laserscan1"
lidarX.laserScanframeID string The frame ID for the LaserScan data from LiDAR sensor X. "/laserscan1"
lidarX.tf string A space-separated string of 6 float values representing the translation (x, y, z) and rotation (r, p, y) of the LiDAR sensor X. "1.0 0.0 0.2 0.0 0.0 0.0"

Example Configuration (Launch)

<launch>
    <!-- Define the config_file_path argument -->
    <arg name="config_file_path" default="$(find laser_scan_merger)/config/laser_config.yaml" />
  
    <node name="laser_scan_merger" pkg="laser_scan_merger" type="laser_scan_merger_node" output="screen">
      <param name="config_file_path" value="$(arg config_file_path)" />
    </node>
  </launch>
  

Configuration

The package is configured using a YAML file that specifies the number of LiDAR sensors, their topics, and their respective transformation frames.

Make sure that your configuration file follows the structure in the example above, and define all the necessary LiDAR sensors.

Troubleshooting

If you encounter any issues, ensure that the laser_config.yaml file is correctly formatted and contains all the required fields. Also, verify that the LiDAR topics are publishing correctly.

Contributing

Feel free to submit issues, feature requests, and pull requests to improve the package.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For any questions or feedback, please contact menggu1234@naver.com.

Releases

No releases published

Packages

No packages published