3drobotics / solo-cli

Solo command line utilities.
20 stars 36 forks source link

Solo Script Run Issue #56

Open ReedsHorton opened 6 years ago

ReedsHorton commented 6 years ago

Hi all, I am trying to run my Solo 3DR via the SOLO CLI tool and having some issues. When I try to run scripts from the dronekit-python/examples directory I get ImportErrors. Sorry for the block of text below but I'm hoping the more information the better. I am running Mac OSX 13.6. This is my first time using dronekit so perhaps I am simply doing something wrong. If I am inside the /simple_goto directory and run solo script run simple_goto.py I get the following output:

Reeds-MacBook-Pro:simple_goto ReedHorton$ solo script run simple_goto.py
connecting to solo...
checking pip...
uploading script bundle...
./
./requirements.txt
./wheelhouse/
./wheelhouse/monotonic-1.5-py2.py3-none-any.whl
./wheelhouse/nose-1.3.7-py2-none-any.whl
./wheelhouse/mock-2.0.0-py2.py3-none-any.whl
./simple_goto.py
Not deleting env/bin
New python executable in env/bin/python
Installing setuptools, pip, wheel...done.
cp: can't stat '/usr/lib/python2.7/site-packages/greenlet*': No such file or directory
Ignoring indexes: https://pypi.python.org/simple
Processing ./wheelhouse/mock-2.0.0-py2.py3-none-any.whl
Processing ./wheelhouse/monotonic-1.5-py2.py3-none-any.whl
Processing ./wheelhouse/nose-1.3.7-py2-none-any.whl
Collecting funcsigs>=1 (from mock==2.0.0)
  Could not find a version that satisfies the requirement funcsigs>=1 (from mock==2.0.0) (from versions: )
No matching distribution found for funcsigs>=1 (from mock==2.0.0)
running script...

Traceback (most recent call last):
  File "/log/solo-script/simple_goto.py", line 15, in <module>
    from dronekit import connect, VehicleMode, LocationGlobalRelative
ImportError: No module named dronekit

If I run from the dronekit-python directory I get this output/errors:

Reeds-MacBook-Pro:dronekit-python ReedHorton$ solo script run simple_goto.py
connecting to solo...
checking pip...
uploading script bundle...
./
./.DS_Store
./LICENSE
...
./simple_goto.py
Not deleting env/bin
New python executable in env/bin/python
Installing setuptools, pip, wheel...done.
cp: can't stat '/usr/lib/python2.7/site-packages/greenlet*': No such file or directory
Ignoring indexes: https://pypi.python.org/simple
lxml-4.2.5-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl is not a supported wheel on this platform.
running script...

Traceback (most recent call last):
  File "/log/solo-script/simple_goto.py", line 15, in <module>
    from dronekit import connect, VehicleMode, LocationGlobalRelative
  File "/log/solo-script/dronekit/__init__.py", line 40, in <module>
    from queue import Queue, Empty
ImportError: No module named queue

There are a couple other issues I have had which may or may not be related. When I try and package the script I get an error with pip version control/babel 2.0 where it suggests I update pip to 18.1 but as you can see pip is already version 18.1

Reeds-MacBook-Pro:dronekit-python ReedHorton$ solo script pack
checking Internet connectivity...
Creating script archive...
site packages directory: /var/folders/72/36hkkdts7253skjy0ygcywm00000gn/T/tmpbr9fjV/content/env/lib/python2.7/site-packages
script is at /var/folders/72/36hkkdts7253skjy0ygcywm00000gn/T/tmpUTZnkg
Requirement already satisfied: wheel in ./env/lib/python2.7/site-packages (0.31.1)
...
Collecting typing; python_version < "3.5" (from sphinx>=1.1->sphinx-3dr-theme>=0.4.3->-r requirements.txt (line 7))
  Downloading https://files.pythonhosted.org/packages/cc/3e/29f92b7aeda5b078c86d14f550bf85cff809042e3429ace7af6193c3bc9f/typing-3.6.6-py2-none-any.whl
  Saved ./wheelhouse/typing-3.6.6-py2-none-any.whl
Collecting babel!=2.0,>=1.3 (from sphinx>=1.1->sphinx-3dr-theme>=0.4.3->-r requirements.txt (line 7))
  Could not find a version that satisfies the requirement babel!=2.0,>=1.3 (from sphinx>=1.1->sphinx-3dr-theme>=0.4.3->-r requirements.txt (line 7)) (from versions: )
No matching distribution found for babel!=2.0,>=1.3 (from sphinx>=1.1->sphinx-3dr-theme>=0.4.3->-r requirements.txt (line 7))
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Creating tarball (solo-script.tar.gz)
Reeds-MacBook-Pro:dronekit-python ReedHorton$ pip install --upgrade pip
Requirement already up-to-date: pip in /Library/Python/2.7/site-packages/pip-18.1-py2.7.egg (18.1)

Finally I thought maybe I needed to update the solo but couldn't do that either:

Reeds-MacBook-Pro:dronekit-python ReedHorton$ solo flash both latest
you are about to flash Solo and the Controller.
this PRESERVES ALL LOCAL CHANGES to Solo, but any conflicts
with newer updates is not guaranteed to work.
proceed to perform update? [y/N] y

checking Internet connectivity...
Traceback (most recent call last):
  File "/usr/local/bin/solo", line 9, in <module>
    load_entry_point('solo-cli==1.2.0', 'console_scripts', 'solo')()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 565, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2697, in load_entry_point
    return ep.load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2370, in load
    return self.resolve()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2376, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Library/Python/2.7/site-packages/soloutils/__main__.py", line 37, in <module>
    soloutils.flash.main(args)
  File "/Library/Python/2.7/site-packages/soloutils/flash.py", line 336, in main
    drone_file, drone_md5 = download_firmware('drone', version)
  File "/Library/Python/2.7/site-packages/soloutils/flash.py", line 254, in download_firmware
    updates = releases(product, [1, 7])
  File "/Library/Python/2.7/site-packages/soloutils/flash.py", line 45, in releases
    parsed = json.loads(openurl(url).read())
  File "/Library/Python/2.7/site-packages/soloutils/flash.py", line 39, in openurl
    return urllib2.urlopen(request)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 437, in open
    response = meth(req, response)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 401: UNAUTHORIZED

I have versions:

{
  "controller": {
    "ref": "3dr-controller-imx6solo-3dr-artoo-20160926202703", 
    "version": "2.4.2"
  }, 
  "gimbal": {
    "connected": true, 
    "version": "1.3.6"
  }, 
  "pixhawk": {
    "apm_ref": "7e9206cc", 
    "px4firmware_ref": "5e693274", 
    "px4nuttx_ref": "d48fa307", 
    "version": "1.3.1"
  }, 
  "solo": {
    "ref": "3dr-solo-imx6solo-3dr-1080p-20160926202940", 
    "version": "2.4.2"
  }
}
ReedsHorton commented 6 years ago

Interestingly enough when I run the helloword.py example from the solo dev guide as expalined here it works almost fully (a couple errors that do not seem to effect functionality).

reeds-mbp:helloworld ReedHorton$ solo script run helloworld.py
connecting to solo...
checking pip...
uploading script bundle...
./
./requirements.txt
./README.md
./wheelhouse/
./wheelhouse/future-0.15.2-py2-none-any.whl
./wheelhouse/pymavlink-2.0.6-py2-none-any.whl
./wheelhouse/dronekit-2.9.1-py2-none-any.whl
./wheelhouse/monotonic-1.2-py2.py3-none-any.whl
./helloworld.py
Not deleting env/bin
New python executable in env/bin/python
Installing setuptools, pip, wheel...done.
cp: can't stat '/usr/lib/python2.7/site-packages/greenlet*': No such file or directory
Ignoring indexes: https://pypi.python.org/simple
Processing ./wheelhouse/dronekit-2.9.1-py2-none-any.whl
Processing ./wheelhouse/future-0.15.2-py2-none-any.whl
Processing ./wheelhouse/monotonic-1.2-py2.py3-none-any.whl
Processing ./wheelhouse/pymavlink-2.0.6-py2-none-any.whl
Installing collected packages: pymavlink, future, monotonic, dronekit
Successfully installed dronekit-2.9.1 future-0.15.2 monotonic-1.2 pymavlink-2.0.6
running script...

ERROR LOADING MAVNATIVE - falling back to python implementation
Connecting to udpin:0.0.0.0:14550...
>>> PreArm: Need 3D Fix
>>> APM:Copter solo-1.3.1 (7e9206cc)
>>> PX4: 5e693274 NuttX: d48fa307
>>> Frame: QUAD
>>> PX4v2 00320019 31355105 36333436
>>> PreArm: Need 3D Fix
Vehicle state:
 Global Location: LocationGlobal:lat=0.0,lon=0.0,alt=-4.05
 Global Location (relative altitude): LocationGlobalRelative:lat=0.0,lon=0.0,alt=-4.05
 Local Location: LocationLocal:north=None,east=None,down=None
 Attitude: Attitude:pitch=-0.0487823411822,yaw=-2.17772245407,roll=-3.11577582359
 Velocity: [0.089999999999999997, 0.01, -0.14000000000000001]
 Battery: Battery:voltage=15.479,current=0.83,level=61
 Last Heartbeat: 0.100144
 Heading: 235
 Groundspeed: 0.0
 Airspeed: 0.0
 Mode: LOITER
 Is Armable?: False
 Armed: False
Done.