Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SITL test is failing: copter mode stuck on STABILIZE #1041

Open
pietrodn opened this issue Jul 4, 2020 · 23 comments
Open

SITL test is failing: copter mode stuck on STABILIZE #1041

pietrodn opened this issue Jul 4, 2020 · 23 comments

Comments

@pietrodn
Copy link
Contributor

pietrodn commented Jul 4, 2020

The SITL tests are currently failing on the master branch, both for Python 2 and Python 3.
The cause is a SITL test that's not passing: test_goto.py.

The apparent reason of the error is that the test times out when setting the mode to GUIDED.
I managed to run the unit test locally, and I can't get the SITL to switch to GUIDED: the vehicle remains stuck on STABILIZE. The GPS and the global location seem to be ok. The Vehicle is periodically receiving heartbeat updates containing the mode flag, so it's not a reception problem.

My hypothesis is that some update on the ArduPilot side, or in some dependencies, made the tests fail. From the commit history it's easy to see that the previous commits (that worked) are identical to the latest ones, which were simple documentation changes.

Any hints?

@pietrodn
Copy link
Contributor Author

pietrodn commented Jul 4, 2020

The problem is in pymavlink. The latest passing tests use pymavlink 2.4.0, and with that version the test still passes.
I ran a bisect and pymavlink is OK until 2.4.8: the 2.4.9 release broke something.

@pietrodn
Copy link
Contributor Author

pietrodn commented Jul 4, 2020

Found the problematic commit: ArduPilot/pymavlink@1fa59ff

@peterbarker
Copy link
Contributor

peterbarker commented Jul 4, 2020 via email

@pietrodn
Copy link
Contributor Author

pietrodn commented Jul 5, 2020

By default dronekit-sitl runs ArduPilot Copter v3.3. Probably it’s better to test against an updated firmware version as you said 👍

@peterbarker
Copy link
Contributor

peterbarker commented Jul 6, 2020 via email

@rmccarth
Copy link

rmccarth commented Jul 20, 2020

Hi, in the meantime should we revert to using 2.9.1? (I noticed there's a 2 year gap on pypi)

Nevermind. I was able to uninstall pymavlink with

pip3 uninstall pymavlink

and then reinstall the older version with

pip3 install pymavlink==2.4.8

@sanky1234
Copy link

Hi, in the meantime should we revert to using 2.9.1? (I noticed there's a 2 year gap on pypi)

Nevermind. I was able to uninstall pymavlink with

pip3 uninstall pymavlink

and then reinstall the older version with

pip3 install pymavlink==2.4.8

Did this work for you by just reinstalling an old version of pymavlink? It wasn’t working for me.

@rmccarth
Copy link

Hi, in the meantime should we revert to using 2.9.1? (I noticed there's a 2 year gap on pypi)
Nevermind. I was able to uninstall pymavlink with

pip3 uninstall pymavlink

and then reinstall the older version with

pip3 install pymavlink==2.4.8

Did this work for you by just reinstalling an old version of pymavlink? It wasn’t working for me.

Yeah reverting pymavlink to 2.4.8 did the trick for me. If you are having trouble in general I would suggest running the dronekit-python/examples/vehicle_state/vehicle_state.py to check if there is a bug in your code.

@punkypankaj
Copy link

Hi, in the meantime should we revert to using 2.9.1? (I noticed there's a 2 year gap on pypi)
Nevermind. I was able to uninstall pymavlink with

pip3 uninstall pymavlink

and then reinstall the older version with

pip3 install pymavlink==2.4.8

Did this work for you by just reinstalling an old version of pymavlink? It wasn’t working for me.

Yeah reverting pymavlink to 2.4.8 did the trick for me. If you are having trouble in general I would suggest running the dronekit-python/examples/vehicle_state/vehicle_state.py to check if there is a bug in your code.

yes this reverting back to older version of pymavlink worked for me, i was having trouble in DO_SET_MODE change while executing the python script as it was stuck at stabalize, even now i can't change the mode in mavproxy but it works when i run the script

i was having pymavlink 2.4.12 and
reverted back to pymavkink 2.4.8
for now at least im able to run the script and need to find the issue with mavproxy

@walchko
Copy link

walchko commented Jan 9, 2021

pymavlink 2.4.14 is junk also ... reverting to 2.4.8 fixed it

@danammeansbear
Copy link

the fix doesnt work at this point, just ends up spitting a bunch of horse crap on my screen.

@danammeansbear
Copy link

'''

AttributeError: 'MAVLink_vibration_message' object has no attribute 'instance_field'
ERROR:dronekit.mavlink:Exception in MAVLink input loop
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\dronekit\mavlink.py", line 211, in mavlink_thread_in
fn(self)
File "C:\ProgramData\Anaconda3\lib\site-packages\dronekit_init
.py", line 1370, in listener
raise APIException('No heartbeat in %s seconds, aborting.' %
dronekit.APIException: No heartbeat in 30 seconds, aborting.
ERROR:dronekit.mavlink:Exception while receiving message:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\dronekit\mavlink.py", line 218, in mavlink_thread_in
msg = self.master.recv_msg()
File "C:\ProgramData\Anaconda3\lib\site-packages\pymavlink\mavutil.py", line 456, in recv_msg
return None
File "C:\ProgramData\Anaconda3\lib\site-packages\pymavlink\mavutil.py", line 372, in post_message
File "C:\ProgramData\Anaconda3\lib\site-packages\pymavlink\mavutil.py", line 83, in add_message
'''
AttributeError: 'MAVLink_heartbeat_message' object has no attribute '_instance_field'
ERROR:dronekit.mavlink:Exception while receiving message:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\dronekit\mavlink.py", line 218, in mavlink_thread_in
msg = self.master.recv_msg()
File "C:\ProgramData\Anaconda3\lib\site-packages\pymavlink\mavutil.py", line 456, in recv_msg
return None
File "C:\ProgramData\Anaconda3\lib\site-packages\pymavlink\mavutil.py", line 372, in post_message
File "C:\ProgramData\Anaconda3\lib\site-packages\pymavlink\mavutil.py", line 83, in add_message
'''
AttributeError: 'MAVLink_heartbeat_message' object has no attribute 'instance_field'
ERROR:dronekit.mavlink:Exception in MAVLink input loop
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\dronekit\mavlink.py", line 211, in mavlink_thread_in
fn(self)
File "C:\ProgramData\Anaconda3\lib\site-packages\dronekit_init
.py", line 1370, in listener
raise APIException('No heartbeat in %s seconds, aborting.' %
dronekit.APIException: No heartbeat in 30 seconds, aborting.

@Mettikodeva
Copy link

By default dronekit-sitl runs ArduPilot Copter v3.3. Probably it’s better to test against an updated firmware version as you said 👍

how to run dronekit-sitl with updated firmware version?
thanks

@SarinleFreeman
Copy link

SarinleFreeman commented Nov 14, 2022

Downgrading pymavlink didn't work for me on windows 11 as per #1169. It gave me the following error message:

`AttributeError: 'array.array' object has no attribute 'fromstring'

`

One fix is utilizing Ubuntu on your windows system. After setting up Ubuntu i downgraded pymavlink to 2.4.8 and mav_proxy to 1.7.1

sudo pip uninstall mavproxy
sudo pip install pymavlink==2.4.8
sudo pip install mavproxy==1.7.1

I will continue my analysis on #1169 and see if i can find a solution for windows.

@Xarbenence
Copy link

I've been experiencing the same issue of telling my SITL to enter GUIDED mode, but it gets stuck in the loop waiting for the mode to change. I tried to downgrade to pymavlink==2.4.8, but I'm getting a legacy-install-failure. Has anyone experienced this?
I'm on a Mac with an M1 chip, if that helps. I've also noticed that downgrading about anything via pip usually ends in an error, but not necessarily the same error.

alexsharper@dhcp-10-105-11-95 ~ % sudo pip3 install pymavlink==2.4.8
WARNING: The directory '/Users/alexsharper/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at Homebrew/homebrew-core#76621
Collecting pymavlink==2.4.8
Downloading pymavlink-2.4.8.tar.gz (3.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.6/3.6 MB 28.4 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Requirement already satisfied: future in /opt/homebrew/lib/python3.9/site-packages (from pymavlink==2.4.8) (0.18.3)
Requirement already satisfied: lxml in /opt/homebrew/lib/python3.9/site-packages (from pymavlink==2.4.8) (4.9.2)
Building wheels for collected packages: pymavlink
Building wheel for pymavlink (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1

╰─> [54 lines of output]
running bdist_wheel
running build
running build_py
Using message definitions from /private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/message_definitions
Building /private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/message_definitions/v1.0/python_array_test.xml for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be performed
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/setup.py", line 109, in
setup (name = 'pymavlink',
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/init.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup
return run_commands(dist)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
dist.run_commands()
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
self.run_command(cmd)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/dist.py", line 1229, in run_command
super().run_command(command)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/opt/homebrew/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/dist.py", line 1229, in run_command
super().run_command(command)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 136, in run
self.run_command(cmd_name)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/dist.py", line 1229, in run_command
super().run_command(command)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/setup.py", line 103, in run
generate_content()
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/setup.py", line 64, in generate_content
if not mavgen.mavgen_python_dialect(dialect, mavparse.PROTOCOL_1_0):
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/generator/mavgen.py", line 247, in mavgen_python_dialect
if not mavgen(opts, [xml]):
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/generator/mavgen.py", line 142, in mavgen
xml.append(mavparse.MAVXML(fname, opts.wire_protocol))
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/generator/mavparse.py", line 420, in init
m.crc_extra = message_checksum(m)
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/generator/mavparse.py", line 447, in message_checksum
crc.accumulate_str(msg.name + ' ')
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/generator/mavcrc.py", line 34, in accumulate_str
bytes.fromstring(buf)
AttributeError: 'array.array' object has no attribute 'fromstring'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pymavlink
Running setup.py clean for pymavlink
Failed to build pymavlink
Installing collected packages: pymavlink
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at Homebrew/homebrew-core#76621
Running setup.py install for pymavlink ... error
error: subprocess-exited-with-error

× Running setup.py install for pymavlink did not run successfully.
│ exit code: 1
╰─> [58 lines of output]
running install
/opt/homebrew/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
Using message definitions from /private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/message_definitions
Building /private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/message_definitions/v1.0/python_array_test.xml for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be performed
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/setup.py", line 109, in
setup (name = 'pymavlink',
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/init.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup
return run_commands(dist)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
dist.run_commands()
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
self.run_command(cmd)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/dist.py", line 1229, in run_command
super().run_command(command)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/command/install.py", line 68, in run
return orig.install.run(self)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/command/install.py", line 670, in run
self.run_command('build')
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/dist.py", line 1229, in run_command
super().run_command(command)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 136, in run
self.run_command(cmd_name)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/dist.py", line 1229, in run_command
super().run_command(command)
File "/opt/homebrew/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/setup.py", line 103, in run
generate_content()
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/setup.py", line 64, in generate_content
if not mavgen.mavgen_python_dialect(dialect, mavparse.PROTOCOL_1_0):
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/generator/mavgen.py", line 247, in mavgen_python_dialect
if not mavgen(opts, [xml]):
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/generator/mavgen.py", line 142, in mavgen
xml.append(mavparse.MAVXML(fname, opts.wire_protocol))
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/generator/mavparse.py", line 420, in init
m.crc_extra = message_checksum(m)
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/generator/mavparse.py", line 447, in message_checksum
crc.accumulate_str(msg.name + ' ')
File "/private/tmp/pip-install-qkyxr4il/pymavlink_7b139926334f4849b671942012c96389/generator/mavcrc.py", line 34, in accumulate_str
bytes.fromstring(buf)
AttributeError: 'array.array' object has no attribute 'fromstring'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pymavlink

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

@Miles5177
Copy link

Have you been able to find a solution to this? thank you!

@mujtabafromthedarkside
Copy link

I am also getting the same as above legacy-install-failure as above with Python3. I am on Windows 10. The installation works fine for python2.

@danammeansbear
Copy link

danammeansbear commented Apr 5, 2023 via email

@SarinleFreeman
Copy link

i am having trouble on multiple systems. cant seem to figure out how to get it to work on ubuntu or my local windows machine which had it working a year ago but now its caput and im tooo scared to test it on my drone because i need to demo it for my senior project. Adam Dabdoub Software Developer c: 513.886.0301

On Tue, Apr 4, 2023 at 6:55 PM Mujtaba @.> wrote: I am also getting the same as above legacy-install-failure as above with Python3. I am on Windows 10. The installation works fine for python2. — Reply to this email directly, view it on GitHub <#1041 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHJKTGIN2VUEMMXXCISAJGTW7SRHJANCNFSM4OQPXHGA . You are receiving this because you commented.Message ID: @.>

It works on Ubuntu for me, perhaps set up an associated Docker Image which uses Ubuntu and run your code on there?

Otherwise I can set up one and I'll link it in this chat.

@danammeansbear
Copy link

danammeansbear commented Apr 5, 2023 via email

@Atigit15
Copy link

Atigit15 commented Apr 6, 2023

The installation works fine for python2

Can you tell me how to install the desired version of pymavlink for python2, since pip is no longer supported for python2. Thank you !

@wangcongai
Copy link

After pymavlink version==2.4.8, the set_mode_apm function in pymavlik.mavutil.py changed, which cause failure on ardupilot MODE CHANGE.
In order to use new version like pymavlink version==2.4.41, you just need to comment the code on "mav.command_long_send" and change it back to old "mav.set_mode_send". Reboot your IDE, Then the problem solved!
image

@mujtabafromthedarkside
Copy link

After pymavlink version==2.4.8, the set_mode_apm function in pymavlik.mavutil.py changed, which cause failure on ardupilot MODE CHANGE. In order to use new version like pymavlink version==2.4.41, you just need to comment the code on "mav.command_long_send" and change it back to old "mav.set_mode_send". Reboot your IDE, Then the problem solved! image

Yeah, that works. I guess, this is a good way to make it run on latest python versions that do not support pymavlink version 2.4.8

Previously, I used to use either python 3.6 or python 2.7 which were compatible with pymavlink==2.4.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests