我试图跟随GitHub让我的AR Drone自主飞行一段时间;但是,我设置了很多麻烦。
作为我之前问题的后续内容,我能够解决
import cv2
import libardrone.libardrone
我重新安装了opencv,我意识到文档不正确;应该是
import libardrone.ardrone
解决这两个问题让我能够尝试这里给出的track.py:https://github.com/JJLewis/ColorTracking-ARDrone2.0-Python。
即使我正确安装了ffmpeg,运行track.py也会出现以下错误。
WARNING:root:Connection to ardrone
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/track.py", line 180, in <module>
main()
File "/Library/Python/2.7/site-packages/track.py", line 19, in main
drone = libardrone.ARDrone(True, False)
File "/Library/Python/2.7/site-packages/libardrone/ardrone.py", line 108, in __init__
self.network_process = arnetwork.ARDroneNetworkProcess(com_pipe_other, is_ar_drone_2, self)
File "/Library/Python/2.7/site-packages/libardrone/arnetwork.py", line 51, in __init__
self.ar2video = ar2video.ARVideo2(self._drone, drone.debug)
File "/Library/Python/2.7/site-packages/libardrone/ar2video.py", line 37, in __init__
h264 = h264decoder.H264Decoder(self, drone.image_shape)
File "/Library/Python/2.7/site-packages/libardrone/h264decoder.py", line 82, in __init__
raise Exception("You need to install ffmpeg to be able to run ardrone")
Exception: You need to install ffmpeg to be able to run ardrone
>>> Exception in thread Thread-35:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/Library/Python/2.7/site-packages/libardrone/arnetwork.py", line 86, in run
video_socket, nav_socket, control_socket = _connect()
File "/Library/Python/2.7/site-packages/libardrone/arnetwork.py", line 75, in _connect
control_socket.connect(('192.168.1.1', ARDRONE_CONTROL_PORT))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
error: [Errno 60] Operation timed out
在我的Mac终端中输入FFMPEG会产生以下结果:这使我相信FFMPEG已正确安装;但它没有检测到或是什么。
ffmpeg version 3.3.4 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 8.1.0 (clang-802.0.42)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-vda
执行brew info opencv会显示对openCV的FFMPEG的检查,所以我不确定我是如何得到这部分代码的错误。
作为初学者,我很难解决这些问题。我的规范如下:Mac 10.12,Python 2.7.14和OpenCV 3.3.0_3。