Items with no label
3335 Discussions

Export rosbag content issues (frames drop or can't open with ROS API)

BMana
Novice
4,178 Views

Hi!

Since de 2.12.0 release of the SDK, their is a tool (rs-convert) which can export the PNG images and the PLYs.

But I got this issues : https://github.com/IntelRealSense/librealsense/issues/1919 problems in rs_convert · Issue # 1919 · IntelRealSense/librealsense · GitHub

"Even with small bag files (~150MB), it drops frames. I was unable to extract all frames from a bag with 427 color and 430 depth frames. The number of frames dropped varies in each execution instance."

So is there any way to get all the frames or may be another way (with ROS API) to get all of my images in my rosbag?

I also tried some exemple based on ROS API but I often got this error when it try to open my rosbag file I got this error :

[FATAL] [1529679163.359016032]: Character [ ] at element [32] is not valid in Graph Resource Name [/device_0/sensor_0/option/Enable Auto Exposure/value]. Valid characters are a-z, A-Z, 0-9, / and _.

Thanks in advance for your help!

0 Kudos
8 Replies
FChau1
Beginner
2,370 Views

No answer ? It looks to me like a bugg in the sdk. And it is a very blocking issue.

0 Kudos
idata
Employee
2,370 Views

Hello bapriste-mnh,

 

 

Thank you for your interest in the Intel RealSense Cameras.

 

 

We will report this issue to the RealSense SDK team.

 

We apologize for the inconvenience this may have caused.

 

 

Thank you in advance,

 

Eliza
idata
Employee
2,370 Views

Hello baptiste-mnh,

 

 

The RealSense team is aware of this bug and is working on it.

 

Unfortunately, we don't have a timeline yet for when it will be fixed. Please give us more details (how you created the ROS bag, which ROS example you are running, etc.) on how you got the second error when you tried to open the ROS bag so that we can reproduce your issue.

 

 

Thank you,

 

Eliza
0 Kudos
BMana
Novice
2,370 Views

Hi, I simply use the realsense viewer to create my rosbag and rs-convert to extract the content.

I also tried to export with this code :

import argparse

 

 

import pyrealsense2 as rs

 

import numpy as np

 

import cv2

 

import os

 

 

 

LOAD_BAG = True

 

SAVE_DEPTH = False

 

SAVE_RGB = False

 

SAVE_IRL = True

 

SAVE_IRR = False

 

 

 

def main():

 

if not os.path.exists(args.directory):

 

os.mkdir(args.directory)

 

if SAVE_DEPTH and not os.path.exists(args.directory+"/depth"):

 

os.mkdir(args.directory+"/depth")

 

if SAVE_RGB and not os.path.exists(args.directory+"/image"):

 

os.mkdir(args.directory+"/image")

 

if SAVE_IRL and not os.path.exists(args.directory+"/irl"):

 

os.mkdir(args.directory+"/irl")

 

if SAVE_IRR and not os.path.exists(args.directory+"/irr"):

 

os.mkdir(args.directory+"/irr")

 

try:

 

config = rs.config()

 

pipeline = rs.pipeline()

 

if LOAD_BAG:

 

rs.config.enable_device_from_file(config, args.input, False)

 

if SAVE_DEPTH:

 

config.enable_stream(rs.stream.depth, 1280, 720, rs.format.z16, 30)

 

if SAVE_RGB:

 

config.enable_stream(rs.stream.color, 1280, 720, rs.format.rgb8, 30)

 

if SAVE_IRL:

 

config.enable_stream(rs.stream.infrared, 1, 1280, 720, rs.format.y8, 30)

 

if SAVE_IRR:

 

config.enable_stream(rs.stream.infrared, 2, 1280, 720, rs.format.y8, 30)

 

pipeline.start(config)

 

i = 0

 

while True:

 

print("Saving frame:", i)

 

frames = pipeline.wait_for_frames()

 

if SAVE_DEPTH:

 

depth_frame = frames.get_depth_frame()

 

depth_image = np.asanyarray(depth_frame.get_data())

 

depth_image[np.where((depth_image > 3000))] = 0

 

cv2.imwrite(args.directory + "/depth/" + <span style="co...
0 Kudos
idata
Employee
2,370 Views

Hello @baptiste-mnh,

 

 

I see that you have responded in this thread: https://github.com/IntelRealSense/librealsense/issues/1919. It is not clear whether you have resolved your issue. There is an open bug with the RealSense team where the rs-convert tool drops frames from ros bags.

 

 

Regards,

 

Jesus G.

 

Intel Customer Support
0 Kudos
kinam1
Beginner
2,370 Views

Hi, I am having the same problem. How did you resolve this issues?

0 Kudos
kinam1
Beginner
2,370 Views

I have recorded video by using realsense-viewer.

When I am trying to use rs-convert to convert .bag to png by using this command: rs-convert -i some.bag -p some_dir/some_file_prefix -r some_another_dir/some_another_file_prefix

 

I am having this error:

 

RealSense error calling rs2_pipeline_start_with_config(pipe:0x85ae10, config:0x8080f0):

   Failed to resolve request. Request to enable_device_from_file("20190118_232647.bag") was invalid, Reason: Failed to create ros reader: Error opening file: 20190118_232647.bag

 

 

 

0 Kudos
ASriv7
New Contributor I
2,370 Views

MATLAB worked flawlessly for me:

0 Kudos
Reply