pal-robotics / realsense_gazebo_plugin

157 stars 134 forks source link

Can not subscribe to camera topics via Python/Cpp Node #47

Open bi3ri opened 2 years ago

bi3ri commented 2 years ago

Hey,

I am not able to subscribe to the camera topics via C++/Python nodes. Visualization in Rviz and RQT works though.

I wrote a small demo program:

import rospy
from sensor_msgs.msg import Image as msg_Image

def callback(data):
    print("hello")

def listener():
    rospy.init_node('listener')
    depth_image_topic = 'camera/color/image_raw'
    sub = rospy.Subscriber(depth_image_topic, msg_Image, callback)

    rospy.spin()

if __name__ == '__main__':
    listener()

And although I can see a video stream for the topic camera/color/image_raw in RVIZ and RQT, the callback function is never called, so "hello" is never printed.

If I use the Kinect plugin everything is fine and the callback function is called and "hello" is printed many times.

Did someone had the same problem or a hint, where I could take a look?

Cheers, Johannes