Bag file to run the image stream from ARDRONE - rostopic suggestion needed

南楼画角 提交于 2020-01-03 04:38:12

问题


I am new to ROS. I am working on a video feed from ARDRONE but I am not able to stream the video.

Should I have to change the topics in publisher and subscriber to stream the video ???

It is mentioned that I have to use bag file to stream.

My publisher and subscriber nodes are the following :

 def __init__(self):
     self.image_pub = rospy.Publisher("image_topic_2",Image,queue_size=10)

     self.bridge = CvBridge()
     self.image_sub = rospy.Subscriber("image_topic",Image,self.callback)

 def callback(self,data):
     try:
       cv_image = self.bridge.imgmsg_to_cv2(data, "bgr8")
     except CvBridgeError as e:
       print(e)

     (rows,cols,channels) = cv_image.shape
     if cols > 60 and rows > 60 :
        cv2.circle(cv_image, (50,50), 10, 255)

     cv2.imshow("Image window", cv_image)
     cv2.waitKey(3)

     try:
        self.image_pub.publish(self.bridge.cv2_to_imgmsg(cv_image, "bgr8"))
     except CvBridgeError as e:
         print(e)

can someone explain how does that exactly works ?

rostopic hz /ardrone/image_raw output is :

 rostopic hz /ardrone/image_raw
   subscribed to [/ardrone/image_raw]
   average rate: 31.109
      min: 0.011s max: 0.051s std dev: 0.00873s window: 31
   average rate: 31.077
      min: 0.011s max: 0.059s std dev: 0.00947s window: 62
   average rate: 30.875
      min: 0.011s max: 0.061s std dev: 0.00909s window: 92
   average rate: 30.508

rosgraph :

/ardrone/image_raw/compressedDepth/set_parameters
  /ardrone_driver/set_logger_level
  /ardrone/front/image_raw/compressedDepth/set_parameters
  /ardrone/setledanimation
  /ardrone/image_raw/theora/set_parameters
  /image_converter_3034_1485929043890/set_logger_level
  /ardrone/front/image_raw/compressed/set_parameters
  /ardrone/front/set_camera_info
  /ardrone/setflightanimation
  /ardrone/setrecord
  /image_converter_3034_1485929043890/get_loggers
  /rosout/set_logger_level
  /ardrone/image_raw/compressed/set_parameters
  /ardrone_driver/get_loggers
  /ardrone/togglecam
  /ardrone/flattrim
  /ardrone/bottom/image_raw/theora/set_parameters
  /ardrone/bottom/set_camera_info
  /ardrone/bottom/image_raw/compressed/set_parameters
  /ardrone/bottom/image_raw/compressedDepth/set_parameters
  /rosout/get_loggers
  /ardrone/setcamchannel
  /ardrone/front/image_raw/theora/set_parameters

来源:https://stackoverflow.com/questions/41972143/bag-file-to-run-the-image-stream-from-ardrone-rostopic-suggestion-needed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!