Reputation: 1
I followed the instructions on this page:
http://python.dronekit.io/guide/quick_start.html
What I've Done:
pip install dronekit
pip install dronekit-sitl
Then I created a python file with this in it:
print ("Start simulator (SITL)")
import dronekit_sitl
sitl = dronekit_sitl.start_default()
#connection_string = sitl.connection_string()
# Import DroneKit-Python
from dronekit import connect, VehicleMode
# Connect to the Vehicle.
print("Connecting to vehicle on: %s" % ('tcp:127.0.0.1:5760',))
vehicle = connect('tcp:127.0.0.1:5760', wait_ready=True)
# Get some vehicle attributes (state)
print ("Get some vehicle attribute values:")
print (" GPS: %s" % vehicle.gps_0)
print (" Battery: %s" % vehicle.battery)
print (" Last Heartbeat: %s" % vehicle.last_heartbeat)
print (" Is Armable?: %s" % vehicle.is_armable)
print (" System status: %s" % vehicle.system_status.state)
print (" Mode: %s" % vehicle.mode.name) # settable
# Close vehicle object before exiting script
vehicle.close()
# Shut down simulator
sitl.stop()
print("Completed")
Then I ran it, and this is the error I got on the terminal:
olin30259168:Desktop physics$ python hello.py
Start simulator (SITL)
Starting copter simulator (SITL)
SITL already Downloaded and Extracted.
Ready to boot.
Connecting to vehicle on: tcp:127.0.0.1:5760
>>> APM:Copter V3.3 (d6053245)
>>> Frame: QUAD
>>> Calibrating barometer
Traceback (most recent call last):
File "hello.py", line 12, in <module>
vehicle = connect('tcp:127.0.0.1:5760', wait_ready=True)
File "/Users/physics/anaconda/lib/python3.6/site-packages/dronekit/__init__.py", line 2849, in connect
vehicle.wait_ready(True)
File "/Users/physics/anaconda/lib/python3.6/site-packages/dronekit/__init__.py", line 2199, in wait_ready
timeout)
dronekit.APIException: wait_ready experienced a timeout after 30 seconds.
olin30259168:Desktop physics$
What I should be getting is:
Start simulator (SITL)
Downloading SITL from http://dronekit-assets.s3.amazonaws.com/sitl/copter/sitl-win-copter-3.3.tar.gz
Extracted.
Connecting to vehicle on: 'tcp:127.0.0.1:5760'
>>> APM:Copter V3.3 (d6053245)
>>> Frame: QUAD
>>> Calibrating barometer
>>> Initialising APM...
>>> barometer calibration complete
>>> GROUND START
Get some vehicle attribute values:
GPS: GPSInfo:fix=3,num_sat=10
Battery: Battery:voltage=12.587,current=0.0,level=100
Last Heartbeat: 0.713999986649
Is Armable?: False
System status: STANDBY
Mode: STABILIZE
Completed
It seems to connect, but it times out trying to calibrate the barometer, I run into the same issue when I run the examples that I cloned from this directory:
https://github.com/dronekit/dronekit-python/tree/master/examples
Upvotes: 0
Views: 605
Reputation: 1
This is what I installed on windows 10, if it give the same problem just resart the computer and re-run it a maximum of 4 times and then let me know.
1) Install Python 2.7
2) Go to https://pip.pypa.io/en/stable/installing/ a. Click on get-pip.py b. Save it on the desktop c. Once downloaded double click on it
3) Go to Command Prompt a. If it says C:\Users\oscar4423> i. Type cd C:\Python27\Scripts b. Once step I is done type pip like this C:\Python27\Scripts>pip c. Now type pip install requests: C:\Python27\Scripts>pip install requests
4) Close the command prompt
5) Go to https://git-scm.com/downloads and then click “download for Windows”
6) Install git 7) Open the Command Prompt and type cd C:\Python27\Scripts
8) Type pip install git+https://github.com/3drobotics/solo-cli C:\Python27\Scripts>pip install git+https://github.com/3drobotics/solo-cli
9) Now Install the following pip install virtualenv 10) Type pip install dronekit on the command prompt like this: C:\Python27\Scripts> pip install dronekit
11) Type pip install dronekit-sitl on the command prompt like this: C:\Python27\Scripts> pip install dronekit-sitl
12) pip install numpy pyparsing
13) pip install MAVProxy
Upvotes: 0