Ask Your Question
0

Access AR.Drone camera with OpenCV while connected to ROS

asked 2016-10-12 11:48:46 -0500

pyro229 gravatar image

updated 2016-10-12 17:18:44 -0500

Mani gravatar image

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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-10-12 17:05:59 -0500

Mani gravatar image

updated 2016-10-13 12:15:00 -0500

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++)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-10-12 11:48:46 -0500

Seen: 663 times

Last updated: Oct 13 '16