Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Exception in message handler for heartbeat #610

Open

Description

@dgorissen

I found 3 threads about this but no authorative answer/solution:

https://groups.google.com/forum/#!topic/drones-discuss/tQQjc0_5Eng
https://discuss.dronekit.io/t/issue-with-vehicle-state-py-and-rover/307
https://discuss.dronekit.io/t/missionplanner-and-dronekit-floods-console-with-errors/287

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.

Activity

  1. PureRockets commented on Apr 3, 2016

    @PureRockets

    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)

  2. peterbarker commented on Apr 4, 2016

    @peterbarker
    Contributor

    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:

                import traceback
                traceback.print_exc()
    

    into mavlink.py, just under this line:
    errprinter('>>> ' + str(e))

    please?

  3. dgorissen commented on Apr 4, 2016

    @dgorissen
    ContributorAuthor

    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:

    grab

  4. fnoop commented on Apr 4, 2016

    @fnoop
    Contributor

    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?

  5. fnoop commented on Apr 4, 2016

    @fnoop
    Contributor

    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.

  6. PureRockets commented on Apr 4, 2016

    @PureRockets

    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.

  7. peterbarker commented on Apr 4, 2016

    @peterbarker
    Contributor

    @fnoop source system filtering: #585

  8. dgorissen commented on Apr 5, 2016

    @dgorissen
    ContributorAuthor

    @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?

  9. mrpollo commented on Apr 12, 2016

    @mrpollo
    Member

    @dgorissen are you running APM or PX4?

  10. dgorissen commented on Apr 12, 2016

    @dgorissen
    ContributorAuthor

    APM
    On 13 Apr 2016 02:58, "Ramon Roche" notifications@github.com wrote:

    @dgorissen https://github.com/dgorissen are you running APM or PX4?

    —
    You are receiving this because you were mentioned.
    Reply to this email directly or view it on GitHub
    #610 (comment)

  11. added a commit that references this issue on Apr 19, 2016
  12. mrpollo commented on Apr 25, 2016

    @mrpollo
    Member

    @dgorissen this was fixed in #611 release to follow shortly

  13. dgorissen commented on Apr 25, 2016

    @dgorissen
    ContributorAuthor

    Awesome. Thanks @mrpollo

  14. hannahdn commented on Jun 22, 2016

    @hannahdn

    I am still getting this error (after #611 update):

    Exception in message handler for HEARTBEAT
    mode 0 not available on mavlink definition

    @fnoop You mentioned a fix for that, what do you use?

  15. doomedramen commented on Aug 2, 2016

    @doomedramen

    with everything up-to-date i still get:

    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

  16. 48 remaining items

  17. lidia-toscano commented on Oct 10, 2016

    @lidia-toscano

    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 https://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?

    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    #610 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/ASyBSZCDEQmRhSHxEySq5UP0DZaP7Tikks5qyq6zgaJpZM4H-mq6
    .

  18. lidia-toscano commented on Oct 11, 2016

    @lidia-toscano

    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

  19. kostkar commented on Oct 11, 2016

    @kostkar

    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.

  20. paan2097 commented on Oct 11, 2016

    @paan2097

    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?

  21. lidia-toscano commented on Oct 11, 2016

    @lidia-toscano

    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:

    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)
    setup.py build install

    Hope it helps.

    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    #610 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/ASyBSXH81XyrRm-eUobfMjNqleF3MqnKks5qy976gaJpZM4H-mq6
    .

  22. lidia-toscano commented on Oct 11, 2016

    @lidia-toscano

    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

    On Tue, Oct 11, 2016 at 3:09 PM, kostkar notifications@github.com wrote:

    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)
    setup.py build install

    Hope it helps.

    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    #610 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/ASyBSXH81XyrRm-eUobfMjNqleF3MqnKks5qy976gaJpZM4H-mq6
    .

  23. peterbarker commented on Oct 11, 2016

    @peterbarker
    Contributor
  24. lidia-toscano commented on Oct 12, 2016

    @lidia-toscano

    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:

    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.

    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    #610 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/ASyBSVD_oMwrnO_82eAHPodrPs7E-9RDks5qzBBCgaJpZM4H-mq6
    .

  25. patrickpoirier51 commented on Oct 23, 2016

    @patrickpoirier51

    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 :-)

  26. paan2097 commented on Oct 24, 2016

    @paan2097

    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.

  27. MAVProxyUser commented on Oct 24, 2016

    @MAVProxyUser

    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...

  28. peterbarker commented on Oct 24, 2016

    @peterbarker
    Contributor

    @lidia-toscano There is an argument in what I wrote :-) pip install -r requirements.txt

  29. peterbarker commented on Oct 24, 2016

    @peterbarker
    Contributor

    @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?

  30. peterbarker commented on Oct 24, 2016

    @peterbarker
    Contributor

    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:

    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.

    If getting the version like this:

    >>> import pkg_resources
    >>> pkg_resources.get_distribution('dronekit').version
    '2.9.0'
    >>> 
    

    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" :-)

  31. patrickpoirier51 commented on Oct 24, 2016

    @patrickpoirier51

    Thanks for the follow-up,
    as requested I opened : Exception in message handler for HEARTBEAT mode 0 not available on mavlink definition #677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions