Code Monkey home page Code Monkey logo

dataset2bag's Introduction

This package allows to convert non-ROS datasets containing images and other sensor data to a rosbag file. It uses a friendly and simple syntax to which most non-ROS datasets can be conformed, by simple scripting.

To see the available parameters use:

rosrun dataset2bag dataset2bag --help

Sensor Types

This package supports the following type of sensors:

  • Images (either mono or stereo camera) + calibration
  • Odometry
  • Imu
  • Laser
  • Groundtruth

Images

The converter expects a directory where images should be stored. Images are read in alphabetical order. A video file can also be specified instead of a directory, from which frames will be extracted.

For reading images, the corresponding timestamp of each image is expected. This is supplied in a file containing this data.

Single camera example:

dataset2bag --images=img --calib=calibration.txt --timestamps=timestamps.txt -o out.bag

Camera Calibration Syntax

The camera calibration contains the image size, all instrinsic (3x3 matric) and extrinsic (3x3 for rotation and 3x1 for translation) parameters of the camera, plus distortion coefficients (5x1). In the monocular case, the extrinsic parameters should be set to an identity rotation matrix and a zero translation vector.

Syntax:

WIDTH HEIGHT

K11 K12 K13
K21 K22 K23
K31 K32 K33

D1 D2 D3 D4 D5

R11 R12 R13
R21 R22 R33
R31 R32 R33

Tx Ty Tz

Timestamp File Syntax

This file should contain one line per timestamp with the following format:

[seconds] [nanoseconds]

Odometry

Odometry information is used to represent 2D poses of the robot. The data will be stored as a nav_msgs/Odometry message and also published as a TF transform (from /odom to /base_link frames).

Format:

[seconds] [nanoseconds] [x] [y] [angle]

Units are in metres and radians.

IMU

This file should contain linear acceleration (m/s^2), angular velocity (rad/s) and orientation (3x3 matrix).

Format:

[seconds] [nanoseconds] [Ax] [Ay] [Az] [Wx] [Wy] [Wz] [R1] ... [R9]

Ground-truth

This is used to store poses as geometry_msgs/PoseStamped or geometry_msgs/PoseWithCovarianceStamped. This is again in 2D.

Format without covariance:

[seconds] [nanoseconds] [x] [y] [theta]

With covariance:

[seconds] [nanoseconds] [x] [y] [theta] [Cxx] [Cxy] [Cxt] [Cyx] [Cyy] [Cyt] [Ctx] [Cty] [Ctt]

Laser

This file should first start with some parameters:

[angle_increment] [ray_count] [min_range] [max_range] [min_angle] [max_angle]

where angles are in degrees and distances in meters. ray_count refers to the number of rays contained in one laser scan sample.

Then, for each scan there should be a line as:

[seconds] [nanoseconds] [range_1] ... [range_N]

(where N equals ray_count).

dataset2bag's People

Contributors

protobits avatar taihup avatar tomifischer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dataset2bag's Issues

Some errors of laser scan part

Hi,

I meet some error when I use the code to generate rosbag format.

When I only use odometry and timestamps to generate the rosbag, the code can run successful. But when I add the laser data, the code print a error as below:

Parsing laser data...
   [                                                                                 ] 0.00%terminate called after throwing an instance of 'rosbag::BagException'
  what():  Tried to insert a message with time less than ros::TIME_MIN
Aborted (core dumped)

Is there something wrong with the format of the data in my laser section? My format is as follows(some parts of my laser data):

0.332325834416190 662 0 30 -110 110
0 0 5.932 5.9141 5.8948 5.8746 5.8541 5.8339 5.8149 5.7973 5.7815 5.7679 5.7564 5.7471 5.74 5.7351 5.7323 5.7315 5.7328 5.7359 5.7407 5.7471 5.7549 5.7639 5.7738 5.7843 5.7949 5.8054 5.8154 5.8245 5.8327 5.8397 5.8457 5.8508 5.855 5.8586 5.8618 5.8647 5.8676 5.8706 5.8739 5.8775 5.8817 5.8864 5.8919 5.8981 5.9053 5.9134 5.9226 5.9331 5.9448 5.9579 5.9727 5.9892 6.0077 6.0284 6.0516 6.0779 6.1077 6.1419 6.1818 6.2294 15.55 15.523 15.497 15.472 15.447

The first line is [angle_increment] [scan_count] [min_range] [max_range] [min_angle] [max_angle], angle is in degrees, the second line is the timestamps and ranges.

Can you help me @protobits? Thank you so much.

help me

can i get sample of calibration.txt file and timestamps.txt?
i cant solve the error "what(): You need to specify a timestamps file"

Size of rosbags created

Hi
Thank you for this package, it is quite convenient. I have a query regarding the size of the rosbags created with this package. The rosbags I create are approximately double the size of original image data. The stereo image data is approx. 80 GB while the rosbag ends up to be 134GB. The only chnage to the code (regarding images) I made is to to read grayscale images and use ros.encode 'mono8'. The data is at 40Hz.
On the other hand, while checking the rosbags provided online for Kitti, their sizes are exactly the same size as the orignal stereo data. Am I doing something wrong/extra?
I have no compression here.
The rosbag info is :

> path:        S01.bag
> version:     2.0
> duration:    11:36s (696s)
> start:       Mar 05 2019 13:59:25.00 (1551787165.00)
> end:         Mar 05 2019 14:11:01.82 (1551787861.82)
> size:        134.6 GB
> messages:    111840
> compression: none [55921/55921 chunks]
> types:       sensor_msgs/CameraInfo [c9a58c1b0b154e0e6da7578cb991d214]
>              sensor_msgs/Image      [060021388200f6f0f447d0fcd9c64743]
> topics:      /stereo/left/camera_info    27960 msgs    : sensor_msgs/CameraInfo
>              /stereo/left/image_rect     27960 msgs    : sensor_msgs/Image     
>              /stereo/right/camera_info   27960 msgs    : sensor_msgs/CameraInfo
>              /stereo/right/image_rect    27960 msgs    : sensor_msgs/Image
>              /groundtruth_pose    	 27960 msgs    : geometry_msgs/PoseStamped

The image raw information in rqt is like this:

header
	seq:  5660
	stamp
		secs:  1551787306
		nsecs:  59999942
	frame_id: camera_right
height:  1195
width:  2013
encoding: mono8
is_bigendian:  0
step:  2013
data: ����������� ����� !!#$%#%'%'$$()((**+-/0,&& !*)%(+...

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.