ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

mun's profile - activity

2022-11-23 17:49:27 -0500 received badge  Famous Question (source)
2021-03-03 11:34:52 -0500 received badge  Notable Question (source)
2021-03-03 11:34:52 -0500 received badge  Famous Question (source)
2020-11-29 09:13:15 -0500 received badge  Famous Question (source)
2020-07-20 09:37:11 -0500 received badge  Famous Question (source)
2020-07-01 14:52:58 -0500 received badge  Notable Question (source)
2020-07-01 14:52:58 -0500 received badge  Famous Question (source)
2020-05-27 01:52:34 -0500 received badge  Notable Question (source)
2020-05-27 01:52:34 -0500 received badge  Famous Question (source)
2020-05-06 07:30:12 -0500 received badge  Famous Question (source)
2020-05-06 07:30:12 -0500 received badge  Popular Question (source)
2020-05-06 07:30:12 -0500 received badge  Notable Question (source)
2020-04-13 16:19:25 -0500 received badge  Popular Question (source)
2020-04-13 16:19:25 -0500 received badge  Notable Question (source)
2020-04-13 16:19:25 -0500 received badge  Famous Question (source)
2020-01-29 06:04:49 -0500 received badge  Notable Question (source)
2020-01-29 06:04:49 -0500 received badge  Famous Question (source)
2020-01-15 09:47:12 -0500 received badge  Famous Question (source)
2019-12-09 21:34:21 -0500 received badge  Famous Question (source)
2019-12-03 09:34:49 -0500 received badge  Popular Question (source)
2019-11-21 10:17:47 -0500 received badge  Famous Question (source)
2019-11-18 10:49:10 -0500 received badge  Famous Question (source)
2019-10-23 15:58:21 -0500 received badge  Famous Question (source)
2019-10-04 09:17:50 -0500 received badge  Notable Question (source)
2019-10-04 04:11:47 -0500 received badge  Notable Question (source)
2019-09-23 01:48:37 -0500 received badge  Popular Question (source)
2019-09-22 09:22:52 -0500 commented answer How are nodes run?

The node is meant to be run using, e.g., roslaunch orb_slam2_ros orb_slam2_r200_rgbd.launch, but orb_slam2_r200_rgbd.lau

2019-09-22 08:47:05 -0500 edited question How are nodes run?

How are nodes run? Hi I'm looking at some ROS code from here which is part of a SLAM package. I wonder how the function

2019-09-22 08:47:04 -0500 edited question How are nodes run?

How do nodes work? Hi I'm looking at some ROS code from here which is part of a SLAM package. I wonder how the function

2019-09-22 08:46:17 -0500 asked a question How are nodes run?

How do nodes work? Hi I'm looking at some ROS code from here which is part of a SLAM package. I wonder how the function

2019-09-22 04:28:59 -0500 received badge  Popular Question (source)
2019-09-20 07:16:22 -0500 received badge  Popular Question (source)
2019-09-20 02:52:15 -0500 received badge  Notable Question (source)
2019-09-19 08:53:29 -0500 received badge  Notable Question (source)
2019-09-17 11:28:27 -0500 edited question cv_bridge.imgmsg_to_cv2 returns nan's

cv_bridge.imgmsg_to_cv2 returns nan's Hi I'm trying to get depth information by converting image messages to cv2 images

2019-09-17 11:28:13 -0500 edited question cv_bridge.imgmsg_to_cv2 returns nan's

cv_bridge.imgmsg_to_cv2 returns nan's Hi I'm trying to get depth information by converting image messages to cv2 images

2019-09-17 11:17:08 -0500 edited question cv_bridge.imgmsg_to_cv2 returns nan's

cv_bridge.imgmsg_to_cv2 returns nan Hi I'm trying to get depth information by converting image messages to cv2 images u

2019-09-17 11:17:07 -0500 edited question cv_bridge.imgmsg_to_cv2 returns nan's

cv_bridge.imgmsg_to_cv2 returns nan Hi I'm trying to get depth information by converting image messages to cv2 images u

2019-09-17 11:15:54 -0500 edited question cv_bridge.imgmsg_to_cv2 returns nan's

cv_bridge.imgmsg_to_cv2 returns nan Hi I'm trying to get depth information by converting image messages to cv2 images u

2019-09-17 10:49:41 -0500 edited question cv_bridge.imgmsg_to_cv2 returns nan's

cv_bridge.imgmsg_to_cv2 returns nan Hi I'm trying to get depth information by converting image messages to cv2 images u

2019-09-17 09:39:15 -0500 edited question cv_bridge.imgmsg_to_cv2 returns nan's

cv_bridge.imgmsg_to_cv2 returns nan Hi I'm trying to convert image messages to cv2 images using cv_bridge.imgmsg_to_cv2

2019-09-17 09:25:09 -0500 edited question cv_bridge.imgmsg_to_cv2 returns nan's

cv_bridge.imgmsg_to_cv2 returns nan Hi I'm trying to convert image messages to cv2 images using cv_bridge.imgmsg_to_cv2

2019-09-17 09:13:55 -0500 edited question cv_bridge.imgmsg_to_cv2 returns nan's

cv_bridge.imgmsg_to_cv2 returns nan Hi I'm trying to convert image messages to cv2 images using cv_bridge.imgmsg_to_cv2

2019-09-17 09:03:54 -0500 edited question cv_bridge.imgmsg_to_cv2 returns nan's

cv_bridge.imgmsg_to_cv2 returns nan Hi I'm trying to convert image messages to cv2 images using cv_bridge.imgmsg_to_cv2

2019-09-17 08:57:26 -0500 edited question cv_bridge.imgmsg_to_cv2 returns nan's

cv_bridge.imgmsg_to_cv2 returns nan Hi I'm trying to convert image messages to cv2 images using cv_bridge.imgmsg_to_cv2

2019-09-17 08:56:49 -0500 asked a question cv_bridge.imgmsg_to_cv2 returns nan's

cv_bridge.imgmsg_to_cv2 returns nan Hi I'm trying to convert image messages to cv2 images using cv_bridge.imgmsg_to_cv2

2019-09-17 03:12:57 -0500 commented answer rosbag Python API not reading messages

Interesting. But aren't global (absolute) names/paths usually easier to identify?

2019-09-17 03:04:02 -0500 marked best answer rosbag Python API not reading messages

Hi

I'm trying to read several topics using the rosbag Python API. However, I'm getting no message back at all. I can call rosbag.get_start_time() and rosbag.get_end_time(), and they give the correct values. Here's my code:

from __future__ import print_function
import rosbag
import tf2_ros
import genpy
import os


class RGBDTester:
    def __init__(self):
        # input/output paths
        bag_file_path = 'test2.bag'

        # image topics with CompressedImage
        self.topic_rgb = '/camera/rgb/image_raw'
        self.topic_depth = '/camera/depth_registered/image_raw'
        # camera intrinsics with CameraInfo
        self.topic_ci = '/camera/rgb/camera_info'

        self.topics_tf = ["/tf", "/tf_static"]

        self.topics = [self.topic_rgb, self.topic_depth, self.topic_ci]

        bag_file_path = os.path.expanduser(bag_file_path)
        print("reading:", bag_file_path)
        self.bag = rosbag.Bag(bag_file_path, mode='r')
        print("duration:", self.bag.get_end_time()-self.bag.get_start_time(),"s")

        ref_times = []

        # fill the tf buffer
        # maximum duration to cache all transformations
        # https://github.com/ros/geometry2/issues/356
        time_max = genpy.Duration(secs=pow(2, 31) - 1)
        tf_buffer = tf2_ros.Buffer(cache_time=time_max)

        for topic, msg, t in self.bag.read_messages(topics=self.topics_tf):
            for transf in msg.transforms:
                tf_buffer.set_transform(transf, "tester")

        topic_times = dict()
        for t in self.topics:
            topic_times[t] = []
        full_jnt_values = dict() # store first (oldest) joint values of complete set
        for topic, msg, t in self.bag.read_messages(topics=self.topics):            
            topic_times[topic].append(msg.header.stamp)


        if len(topic_times[self.topic_rgb])==0:
            print("NO colour images. Check that topic '"+self.topic_rgb+"' is present in bag file!")
        if len(topic_times[self.topic_depth]) == 0:
            print("NO depth images. Check that topic '"+self.topic_depth+"' is present in bag file!")

        # remove topics with no messages
        [topic_times.pop(top, None) for top in topic_times.keys() if len(topic_times[top]) == 0]

        if not topic_times:
            bag_topics = self.bag.get_type_and_topic_info().topics
            print("Found no messages on any of the given topics.")
            print("Valid topics are:", bag_topics.keys())
            print("Given topics are:", self.topics)


        camera_info = None
        for topic, msg, t in self.bag.read_messages(topics=[self.topic_ci]):
            camera_info = msg

        if camera_info is None:
            raise Exception("No CameraInfo message received!")


    def __del__(self):
        # close log file
        if hasattr(self, 'bag'):
            self.bag.close()


if __name__ == '__main__':
    RGBDTester()

The output I get is the following:

reading: test2.bag
duration: 4.97503685951 s
NO colour images. Check that topic '/camera/rgb/image_raw' is present in bag file!
NO depth images. Check that topic '/camera/depth_registered/image_raw' is present in bag file!
Found no messages on any of the given topics.
Valid topics are: ['camera/depth_registered/camera_info', 'camera/rgb/image_raw', 'camera/depth_registered/image_raw', 'tf_static', 'camera/rgb/camera_info']
Given topics are: ['/camera/rgb/image_raw', '/camera/depth_registered/image_raw', '/camera/rgb/camera_info']
Traceback (most recent call last):
  File "/home/mwell/catkin_ws/src/rgbd_export/src/test.py", line 81, in <module>
    RGBDTester()
  File "/home/mwell/catkin_ws/src/rgbd_export/src/test.py", line 71, in __init__
    raise Exception("No CameraInfo message received!")
Exception: No CameraInfo message received!

As you can see, no message is received at all. Here's the rosbag file. Anyone know why this is happening?

Thanks