I put the code at https://github.com/diydrones/visual-followme on a rasberrypi which is connected to a APM ,and I start the mavproxy, do"module load droneapi.module.api",and typed "api start drone_script.py" ,and there is some error like below : " Exception in APIThread-0: No module named file_utils
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 325, in run
self.fn()
File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 605, in <lambda>
APIThread(self, lambda: execfile(args1, g), args1)
File "drone_script.py", line 8, in <module>
from file_utils import Logger
ImportError: No module named file_utils" I really can not find the reason.
You need to be a member of diydrones to add comments!
Replies
I'm also having similar problems when loading modules... it only give me error when I try to use one of my modules...
Did you solve it?
Yes,I solved it at last
how did you solve it?
The last problem faced is in the rasberrypi's command line I cannot start the frame flow, so I use the remote desktop of win7 to connect the rasp 's X window, and I use the command of Xwindow .and the frame captured by the camera pop up which indicated the red blob locked. I do not know what is your problem.
My problem is that if I have a module with functions it can never find it... in normal python it does not give me problems... but when doing it with droneapi, i always get this error:
STABILIZE> api start pix-goto.py
STABILIZE> Exception in APIThread-1: cannot import name vc Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/droneapi/module/api.py", line 321, in run self.fn() File "/usr/local/lib/python2.7/site-packages/droneapi/module/api.py", line 592, in APIThread(self, lambda: execfile(args[1], g), args[1]) File "pix-goto.py", line 18, in from modules.vehicle import vc
ImportError: cannot import name vc
STABILIZE>
My module is named vehicle.py and its inside a folder named modules, with its __init__.py
Maybe you can join the room https://gitter.im/diydrones/dronekit-python it is about dronkit-python
I have never seen pix-goto.py ,which package is it contains in, some mission like go to a specifed destination?
At first, The problem I faced is "@rmackay9 I put the code at https://github.com/diydrones/visual-followme on a rasberrypi which is connected to a APM ,and I start the mavproxy, do"module load droneapi.module.api",and typed api start drone_script.py ,and there is some error like below : " Exception in APIThread-0: No module named file_utils
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 325, in run
self.fn()
File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 605, in <lambda>
APIThread(self, lambda: execfile(args1, g), args1)
File "drone_script.py", line 8, in <module>
from file_utils import Logger
ImportError: No module named file_utils"
And someone told me to do this :"
you have to add the python scripts' path to the python execution path. A brutal way, is to insert these commands at the top of drone_script.py
import sys
import os
sys.path.insert(1, os.getcwd())
"
somebody told me to add "import sys
import os
sys.path.insert(1, os.getcwd())" on the top of the drone_script.py
and then the tips turns to be like below:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 325, in run
self.fn()
File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 605, in <lambda>
APIThread(self, lambda: execfile(args[1], g), args[1])
File "drone_script.py", line 11, in <module>
from polyphemus import process_stream
File "/home/visual-followme-master/visual-followme-master/src/polyphemus.py", line 6, in <module>
from red_blob_detection import RedBlobDetector
File "/home/visual-followme-master/visual-followme-master/src/red_blob_detection.py", line 6, in <module>
class RedBlobDetector:
File "/home/visual-followme-master/visual-followme-master/src/red_blob_detection.py", line 8, in RedBlobDetector
hist = hist.astype(np.float32, copy=False)
TypeError: astype() takes no keyword arguments
And now some tell me to update numpy,I tried,but no use
The reacent situation:
api start drone_script.py
STABILIZE> DroneScript - Visual-Follow Running
libv4l2: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl S_FMT
libv4l2: error setting pixformat: Device or resource busy
libv4l1: error setting pixformat: Device or resource busy
libv4l2: error setting pixformat: Device or resource busy
libv4l1: error setting pixformat: Device or resource busy
HIGHGUI ERROR: libv4l unable to ioctl VIDIOCSPICT
Exception in APIThread-28: No cameras found
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 325, in run
self.fn()
File "/usr/local/lib/python2.7/dist-packages/droneapi/module/api.py", line 605, in <lambda>
APIThread(self, lambda: execfile(args[1], g), args[1])
File "drone_script.py", line 47, in <module>
video_in = open_camera()
File "drone_script.py", line 38, in open_camera
raise Exception('No cameras found')
Exception: No cameras found