Edison DroneKit connection to Pixhawk

Hi,

I’m trying to run a dronekit python script on the Edison which is in the Pixhawk 2.1. It seems to be connecting OK on upd:127.0.0.1:9000 and I can see some of the initial messages but the script keeps reporting Exception in message handler for HEARTBEAT

Also tried cmavnode ports 14656 and 14655 but they would not connect at all.

Found mentions of this problem on https://github.com/dronekit/dronekit-python/issues/610 which seems to say that this problem is fixed in the latest version of dronekit and/or mavproxy.

Running the latest version of apsync - March 21st 2017 which has dronekit version 2.9.0, pymavlink 2.0.6

Is there an easy way to upgrade the edison/apsync without reconfiguring the wifi or, since I know other people have dronekit working on the edison, how do it get it to connect?

Thanks

Connect to Pixhawk...
Connecting to vehicle on: udp:127.0.0.1:9000
>>> ArduPlane V3.8.0beta5 (708b483d)
>>> Exception in message handler for HEARTBEAT
>>> mode 0 not available on mavlink definition
>>> PX4: 8d505a02 NuttX: 1a99ba58
>>> PX4v2 0038002F 30365111 35323931
>>> Exception in message handler for HEARTBEAT
>>> mode 0 not available on mavlink definition
>>> Exception in message handler for HEARTBEAT
>>> mode 0 not available on mavlink definition

hi,l have experienced the same issue and confused by it for long time, have you fixed this issue?

if you have fixed it, would you please tell me how do, thank you very much

Hi Zhitao, No, not managed to get rid of the HEARTBEAT Exception or model 0 messages. Since the dronekit script works well, I just filter out those two messages from the log.

Hi,weliwarmer

thanks for your repose. I have anohter issue, if I connect the pixhawk2 with dronekit scripte in edison, it always prompt that “ link timeout”. my commnad as below:

python vehicle_state.py --connect ‘/dev/ttyMFD1,921600’

I alse try other bautrate, 57600, 115200, unfortunately, the same error, link timeout. have you experienced the same issue?

thanks a lot

Yes, my script does timeout sometimes. I have a bash script which loops round, with a delay before starting the python script again. It’s usually after the script has thrown an exception and the vehicle.close() was not called correctly.

Make sure that mavproxy is running on the edison and that the LOG_BACKEND_TYPE is 2 or 3.

Here a working script: https://github.com/crystalmark/eesa/tree/master/scripts

hi,
sorry, I have a foolish question, why do I must run mavproxy on Edison. l just need connect pixhawk2 to Edison with my dronekit script .

excuse me to my low doubt

Actually, I’m not sure why. I simply followed

http://ardupilot.org/dev/docs/intel-edison.html

When I kept receiving timeouts, I made sure the proxy was running, as per the Archived Instructions but I can’t remember what else I did to fix the problem, sorry.

Hi, weliwarmer

  I alse followed this http://ardupilot.org/dev/docs/intel-edison.html webpage step by step.  I downloaded this image "apsync-edison-latest.tar.xz", and flashed it to my Edison. finally I modified three parameters as below:

SERIAL2_PROTOCOL = 1 (the default) to enable MAVLink on the serial port.
SERIAL2_BAUD = 921 so the Pixhawk can communicate with the Edison at 921600 baud.
LOG_BACKEND_TYPE = 3 if you are using APSync to stream the dataflash log files to the Edison

but I haven’t followed “Archived Instructions”, it say that are not useful for most users. you mean I must execute the “Archived Instructions”? I don’t know what’s purpose of "Archived Instructions

Hi, I think I found a solution to your problem.

I’ve been having the same problem and the permissions for devices in linux are usually the problem.

try adding running the script as the root user or adding your user into the correct groups.

I was using the ‘root’ user on Ubuntu/jubilinux and I saw that the device I needed ‘/dev/ttyMFD1’ was owned by the root user and in the ‘dialout’ group. You can use the commands below to put a user in the groups you need to:

On Ubuntu/jubilinux:
sudo usermod -a -G dialout root
sudo usermod -a -G tty root

The changes won’t take effect until you logout and then login again.

type ‘groups’ to see what groups you are in before and after.

Here is a video

https://youtu.be/ZsNh7peS3pk

Please let me know if you have any other issues, this problem killed me for days and I tried a bunch of other things that may have contributed to the fix.

Here is a list of wild unedited notes on what I did:

pip install MAVProxy

apt-get install setserial

setserial /dev/ttyMFD1 -a

pip --version

pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)

install --upgrade pip

pip remove dronekit

pip uninstall dronekit

pip install dronekit

pip install dronekit_sitl

pip install pyserial

Note:
ttyMFD1 is the serial port connecting the Edison to the Pixhawk

http://docs.flytbase.com/docs/FlytOS/GettingStarted/EdisonGuide.html

If it is helpful, here is the output of pip freeze:

root@jubilinux:~# pip freeze
cffi==0.8.6
chardet==2.3.0
colorama==0.3.2
cryptography==0.6.1
dronekit==2.9.1
dronekit-sitl==3.2.0
future==0.15.2
html5lib==0.999
MAVProxy==1.6.1
monotonic==1.2
ndg-httpsclient==0.3.2
ply==3.4
psutil==5.2.2
pyasn1==0.1.7
pycparser==2.10
pygobject==3.14.0
pymavlink==2.0.6
pyOpenSSL==0.14
pyserial==3.4
requests==2.4.3
six==1.10.0
urllib3==1.9.1
virtualenv==15.1.0

I am trying to upload a DroneKit Python script onto the Intel Edison that I have installed inside the PixHawk 2.1. I have flashed the Edison as per the instructions on ardupilot.org and I even have DroneKit code that successfully runs directly on the Pixhawk. Can someone please point me to some documentation telling me how to upload a dronekit script on the Edison and connect the Edison to the Pixhawk? Thanks!

I am trying to upload a DroneKit Python script onto the Intel Edison that I
have installed inside the PixHawk 2.1. I have flashed the Edison as per the
instructions on ardupilot.org and I even have DroneKit code that
successfully runs directly on the Pixhawk. Can someone please point me to
some documentation telling me how to upload a dronekit script on the Edison
and connect the Edison to the Pixhawk? Thanks!

Can you connect to the access point?

You can copy your dronekit script to the Edison using “scp”, “pscp” or
similar.

I cannot connect to the access point. When I try to enter a standard command into the Putty terminal (i.e., “configure_edison --wifi”) I am told “command not found”

apsync@apsync:~$ configure_edison --wifi
-bash: configure_edison: command not found

Alright, I figured it out. With apsync flashed on the Edison, the network was already established (SSID: Ardupilot) and I was able to use WinSCP to copy files. Currently trying to determine what connect string I should use in my dronekit code to communicate from the Edison to the Pixhawk. Thanks for the guidance!

Attempting to connect Edison to Pixhawk via /dev/ttyMFD1, but “no heartbeat detected.” Added Apsync to root and tty as described by Adrian, but this did not help. I’m not sure how to “make sure the proxy is running” as mentioned by Tim. Any suggestions? Thanks!

Attempting to connect Edison to Pixhawk via /dev/ttyMFD1, but “no heartbeat
detected.” Added Apsync to root and tty as described by Adrian, but this did
not help. I’m not sure how to “make sure the proxy is running” as mentioned
by Tim. Any suggestions? Thanks!

Which instructions are you following?

Have you reset the baudrate for serial2?

I have set the baud rate (SERIAL2_BAUD) to 921600 on the Pixhawk via Mission Planner as described on the ardupilot website http://ardupilot.org/dev/docs/intel-edison.html. I have not found explicit instructions to perform this task, although I’ve gone through a lot of the dronekit website http://python.dronekit.io/guide/connecting_vehicle.html#get-started-connecting.

Even when I specify the baud rate of 921600 (connection string: /dev/ttyMFD1,921600) I get the same no heartbeat detected error.

I have the exact same problem as dwchaffee

I did all the permission edits too.