You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Im running dronekit 2.4.0 on an odroid UX4, connected with an FTDI cable to the Pixhawk Telem 2 port (dronekit is reading straight from /dev/ttyUSB0). Pixhawk is running APM copter 3.3.3 and the 3DR Radio is on Telem 1. Serial 4/5 is also in use (Taranis telemetry).
I notice the following messages being spammed to std err/out on the odroid. Otherwise it does seem to be working properly (both reading the data via dronekit and apm planner 2.0).
...
argument of type 'NoneType' is not iterable
Exception in message handler for HEARTBEAT
argument of type 'NoneType' is not iterable
Exception in message handler for HEARTBEAT
argument of type 'NoneType' is not iterable
Exception in message handler for HEARTBEAT
...
It seems the issue is something to do with the telem1 & telem2 streams interfering with each other somehow? Some guidance as to what the correct usage pattern is would be appreciated. Or confirm if this is a bug.
Reacted by Alexis Paques, John McAvoy and Lennart Ochel
I am having the same error, however it is critical for me. I'm using an ErleBrain2 running APM. It always returns Not Armable even when it's armed. When I try to run vehicle_state, I get several of these heartbeat exceptions, then it crashes (same as reported in 307)
It was actually in a slightly different place that the edit was needed but none the less:
>>> Exception in message handler for HEARTBEAT
>>> argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/home/dgorissen/.virtualenvs/orangspy/local/lib/python2.7/site-packages/dronekit/mavlink.py", line 150, in mavlink_thread_in
fn(self, msg)
File "/home/dgorissen/.virtualenvs/orangspy/local/lib/python2.7/site-packages/dronekit/__init__.py", line 1011, in listener
self.notify_message_listeners(msg.get_type(), msg)
File "/home/dgorissen/.virtualenvs/orangspy/local/lib/python2.7/site-packages/dronekit/__init__.py", line 1467, in notify_message_listeners
fn(self, name, msg)
File "/home/dgorissen/.virtualenvs/orangspy/local/lib/python2.7/site-packages/dronekit/__init__.py", line 1169, in listener
if self._is_mode_available(m.custom_mode) == False:
File "/home/dgorissen/.virtualenvs/orangspy/local/lib/python2.7/site-packages/dronekit/__init__.py", line 1501, in _is_mode_available
return mode_code in self._mode_mapping_bynumber
TypeError: argument of type 'NoneType' is not iterable
Edit: there does seem to be some cross talk going on between what Im reading over the FTDI cable from telem2 and what Apmplanner is receiving over the radios. The latter will drop and regain connection sporadically and the flight planner screen shows a blinking red GCS entry which I have no idea where it comes from:
I've added a small PR to deal with the specific iterable problem, but it uncovers the underlying problem which I think is the GCS (or whatever) is using vehicle mode 0 which isn't in the mode mappings. This can be dealt with in several places:
>>> Exception in message handler for HEARTBEAT
>>> mode 0 not available on mavlink definition
This is possibly because from fw 3.3 the mavlink messages from different sources are routed or are sent if a non-specific source request is made so the dronekit script receives all mavlink messages on the line. The dronekit scripts should perhaps instead target a specific sysid/componentid to receive only what it wants?
So the exception in the message handler should be dealt with better, but the underlying issue is almost certainly related to this: #516
The connection the dronekit script makes should be source filtered so it doesn't receive messages from the entire mavlink network.
@fnoop, @peterbarker thanks. Looking at #585 it hasnt seen updates for a couple months (other than the CI failing). Im currently staying on the safe side and plugging in only a single telemetry consumer (my companion computer). Anything else and I get crosstalk. This means I cannot use my radios, taranis telemetry, etc. which is not great as Im flying blind.
From the issue it seems like a hairy one and will take some time to resolve (?). Any suggested workarounds or fixes?
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
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
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
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
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
Exception in message handler for HEARTBEAT
mode 0 not available on mavlink definition
c>>> 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
A picture can paint a thousand words:
[image: Inline image 1]
This resides in an sd card on my beaglebone - so no desktop. I am using
WinSCP to see the beaglebone's tree structure. So would it be
MDEF=root@beaglebone/mavlink . . . .?
@lidia-toscanohttps://github.com/lidia-toscano Welcome to the world of
programming. HOME is the base directory. When you are log in as
root@beaglebone, you start at the root directory. A few directories are
built in, like HOME/Desktop, /Documents, and /Downloads. So it depends on
where you cloned the ardupilot directory. Where in your folder system in
the ardupilot folder?
Hi, still getting errors:
root@beaglebone:~/mavlink/pymavlink# MDEF=$HOME/mavlink/message_definitions python setup.py build install --user --force
Using message definitions from /root/mavlink/message_definitions
Building /root/mavlink/message_definitions/v1.0/paparazzi.xml for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be performed
Building /root/mavlink/message_definitions/v1.0/matrixpilot.xml for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be performed
Building /root/mavlink/message_definitions/v1.0/test.xml for protocol 1.0
This is a little different. Is this something I need to clone as well?
Thanks
pip unistall pymavlink (multiple times)
pip unistall dronekit
pip install dronekit (this added pymavlink back in but not the version I want)
git clone https://github.com/mavlink/mavlink
cd mavlink
git clone https://github.com/Ardupilot/pymavlink (by using clone in the mavlink directory the build can find the message definitions and there is no need for extra work)
cd pymavlink
setup.py build install
Which error were you getting @kostkar ? Was it Exception in message handler for HEARTBEAT mode 0 not available on mavlink definition when trying to connect MP and dronekit?
pip unistall pymavlink (multiple times)
pip unistall dronekit
pip install dronekit (this added pymavlink back in but not the version I
want)
git clone https://github.com/mavlink/mavlink
cd mavlink
git clone https://github.com/Ardupilot/pymavlink (by using clone in the
mavlink directory the build can find the message definitions and there is
no need for extra work)
setup.py build install
I think the issue, even when I clone git clone https://github.com/Ardupilot/
pymavlink from the mavlink folder, the setup.py file is not there, it is in
the pymavlink folder. If I try to do the setup.py from mavlink, it cannot
find that file and if I do it from the pymavlink folder it cannot find the
XML validator because now I am getting that error.
root@beaglebone:/mavlink# cd ~
root@beaglebone:# python setup.py build install
python: can't open file 'setup.py': [Errno 2] No such file or directory
root@beaglebone:# cd mavlink
root@beaglebone:/mavlink# python setup.py build install
python: can't open file 'setup.py': [Errno 2] No such file or directory
This is really frustrating.
root@beaglebone:/mavlink# cd pymavlink
root@beaglebone:/mavlink/pymavlink# python setup.py build install
Using message definitions from
/root/mavlink/pymavlink/../message_definitions
Building /root/mavlink/pymavlink/../message_definitions/v1.0/paparazzi.xml
for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be
performed
Building
/root/mavlink/pymavlink/../message_definitions/v1.0/matrixpilot.xml for
protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be
performed
pip unistall pymavlink (multiple times)
pip unistall dronekit
pip install dronekit (this added pymavlink back in but not the version I
want)
git clone https://github.com/mavlink/mavlink
cd mavlink
git clone https://github.com/Ardupilot/pymavlink (by using clone in the
mavlink directory the build can find the message definitions and there is
no need for extra work)
setup.py build install
On Tue, 11 Oct 2016, Lidia wrote:
Building /root/mavlink/pymavlink/../message_definitions/v1.0/paparazzi.xml
for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be
performed
OK, congratulations, you're living on the bleeding edge.
New prerequisites are present for building the languiage bindings as of
yesterday.
You can install the prerequisites with "pip install -r requirements.txt"
where requirements.txt is present in the pymavlink root. You might also
consider checking the contents of that file and using your operating
system's package manager to install.
We've moved to using lxml - which is - no kidding - 10x faster than what
we were using!
Please also note that we've also just accepted a PR to add python3 support
to pymavlink; there might be some rough edges.
-r option requires an argument
root@beaglebone:~/mavlink/pymavlink#
Checking the contents of that file, what would I be looking for exactly?
Also, when you say "your operating system's package manager" what exactly
does that mean? I am using Windows but all of my software is residing on
an sd card in the Beaglebone I am trying to work with. Your input is
greatly appreciated.
Building /root/mavlink/pymavlink/../message_definitions/v1.0/
paparazzi.xml
for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not
be
performed
OK, congratulations, you're living on the bleeding edge.
New prerequisites are present for building the languiage bindings as of
yesterday.
You can install the prerequisites with "pip install -r requirements.txt"
where requirements.txt is present in the pymavlink root. You might also
consider checking the contents of that file and using your operating
system's package manager to install.
We've moved to using lxml - which is - no kidding - 10x faster than what
we were using!
Please also note that we've also just accepted a PR to add python3 support
to pymavlink; there might be some rough edges.
Hi
Concerning this:
Exception in message handler for HEARTBEAT
mode 0 not available on mavlink definition
I am running a simple test from my OdroidXU4 on ubuntu 14.04
MINIMAL_TEST.py
from dronekit import connect
import time
print 'Connecting to vehicle on: %s' % connection_string
vehicle = connect('tcp:my.host.computer.ip:5763', wait_ready=True)
while True:
print " Ch1: %s" % vehicle.channels['1']
time.sleep(0.2)
I do NOT have error message when connecting to my UBUNTU Host running sitl : sim_vehicule.py
I do have error message when connecting to my WINDOWS Host running simulator within Mission Planner 1.3.41
Hope this test set can help resolve this issue :-)
Both patricks here are still getting the same where whe connecting to SITL and MP... @patrickpoirier51 let me know if you find a solution please. good luck.
Hey @LorenzMeier ... how about you take some pride in your work and actually TRY this yourself? Show folks how to make it work, or fix the broken code yourself? I have a feeling you really don't WANT PX4 to work well with mavproxy / dronekit for political reasons...
@expntly has confirmed that modern versions of pymavlink do work against PX4 - which is what this issue was originally about.
If your issue is NOT one of:
argument of type 'NoneType' is not iterable
Exception in message handler for HEARTBEAT
or
>>> Exception in message handler for HEARTBEAT
>>> mode 65536 not available on mavlink definition
then this is almost certainly not a PX4-related issue, and please open a separate issue describing your problem.
If your error message is one of the above, then using a 2.9.0-or-greater version of dronekit-python should fix your problem. Several people have discovered they were running older versions of dronekit-python when they weren't expecting it, often due to package-managers vs pip vs "python setup.py ..." all interacting badly. People have been able to fix this by repeatedly running "pip uninstall dronekit" until it says no package is installed by that name, then installing it again.
doesn't give you 2.9.0 (or greater), then you are likely to get the PX4-related exceptions (assuming you're running "PX4 Pro" :-) )
@paan2097 I think your issue is a different issue to that covered on this ticket (you're getting "mode 0" not available on heartbeat"). Please open a separate issue. You might also try connecting MAVProxy to the same port you were trying to point dronekit-python at - the output might be illuminating.
@MAVProxyUser We believe that dronekit-python should communicate with "PX4 Pro" just fine now, and any bugs in dronekit-python are our bugs, not @LorenzMeier 's. Various members of the "PX4 Pro" team have been quite helpful trying to get dronekit-python (and pymavlink) working correctly on "PX4 Pro".
I will be closing this issue as "fixed" at some stage soon, unless someone pipes up and says it is still broken. Please don't take this as a "we don't believe you have problems" reaction, and re-read the bit up there about "murky" and "create a new separate issue" :-)
Activity
PureRockets commentedon Apr 3, 2016
I am having the same error, however it is critical for me. I'm using an ErleBrain2 running APM. It always returns Not Armable even when it's armed. When I try to run vehicle_state, I get several of these heartbeat exceptions, then it crashes (same as reported in 307)
peterbarker commentedon Apr 4, 2016
Attempting to iterate over NoneType is clearly a bug. We'll need more debug to try to track this.
Could you add the following lines:
into mavlink.py, just under this line:
errprinter('>>> ' + str(e))
please?
dgorissen commentedon Apr 4, 2016
It was actually in a slightly different place that the edit was needed but none the less:
Edit: there does seem to be some cross talk going on between what Im reading over the FTDI cable from telem2 and what Apmplanner is receiving over the radios. The latter will drop and regain connection sporadically and the flight planner screen shows a blinking red GCS entry which I have no idea where it comes from:
fnoop commentedon Apr 4, 2016
I've added a small PR to deal with the specific iterable problem, but it uncovers the underlying problem which I think is the GCS (or whatever) is using vehicle mode 0 which isn't in the mode mappings. This can be dealt with in several places:
This is possibly because from fw 3.3 the mavlink messages from different sources are routed or are sent if a non-specific source request is made so the dronekit script receives all mavlink messages on the line. The dronekit scripts should perhaps instead target a specific sysid/componentid to receive only what it wants?
fnoop commentedon Apr 4, 2016
So the exception in the message handler should be dealt with better, but the underlying issue is almost certainly related to this:
#516
The connection the dronekit script makes should be source filtered so it doesn't receive messages from the entire mavlink network.
PureRockets commentedon Apr 4, 2016
I get the exception with a single vehicle, and just dronekit access (no Mission Planner). I'm dead in the water with dronekit, I can't arm my vehicle.
peterbarker commentedon Apr 4, 2016
@fnoop source system filtering: #585
dgorissen commentedon Apr 5, 2016
@fnoop, @peterbarker thanks. Looking at #585 it hasnt seen updates for a couple months (other than the CI failing). Im currently staying on the safe side and plugging in only a single telemetry consumer (my companion computer). Anything else and I get crosstalk. This means I cannot use my radios, taranis telemetry, etc. which is not great as Im flying blind.
From the issue it seems like a hairy one and will take some time to resolve (?). Any suggested workarounds or fixes?
mrpollo commentedon Apr 12, 2016
@dgorissen are you running APM or PX4?
dgorissen commentedon Apr 12, 2016
APM
On 13 Apr 2016 02:58, "Ramon Roche" notifications@github.com wrote:
Merge pull request #611 from fnoop/master
mrpollo commentedon Apr 25, 2016
@dgorissen this was fixed in #611 release to follow shortly
dgorissen commentedon Apr 25, 2016
Awesome. Thanks @mrpollo
hannahdn commentedon Jun 22, 2016
I am still getting this error (after #611 update):
@fnoop You mentioned a fix for that, what do you use?
doomedramen commentedon Aug 2, 2016
with everything up-to-date i still get:
48 remaining items
lidia-toscano commentedon Oct 10, 2016
A picture can paint a thousand words:
[image: Inline image 1]
This resides in an sd card on my beaglebone - so no desktop. I am using
WinSCP to see the beaglebone's tree structure. So would it be
MDEF=root@beaglebone/mavlink . . . .?
Thanks!
On Mon, Oct 10, 2016 at 5:31 PM, paan2097 notifications@github.com wrote:
lidia-toscano commentedon Oct 11, 2016
Hi, still getting errors:
root@beaglebone:~/mavlink/pymavlink# MDEF=$HOME/mavlink/message_definitions python setup.py build install --user --force
Using message definitions from /root/mavlink/message_definitions
Building /root/mavlink/message_definitions/v1.0/paparazzi.xml for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be performed
Building /root/mavlink/message_definitions/v1.0/matrixpilot.xml for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be performed
Building /root/mavlink/message_definitions/v1.0/test.xml for protocol 1.0
This is a little different. Is this something I need to clone as well?
Thanks
kostkar commentedon Oct 11, 2016
I tried the following today and it worked for me:
pip unistall pymavlink (multiple times)
pip unistall dronekit
pip install dronekit (this added pymavlink back in but not the version I want)
git clone https://github.com/mavlink/mavlink
cd mavlink
git clone https://github.com/Ardupilot/pymavlink (by using clone in the mavlink directory the build can find the message definitions and there is no need for extra work)
cd pymavlink
setup.py build install
Hope it helps.
paan2097 commentedon Oct 11, 2016
Which error were you getting @kostkar ? Was it Exception in message handler for HEARTBEAT mode 0 not available on mavlink definition when trying to connect MP and dronekit?
lidia-toscano commentedon Oct 11, 2016
Thanks, that gave me a glimmer of hope but still same issue. = (
On Tue, Oct 11, 2016 at 3:09 PM, kostkar notifications@github.com wrote:
lidia-toscano commentedon Oct 11, 2016
I think the issue, even when I clone git clone https://github.com/Ardupilot/
pymavlink from the mavlink folder, the setup.py file is not there, it is in
the pymavlink folder. If I try to do the setup.py from mavlink, it cannot
find that file and if I do it from the pymavlink folder it cannot find the
XML validator because now I am getting that error.
root@beaglebone:
/mavlink# cd ~# python setup.py build installroot@beaglebone:
python: can't open file 'setup.py': [Errno 2] No such file or directory
root@beaglebone:
# cd mavlink/mavlink# python setup.py build installroot@beaglebone:
python: can't open file 'setup.py': [Errno 2] No such file or directory
This is really frustrating.
root@beaglebone:
/mavlink# cd pymavlink/mavlink/pymavlink# python setup.py build installroot@beaglebone:
Using message definitions from
/root/mavlink/pymavlink/../message_definitions
Building /root/mavlink/pymavlink/../message_definitions/v1.0/paparazzi.xml
for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be
performed
Building
/root/mavlink/pymavlink/../message_definitions/v1.0/matrixpilot.xml for
protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be
performed
On Tue, Oct 11, 2016 at 3:09 PM, kostkar notifications@github.com wrote:
peterbarker commentedon Oct 11, 2016
lidia-toscano commentedon Oct 12, 2016
Peter,
I did the pip install -r and it is looking for an argument? What is it?
root@beaglebone:~/mavlink/pymavlink# pip install -r
Usage:
pip install [options] [package-index-options] ...
pip install [options] -r [package-index-options] ...
pip install [options] [-e] ...
pip install [options] [-e] ...
pip install [options] <archive url/path> ...
-r option requires an argument
root@beaglebone:~/mavlink/pymavlink#
Checking the contents of that file, what would I be looking for exactly?
Also, when you say "your operating system's package manager" what exactly
does that mean? I am using Windows but all of my software is residing on
an sd card in the Beaglebone I am trying to work with. Your input is
greatly appreciated.
Thanks!!!
On Tue, Oct 11, 2016 at 6:40 PM, Peter Barker notifications@github.com
wrote:
patrickpoirier51 commentedon Oct 23, 2016
Hi
Concerning this:
Exception in message handler for HEARTBEAT
mode 0 not available on mavlink definition
I am running a simple test from my OdroidXU4 on ubuntu 14.04
MINIMAL_TEST.py
from dronekit import connect
import time
print 'Connecting to vehicle on: %s' % connection_string
vehicle = connect('tcp:my.host.computer.ip:5763', wait_ready=True)
while True:
print " Ch1: %s" % vehicle.channels['1']
time.sleep(0.2)
I do NOT have error message when connecting to my UBUNTU Host running sitl : sim_vehicule.py
I do have error message when connecting to my WINDOWS Host running simulator within Mission Planner 1.3.41
Hope this test set can help resolve this issue :-)
paan2097 commentedon Oct 24, 2016
Both patricks here are still getting the same where whe connecting to SITL and MP... @patrickpoirier51 let me know if you find a solution please. good luck.
MAVProxyUser commentedon Oct 24, 2016
Hey @LorenzMeier ... how about you take some pride in your work and actually TRY this yourself? Show folks how to make it work, or fix the broken code yourself? I have a feeling you really don't WANT PX4 to work well with mavproxy / dronekit for political reasons...
peterbarker commentedon Oct 24, 2016
@lidia-toscano There is an argument in what I wrote :-)
pip install -r requirements.txtpeterbarker commentedon Oct 24, 2016
@paan2097 Oh. You're connecting to a simulated vehicle being run under Mission Planner?!
That's a new one on me. My quick reading tells me it runs the same SITL binaries....
Do you think you could record a telemetry log for me to look at?
peterbarker commentedon Oct 24, 2016
This thread is getting very murky.
@expntly has confirmed that modern versions of pymavlink do work against PX4 - which is what this issue was originally about.
If your issue is NOT one of:
or
then this is almost certainly not a PX4-related issue, and please open a separate issue describing your problem.
If your error message is one of the above, then using a 2.9.0-or-greater version of dronekit-python should fix your problem. Several people have discovered they were running older versions of dronekit-python when they weren't expecting it, often due to package-managers vs pip vs "python setup.py ..." all interacting badly. People have been able to fix this by repeatedly running "pip uninstall dronekit" until it says no package is installed by that name, then installing it again.
If getting the version like this:
doesn't give you 2.9.0 (or greater), then you are likely to get the PX4-related exceptions (assuming you're running "PX4 Pro" :-) )
@paan2097 I think your issue is a different issue to that covered on this ticket (you're getting "mode 0" not available on heartbeat"). Please open a separate issue. You might also try connecting MAVProxy to the same port you were trying to point dronekit-python at - the output might be illuminating.
@MAVProxyUser We believe that dronekit-python should communicate with "PX4 Pro" just fine now, and any bugs in dronekit-python are our bugs, not @LorenzMeier 's. Various members of the "PX4 Pro" team have been quite helpful trying to get dronekit-python (and pymavlink) working correctly on "PX4 Pro".
I will be closing this issue as "fixed" at some stage soon, unless someone pipes up and says it is still broken. Please don't take this as a "we don't believe you have problems" reaction, and re-read the bit up there about "murky" and "create a new separate issue" :-)
patrickpoirier51 commentedon Oct 24, 2016
Thanks for the follow-up,
as requested I opened : Exception in message handler for HEARTBEAT mode 0 not available on mavlink definition #677