2

I am having an issue where by I am unable to connect to the AR Drone 2 camera when the drone is connected through ROS using the ardrone_autonomy ardrone.launch.

I think the issue is due to the fact that I am trying to access the drone camera through the IP address with OpenCV and Python while connected through ardrone_autonomy. Below is a code snippet of how I am accomplishing this.

video_capture = cv2.VideoCapture()

video_capture.open('tcp://192.168.1.1:5555')

vidWidth = video_capture.get(cv2.CAP_PROP_FRAME_WIDTH)

vidHeight = video_capture.get(cv2.CAP_PROP_FRAME_HEIGHT)

As you can see that I am using the IP address for the camera. This works perfectly when the drone is not connected through ROS which is essentially like a webcam.

My end goal is for tracking and navigation through the use of images received from the camera using OpenCV which means I will have to issue movement commands(cmd_vel) which requires a connection through ardrone_autonomy based on the images received and processed by OpenCV.

Is there anyway I can accomplish this by using the IP camera from the drone while connected to ROS?

Thanks for any help!

1 Answer 1

1

http://wiki.ros.org/video_stream_opencv can open a video stream from a HTTP/TCP URL:

<launch>  <!-- video stream from URL to ROS topic - see http://wiki.ros.org/video_stream_opencv  -->
   <include file="$(find video_stream_opencv)/launch/camera.launch" >        
        <arg name="camera_name" value="drone_webcam" /> <!-- node name and ros graph name -->        
        <arg name="video_stream_provider" value="http://192.168.1.227:8080/video?x.mjpeg" /> <!-- ?x.mjpeg see http://answers.opencv.org/question/13139/cvvideocapture-works-for-webcams-but-not-ip-cameras/ --> 
        <arg name="fps" value="10" /><!-- throttling the querying of frames to 10Hz -->        
        <arg name="frame_id" value="webcam" /> <!-- setting TF frame_id -->         
        <arg name="camera_info_url" value="file:///abc/xyz.yaml" /> <!-- camera info loading, take care as it needs the "file:///" at the start , e.g.:
        "file:///$(find your_camera_package)/config/your_camera.yaml" -->        
        <arg name="flip_horizontal" value="false" /> <!-- flip the image horizontally (mirror it) -->
        <arg name="flip_vertical" value="false" /> <!-- flip the image vertically -->        
        <arg name="visualize" value="true" /> <!-- visualize on an image_view window the stream generated -->
   </include>
</launch>

Note the /video?x.mjpeg at the end of the URL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.