dronekit / dronekit-python

DroneKit-Python library for communicating with Drones via MAVLink.
https://readthedocs.org/projects/dronekit-python/
Apache License 2.0
1.51k stars 1.42k forks source link

Timeout in Initializing connection.. Odroid XU4 - Pixhawk Mini #771

Open jmorley1 opened 6 years ago

jmorley1 commented 6 years ago

Hello all, I would really appreciate some help.

I currently have my Odroid XU4 connected to my pixhawk mini via a FTDI usb to serial converter (as per the tutorial found here: http://ardupilot.org/dev/docs/odroid-via-mavlink.html)

Basically, serial connection from telem port to a serial to USB converter to the Odroid.

In QGroundControl I also changed the SYS_COMPANION parameter to enable the TELEM port as the companion computer link and set the baud rate to 57600. I then saved and rebooted the pixhawk.

I then powered up my Odroid and plugged in the serial converter to a USB port.

Upon running: sudo -s mavproxy.py --master=/dev/ttyUSB0 --baudrate 1500000 --aircraft MyCopter

i receive:

Connect /dev/ttyUSB0 source_system=255 no script MyCopter/logs/2012-12-31/flight2 Log Directory: MyCopter/logs/2012-12-31/flight2/flight.log MAV> Waiting for heartbeat fro /dev/ttyUSB0 online system 1 MANUAL> Mode MANUAL UZ2dAPM: data link #1 lost APM: data link #1 regained 2_ROTfence breach TC_G2_ID:Received 554 parametersX N6eRC_TH_USERENS_DPRES_ANSC i&3_0 Saved 555 parameters to MyCopter/logs/2012-12-31/flight2/nav.parm MANUAL>

Obviously there are some bits of the output that are junk... these junk outputs vary each time i run the command. I do not understand why this happens.

I verify the connection by entering link and i receive MANUAL> link 1 OK (1353 packets, 0.00s delay, 17 lost, 1.3% loss):

In a separate terminal I run the following script to connect to the pixhawk using Dronekit .

import dronekit from dronekit import connect connection_string = '/dev/ttyUSB0' vehicle = connect(connection_string, wait_ready=True, baud=57600)

At which point in the terminal where i ran the mavproxy.py command I see a few random letters and numbers pop up randomly (happens after i run the connection script?). The terminal where I ran the connection script outputs:

Link timeout, no heartbeat in last 5 seconds No heart beat in 30 seconds, aborting Traceback (most recent call last): File "connect.py", line 8, in vehicle = connect(connection_string, wait_ready=True, baud=57600) File "/usr/local/lib/python2.7/dist-packages/dronekit/init.py", line 2845, in connect vehicle.initialize(rate=rate, heartbeat_timeout=heartbeat_timeout) File "/usr/local/lib/python2.7/dist-packages/dronekit/init.py", line 2117, in initialize raise APIException('Timeout in intializing connection.") dronekit.APIException: Timeout in intializing connection.

I also tried running the quick start example on the dronekit website:

print "Start simulator (SITL)" import dronekit_sitl sitl = dronekit_sitl.start_default() connection_string = sitl.connection_string() from dronekit import connect, VehicleMode

print("Connecting to vehicle on: %s" % (connection_string,)) vehicle = connect(connection_string, wait_ready=True)

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 vehicle.close() sitl.stop() print("Completed")

to which I recieve the following error:

Starting copter simulator (SITL) SITL already Downloaded and Extracted. Ready to boot. Traceback (most recent call last): File "simple_goto.py", line 33, in sitl = dronekit_sitl.start_default() File "/usr/local/lib/python2.7/dist-packages/dronekit_sitl/init.py", line 341, in start_default sitl.launch(sitl_args, await_ready=True, restart=True) File "/usr/local/lib/python2.7/dist-packages/dronekit_sitl/init.py", line 271, in launch p = Popen([self.path] + args, cwd=wd, shell=sys.platform == 'win32', stdout=PIPE, stderr=PIPE) File "/usr/lib/python2.7/subprocess.py", line 710, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1327, in executechild raise child_exception OSError: [Errno 8] Exec format error

Can anyone help me understand these errors or perhaps share their experience in connecting the a pixhawk to the Odroid XU4? Anything would be greatly appreciated.. thank you!

pietrodn commented 6 years ago

I had the same problem when trying to use mavproxy together with DroneKit. You should not run both DroneKit and mavproxy at the same time on the same serial port.