can't subscribe or publish messages without bebop_autonomy driver running
Hey guys, I am new to ROS and I encountered problems in subscribing and publishing messages into topics. I try to subscribe and publishing them to Parrot Bebop2 drone.
I face this problem in different code files I try to execute, one simple example:
#! /usr/bin/python
# Copyright (c) 2015, Rethink Robotics, Inc.
# Using this CvBridge Tutorial for converting
# ROS images to OpenCV2 images
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import cv2
bridge = CvBridge()
def image_callback(msg):
print("Received an image!")
try:
cv2_img = bridge.imgmsg_to_cv2(msg, "bgr8")
except CvBridgeError, e:
print(e)
else:
cv2.imwrite('camera_image.jpeg', cv2_img)
def main():
rospy.init_node('image_listener')
image_topic = "/bebop/image_raw"
rospy.Subscriber(image_topic, Image, image_callback)
rospy.spin()
if __name__ == '__main__':
main()
However, when I execute this code while I run the bebopautonomy driver nodelet, this code runs fine. I can see in the rqtgraph that when I run the driver nodelet there is a subscription, and otherwise the node "Image_listener" stands alone. So I guess the problem is related to the connection to the bebop2.
To mention, I use ROS Kinetic and I run Ubuntu 16.04 OS.
What am I missing? :(
and thx in advance, Oren
Asked by Oren on 2020-04-17 06:16:35 UTC
Comments