Coder Social home page Coder Social logo

rosbag2_to_pcd's Introduction

rosbag2_to_pcd

The rosbag2_to_pcd package provides functionality to convert point cloud data from a ROS 2 rosbag file to PCD (Point Cloud Data) files. For each point cloud message in the specified topic, the package creates an individual PCD file.

Alternative (much more capable) tool:

Installation

To install, follow the ROS 2 Humble Installation Guide and then execute:

mkdir -p ~/rosbag2pcd_ws/src
cd ~/rosbag2pcd_ws/src
git clone https://github.com/xmfcx/rosbag2_to_pcd.git
cd ~/rosbag2pcd_ws

sudo apt update
rosdep init
rosdep update
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO

colcon build --symlink-install  --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=1

Usage

Parameters

The node accepts the following parameters:

  • path_bag: The absolute path to the rosbag2 file that you want to convert.
    • Example: /home/mfc/bags/rosbag2_2023_08_15-18_42_55 which contains:
      • /home/mfc/bags/rosbag2_2023_08_15-18_42_55/metadata.yaml
      • /home/mfc/bags/rosbag2_2023_08_15-18_42_55/rosbag2_2023_08_15-18_42_55_0.mcap
  • topic_cloud: The topic that contains the point cloud data in the rosbag2 file.

By default, the parameters are sourced from the rosbag2_to_pcd.param.yaml file in the config directory. Modify this file's default values or provide your own parameter file as needed.

Running the Node

Execute the following commands:

source ~/rosbag2pcd_ws/install/setup.bash
ros2 launch rosbag2_to_pcd rosbag2_to_pcd.launch.xml

Once launched, the node will process the rosbag file specified by the path_bag parameter. It will generate a PCD file for each point cloud message, storing them in a directory named <rosbag-name>_pcds adjacent to the rosbag2 folder.

The resulting PCD files use the timestamp of the point cloud message for naming, e.g., 1610472435-452138256.pcd.

Tips

To visually check which point cloud corresponds to which timestamp:

  • Launch Rviz2 to view the point cloud.
  • In a separate terminal, run:
    • ros2 topic echo /your_point_cloud_topic --field header.stamp
  • Play your bag file.
  • Pause the bag file playing by pressing space key when needed.
  • Match the point cloud message's timestamp with the corresponding PCD file name.

rosbag2_to_pcd's People

Contributors

xmfcx avatar

Stargazers

 avatar Zehra avatar  avatar Jay Ding avatar Alexander Hilgart avatar Abhijeet Tripathy avatar Pedro Martins avatar

Watchers

 avatar

rosbag2_to_pcd's Issues

Failed to deserialize ROS message

Hi,

When I try this repo, I am getting this error,
I installed it successfully and checked ros2 doctor, there is no issue. Would you happen to have any idea?
Thank you.

Yaml file:


/**:
  ros__parameters:
    path_bag: /home/trc/Documents/rosbag2_2024_05_23-13_58_48
    topic_cloud: /ouster/lidar_packets
    

ros2 launch rosbag2_to_pcd rosbag2_to_pcd.launch.xml
[INFO] [launch]: All log files can be found below /home/trc/.ros/log/2024-05-24-09-38-53-630611-zhr-910521
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [rosbag2_to_pcd_node-1]: process started with pid [910522]
[rosbag2_to_pcd_node-1] [INFO] [1716568734.183302093] [rosbag2_to_pcd]: Starting rosbag2_to_pcd node...
[rosbag2_to_pcd_node-1] [INFO] [1716568734.247586534] [rosbag2_storage]: Opened database '/home/trc/Documents/rosbag2_2024_05_23-13_58_48/rosbag2_2024_05_23-13_58_48_0.db3' for READ_ONLY.
[rosbag2_to_pcd_node-1]
[rosbag2_to_pcd_node-1] >>> [rcutils|error_handling.c:108] rcutils_set_error_state()
[rosbag2_to_pcd_node-1] This error state is being overwritten:
[rosbag2_to_pcd_node-1]
[rosbag2_to_pcd_node-1] 'Handle's typesupport identifier (rosidl_typesupport_cpp) is not supported by this library, at ./src/type_support_dispatch.hpp:111'
[rosbag2_to_pcd_node-1]
[rosbag2_to_pcd_node-1] with this new error message:
[rosbag2_to_pcd_node-1]
[rosbag2_to_pcd_node-1] 'rmw_serialize: invalid data size, at ./src/rmw_node.cpp:1727'
[rosbag2_to_pcd_node-1]
[rosbag2_to_pcd_node-1] rcutils_reset_error() should be called after error handling to avoid this.
[rosbag2_to_pcd_node-1] <<<
[rosbag2_to_pcd_node-1] terminate called after throwing an instance of 'rclcpp::exceptions::RCLError'
[rosbag2_to_pcd_node-1] what(): Failed to deserialize ROS message.: rmw_serialize: invalid data size, at ./src/rmw_node.cpp:1727
[ERROR] [rosbag2_to_pcd_node-1]: process has died [pid 910522, exit code -6, cmd '/home/trc/rosbag2pcd_ws/install/rosbag2_to_pcd/lib/rosbag2_to_pcd/rosbag2_to_pcd_node --ros-args -r __node:=rosbag2_to_pcd --params-file /home/trc/rosbag2pcd_ws/install/rosbag2_to_pcd/share/rosbag2_to_pcd/config/rosbag2_to_pcd.param.yaml'].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.