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

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

Open

Description

@patrickpoirier51

Hello

Using dronekit 2.9.0 (confirmed within python)

I am running a simple test from my OdroidXU4 on ubuntu 14.04
MINIMAL_TEST.py
from dronekit import connect
import time
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
I do have error message when connecting to WINDOWS Mission Planner using mavproxy --master tcp:host.windows.host.pc:5763 --out udp:127.0.0.1:14550 on the Odroid and connecting dronekit with @0.0.0.1:14550

Please let me know if you require additional tests

Activity

  1. peterbarker commented on Oct 24, 2016

    @peterbarker
    Contributor

    Please attach the telemetry log created by MAVProxy (mav.tlog).

    Because you're seeing this in both MAVProxy and dronekit-python, the problem doesn't lie in dronekit-python; possibly in pymavlink, a common root for both projects. Also possibly in Mission Planner. Let's find out.

  2. patrickpoirier51 commented on Oct 24, 2016

    @patrickpoirier51
    Author

    Here is the file, let me know if you require longer-shorter-other test

    mav.tlog.zip

  3. peterbarker commented on Oct 24, 2016

    @peterbarker
    Contributor

    This is the error message that's currently being seen:

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

    OK, I think @fnoop nailed this on #610.

    pbarker@bluebottle:/tmp/fred$ mavlogdump.py mav.tlog  --t HEARTBEAT --show-source
    2016-10-25 09:39:02.64: HEARTBEAT {type : 6, autopilot : 8, base_mode : 0, custom_mode : 0, system_status : 0, mavlink_version : 3} srcSystem=255 srcComponent=0
    2016-10-25 09:39:02.66: HEARTBEAT {type : 2, autopilot : 3, base_mode : 81, custom_mode : 0, system_status : 3, mavlink_version : 3} srcSystem=1 srcComponent=1
    2016-10-25 09:39:02.71: HEARTBEAT {type : 2, autopilot : 3, base_mode : 81, custom_mode : 0, system_status : 3, mavlink_version : 3} srcSystem=1 srcComponent=1
    2016-10-25 09:39:03.31: HEARTBEAT {type : 6, autopilot : 8, base_mode : 0, custom_mode : 0, system_status : 0, mavlink_version : 3} srcSystem=255 srcComponent=190
    2016-10-25 09:39:03.48: HEARTBEAT {type : 6, autopilot : 8, base_mode : 0, custom_mode : 0, system_status : 0, mavlink_version : 3} srcSystem=255 srcComponent=0
    2016-10-25 09:39:03.72: HEARTBEAT {type : 2, autopilot : 3, base_mode : 81, custom_mode : 0, system_status : 3, mavlink_version : 3} srcSystem=1 srcComponent=1
    

    As you can see, heartbeat packets are coming both from the vehicle (srcSystem=1) and from the ground control station (srcSystem=255).

    dronekit-python sees heartbeats from every source, and fails to map the Ground Control Station's current mode number to a mode string.

    This is a problem with pymavlink - it doesn't let you lock onto a specific vehicle for input.

    As also mentioned on the other ticket, I do have a solution for this situation, but I haven't managed to convince tridge of the concept. You can have a look at the "avoidance" example (https://github.com/peterbarker/dronekit-python/tree/source-system-filtering/examples/avoidance) to see how you can use dronekit-python with multiple srcSystems floating around.

    Another option you might have is to connect dronekit-python to the vehicle and then connect the ground control station to dronekit-python; the avoidance example referenced allows you to do that so you can visualise the avoidance behaviour.

  4. patrickpoirier51 commented on Oct 25, 2016

    @patrickpoirier51
    Author

    I see, but why don't we have the same pattern when connecting to sitl on Ubuntu ?
    Here a log file of the same test done on SITL
    mav.tlog.zip

  5. peterbarker commented on Oct 25, 2016

    @peterbarker
    Contributor

    Port 14550 is an output port for MAVProxy when running as SITL. It only forwards packets from its masters there - it doesn't send its own packets there. If you change the second MAVProxy's system id to something other than 255, then look at its mav.tlog after connecting it to SITL, you will see that the SITL's MAVProxy's system-id won't appear next to a heartbeat.

  6. patrickpoirier51 commented on Oct 25, 2016

    @patrickpoirier51
    Author

    Well , in that case I will experiment with your "avoidance" example and hopefully you will convince tridge to implement your solution :-)

    Thanks for your help on this and we can consider this issue as an additionnal use case to expose the problem or you can close it if not.

  7. paan2097 commented on Oct 25, 2016

    @paan2097

    @peterbarker Is there proof that this error actually affects how the code runs? I get the error and is very annoying for reading print statements but at visual inspection, the vehicle seems to perform the same connected to MP or not.

  8. patrickpoirier51 commented on Oct 25, 2016

    @patrickpoirier51
    Author

    I will check on this. My week-end project was to read joystick from mission planner, map it to channels 6-8 and send it over to my on-board Odroid XU4 companion computer so it is controlling a 3 axis servo PTZ platform using pololu maestro. It is working fine with SITL, I will compare with MP to see if it is as smooth (and not jerking because of the error handling). Please take note that I added --streamrate=20 on SITL so I can get full 20 Hertz data stream.

  9. peterbarker commented on Oct 25, 2016

    @peterbarker
    Contributor
  10. patrickpoirier51 commented on Oct 25, 2016

    @patrickpoirier51
    Author

    LOL , I modified this comment and removed the MP request , and apparently github sent you the unmodified message. :-).
    BTW I noticed that the MP simulator calls a shell running SITL, I will try to ''tweek'' this one to export a master at 14550. I'll keep you updated.

  11. patrickpoirier51 commented on Oct 25, 2016

    @patrickpoirier51
    Author

    @peterbarker looking at MP- SITL, is is using sim_vehicle.py (2.7.10)
    It shows:
    Framework to start a simulated vehicle and connect it to MAVProxy.
    Peter Barker, April 2016
    based on sim_vehicle.sh by Andrew Tridgell, October 2011

    So I presume that you know pretty much the code....

    On line 57, we can read: print("--mavproxy-args not permitted in compat mode")
    Does it mean we cannot pass arguments like --out udp:my.odroid.xu.4:14550 ?

    I know it may get a little off topic by it relates to the same developper

  12. fnoop commented on Oct 25, 2016

    @fnoop
    Contributor

    @patrickpoirier51 yup just use -m "--out=udp:my.odroid.xu.4:14550" and don't use -C option.

  13. peterbarker commented on Oct 25, 2016

    @peterbarker
    Contributor

    @patrickpoirier51 sim_vehicle.py has a "compatability" mode enabled by "-C". You can't use that and --mavproxy-args at the same time. -C is evil, don't use it :-)

  14. patrickpoirier51 commented on Oct 25, 2016

    @patrickpoirier51
    Author

    OK I'll make sure Scooby-Doo dont step on it ;-)

    @paan2097 you are right, considering the specific setup I am working on:
    Joystick-MP(SITL)- TCP - Dronekit- Pololu - Servos ,
    I have no necessity for fast response and bidirectionnal control , so the error message is more an annoyance than a limitation.

    So Thanks you all for the support, I will keep an eye on future developments on the pymavlink option to choose a specific ID for input & control

  15. paan2097 commented on Dec 5, 2016

    @paan2097

    @patrickpoirier51 @peterbarker
    Made it out into the field and this issue caused me problems. My drones were flying great being controlled by raspberry pi CC but stopped working when we connected to Mission Planner. I'm having problems getting the avoidance example to work because dronekit-sitl is troublesome so I usually use a MAVProxy sim_vehicle.py SITL and connect to that. Any chance this issue is being solved or should I further investigate the avoidance example?

  16. 14 remaining items

  17. blakethompson82 commented on Nov 26, 2018

    @blakethompson82

    How did you set ports for both the program and Mission Planner? I am new to this and I have already updated dronekit, pymavlink, and everything else mentioned in this thread with no luck.

  18. hamishwillee commented on Nov 26, 2018

    @hamishwillee
    Contributor

    @blakethompson82 Read the guide http://python.dronekit.io/develop/sitl_setup.html - at the end it shows how to set an additional port for a GCS

  19. maciek01 commented on Nov 17, 2019

    @maciek01

    so what's the fix ? i just connected my code (which works great with matek f765 wing 4.0.0rc1) to CUbe Orange (4.0.0rc2)
    and cant past this error.

    this is raspi talking directly to FC via /dev/serial0

    here is my config:

    sudo apt-get install git python-pip python-dev screen python-wxgtk2.8 python-matplotlib python-opencv python-numpy libxml2-dev libxslt-dev ppp elinks python3-lxml python-lxml dnsutils cu sqlite3 python-pysqlite2 -y

    sudo pip install --upgrade future
    sudo pip install --upgrade httplib2
    sudo pip install --upgrade pyserial
    sudo pip2 install --upgrade dronekit

  20. tizianofiorenzani commented on Nov 19, 2019

    @tizianofiorenzani
  21. maciek01 commented on Nov 19, 2019

    @maciek01

    a bit excessive for a python library :)

    different form of the same:ERROR:dronekit:Exception in message handler for HEARTBEAT
    Traceback (most recent call last):
    File "build/bdist.linux-armv7l/egg/dronekit/init.py", line 1527, in notify_message_listeners
    fn(self, name, msg)
    File "build/bdist.linux-armv7l/egg/dronekit/init.py", line 1219, in listener
    raise APIException("mode (%s, %s) not available on mavlink definition" % (m.custom_mode, m.base_mode))
    APIException: mode (0, 4) not available on mavlink definition

  22. Th3OnlyN00b commented on Feb 27, 2020

    @Th3OnlyN00b

    Is this still required, building from source?

  23. maciek01 commented on Feb 27, 2020

    @maciek01

    Is this still required, building from source?

    for me it is the only way to get it to installed successfully if i want to stay on the latest dependencies.
    i have no time or patience to experiment - so for me the full build is the path of least resistance

  24. Th3OnlyN00b commented on Feb 27, 2020

    @Th3OnlyN00b

    Thanks for the fast reply!

  25. bduva002 commented on Apr 24, 2020

    @bduva002

    @maciek01 i am getting the same error as you. I built from source following this documentation.

    https://dronekit-python.readthedocs.io/en/latest/contributing/developer_setup_linux.html
    Is this what you did to fix this error?

    looks like when I built from source i got
    pymavlink 2.4.8
    dronekit 2.9.2

    ERROR:dronekit:Exception in message handler for HEARTBEAT
    Traceback (most recent call last):
    File "build/bdist.linux-armv7l/egg/dronekit/init.py", line 1527, in notify_message_listeners
    fn(self, name, msg)
    File "build/bdist.linux-armv7l/egg/dronekit/init.py", line 1219, in listener
    raise APIException("mode (%s, %s) not available on mavlink definition" % (m.custom_mode, m.base_mode))
    APIException: mode (0, 4) not available on mavlink definition

  26. Th3OnlyN00b commented on Apr 24, 2020

    @Th3OnlyN00b

    Yes, building from source worked for me.

  27. bduva002 commented on Apr 24, 2020

    @bduva002

    Okay so I found were the error is coming from in the code. It when the code checks to see if a mode is available.
    here is the line:

    if self._is_mode_available(m.custom_mode, m.base_mode) is False:

    what I don't understand is when we go to the is_mode_available def. If I am running arduplane wont this function always return false and the mode not available message keep coming back?

    image

    I am using Arduplane 4.0.X, dronekit used to work before on older version of arduplane.

  28. bduva002 commented on Apr 24, 2020

    @bduva002

    @Th3OnlyN00b thanks for a reply. What version of ardupilot are you using?
    Is it 4..0.0 or newer?
    Are you using a cube orange?

    Yes, building from source worked for me.

    When you built from source did you follow the the instructions in this link?
    https://dronekit-python.readthedocs.io/en/latest/contributing/developer_setup_linux.html

  29. ZacharyLowell commented on May 5, 2021

    @ZacharyLowell

    Has there happen to be any update on this thread? I am currently building dronekit from source and connecting to a cude orange (running ardupilot 4.0.7) to raspi4 communicating via serial to telem2 port and am getting the same error as @bduva002 above. Any help would be great.

  30. CodingGhost commented on Apr 29, 2022

    @CodingGhost

    Im in the same boat

  31. xianglic commented on Jan 15, 2025

    @xianglic

    what does mode(custom_mode, base_mode) represent? if it is mode(0, 4) then, how do we find the mapping to retrieve its semantic meaning? and how does the added ADBS board relates to these two modes?

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