0
$\begingroup$

Rosanswers logo

Hi,

I am having an issue where by I am unable to connect to the AR Drone 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!


Originally posted by pyro229 on ROS Answers with karma: 3 on 2016-10-12

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

If your ultimate goal is to use ROS and ardrone_autonomy to control the drone, I suggest that you capture the images through the ROS API as well (e.g. subscribe to the camera topic in your node), then use the cv_bridge package to convert the ROS image data type (sensor_msgs::Image) to cv::Mat. The following tutorial shows how to perform that in C++: Converting between ROS images and OpenCV images (C++)


Originally posted by Mani with karma: 1704 on 2016-10-12

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

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