Skip to content
 
 

Repository files navigation

gopro_ros2

This repository contains code for parsing GoPro telemetry metadata to obtain GoPro images with synchronized IMU measurements. The GoPro visual-inertial data can then be saved in ros2 bag or EuRoC format. Thus, effectively paving the way for visual-inertial odometry/SLAM for GoPro cameras.

This repository use gpmf-parser from GoPro to extract metadata and timing information from GoPro cameras.

Related Paper

If you find the code useful in your research, please cite our paper:

@inproceedings{joshi_gopro_icra_2022,
  author      = {Bharat Joshi and Marios Xanthidis and Sharmin Rahman and Ioannis Rekleitis},
  title       = {High Definition, Inexpensive, Underwater Mapping},
  booktitle   = {IEEE International Conference on Robotics and Automation (ICRA)},
  year        = {2022},
  pages       = {1113-1121},
  doi         = {10.1109/ICRA46639.2022.9811695},
  abbr        = {ICRA},
  bibtex_show = {true},
  code        = {https://github.com/AutonomousFieldRoboticsLab/gopro_ros},
}

Installation

Tested on Ubuntu 24.04 (ROS2-Jazzy).

Prerequisites

Building from source requires the FFmpeg development headers in addition to the ffmpeg executable.

Install Dependencies

# First update package list
sudo apt-get update

# ROS 2 dependencies
sudo apt-get install -y \
    ros-$ROS_DISTRO-ament-cmake \
    ros-$ROS_DISTRO-rclcpp \
    ros-$ROS_DISTRO-std-msgs \
    ros-$ROS_DISTRO-geometry-msgs \
    ros-$ROS_DISTRO-sensor-msgs \
    ros-$ROS_DISTRO-cv-bridge \
    ros-$ROS_DISTRO-rosbag2-cpp \
    ros-$ROS_DISTRO-rosbag2-storage-default-plugins \
    ros-$ROS_DISTRO-ros2launch

# System libraries and development headers
sudo apt-get install -y \
    libeigen3-dev \
    libopencv-dev \
    libavcodec-dev \
    libavdevice-dev \
    libavfilter-dev \
    libavformat-dev \
    libavutil-dev \
    libpostproc-dev \
    libswresample-dev \
    libswscale-dev \
    ffmpeg

Install gopro_ros2

Before proceeding, ensure all dependencies are installed. To install gopro_ros2 (currently save to bag file only):

mkdir -p ~/gopro_ros2_ws/src
cd gopro_ros2_ws/src
git clone https://github.com/AutonomousFieldRoboticsLab/gopro_ros2.git
cd ~/gopro_ros2_ws
colcon build --packages-select gopro_ros2 --symlink-install --cmake-args -DBUILD_GOPRO_TO_ASL=OFF
source ~/gopro_ros2_ws/install/setup.bash # Or add this to ~/.bashrc to make it permanent

Usage

GoPro splits video into smaller chunks. By splitting up the video it reduces the chance of you losing all your footage if the file gets corrupted somehow. It’s called chaptering, and the idea is that if one chapter gets corrupted the others should still be okay because they’re separate files.

Save to ROS2 bag

Both MCAP and SQLite3 storage backends are supported. The rosbag argument is the output bag directory, not an output filename. Select the backend explicitly with storage_id:=.mcap (the default) or storage_id:=.db3.

For example, write an MCAP bag with the default fast Zstandard compression:

ros2 launch gopro_ros2 gopro_to_rosbag.xml \
    gopro_video:=/path/to/GX010001.MP4 \
    rosbag:=/path/to/output/gopro_run \
    storage_id:=.mcap \
    mcap_compression:=zstd_fast

This creates the rosbag2 directory gopro_run/, containing metadata.yaml and the generated .mcap storage file.

The supported MCAP compression profiles are zstd_fast (default), zstd_small, and none. To write a SQLite3 bag instead:

ros2 launch gopro_ros2 gopro_to_rosbag.xml \
    gopro_video:=/path/to/GX010001.MP4 \
    rosbag:=/path/to/output/gopro_run \
    storage_id:=.db3

If you have multiple files from a single session, put all videos in same folder you can use the following command to concatenate into a single rosbag:

ros2 launch gopro_ros2 gopro_to_rosbag.xml \
    gopro_folder:=/path/to/gopro_video_files \
    multiple_files:=true \
    rosbag:=/path/to/output/gopro_run \
    storage_id:=.mcap

Save to EuRoC format

To save GoPro video with IMU measurements in Euroc format:

ros2 launch gopro_ros2 gopro_to_asl.xml gopro_video:=<gopro_video_file> asl_dir:=<asl_format_dir>

If you have multiple files from a single session, put all videos in same folder you can use the following command extract all videos in a single folder:

ros2 launch gopro_ros2 gopro_to_asl.xml gopro_folder:=<folder_with_gopro_video_files> multiple_files:=true asl_dir:=<asl_format_dir>

TODO

Enable save into EuRoC format.

About

Extacting synchronized Images and IMU data from GoPro Video for VIO (ROS2 Version)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages