dronekit / dronekit-python

DroneKit-Python library for communicating with Drones via MAVLink.
https://readthedocs.org/projects/dronekit-python/
Apache License 2.0
1.52k stars 1.43k forks source link

Sitl Taking off dronekit python example give arming errors #1083

Open Nilasstohr opened 3 years ago

Nilasstohr commented 3 years ago

Hi Guys,

I wanted to try the dronekit-sitl before running dronekit on my real quadcopter. So I installed dronekit and drone-sitl on ubuntu 20.04.1 LTS, by following the guide: _https://dronekit-python.readthedocs.io/en/latest/guide/quick_start.html_

Then i did the following:

  1. Started dronekit-sitl the from terminal by the command "dronkit-sitl copter"
  2. I then ran Taking off python example from _https://dronekit-python.readthedocs.io/en/latest/guide/taking_off.html_ using python3

The output of taking off dronekit python example is: CRITICAL:autopilot:APM:Copter V3.3 (d6053245) CRITICAL:autopilot:Frame: QUAD CRITICAL:autopilot:Calibrating barometer CRITICAL:autopilot:Initialising APM... CRITICAL:autopilot:barometer calibration complete CRITICAL:autopilot:GROUND START Basic pre-arm checks Waiting for vehicle to initialise... Waiting for vehicle to initialise... Waiting for vehicle to initialise... Waiting for vehicle to initialise... Waiting for vehicle to initialise... Arming motors Waiting for arming... Waiting for arming... Waiting for arming... Waiting for arming... ERROR:autopilot:ARMING MOTORS CRITICAL:autopilot:GROUND START Waiting for arming... WARNING:dronekit:Link timeout, no heartbeat in last 5 seconds CRITICAL:autopilot:Initialising APM... Taking off! Altitude: 0.0 Altitude: 0.0 Altitude: 0.0 Altitude: 0.0 Altitude: 0.0 Altitude: 0.01 Altitude: 0.02 Altitude: 0.02 Altitude: 0.03 ERROR:autopilot:DISARMING MOTORS Altitude: 0.03 Altitude: 0.01 Altitude: 0.0 Altitude: 0.0

From the output it seems like the first 5 lines are stated as critical for some reason dont know if it matters. It then manage to pass the pre-arm checks and starting arming unstill the ERROR:autopilot:ARMING MOTORS is returned. It then manage to arm anyway and takeoff until the it disarm after 10 second.

I ran the example multiple times and disarming always occurs after 10 seconds.

what is going on here? does the sitl and taking off example works out of the box or do I need to do something else? looking forward to hear from you guys.

br.

Nilasstohr commented 3 years ago

Additional version info dronekit version: 2.9.2 dronekit sitl version: copter-3.3

Nilasstohr commented 3 years ago

just discovered the issue below: https://github.com/dronekit/dronekit-python/issues/1066 seem like several problem experience, do the developer have a solution?

Nilasstohr commented 3 years ago

1066 solutions suggestion did not solve the problem for me.

Nilasstohr commented 3 years ago

I just tried to run the taking off example on my real quad, it does not there either. @peterbarker can you please provide us with info of what to do? I saw that the last response was back in juli, can we expert a new release soon? Or is there a workaround. It seem like we cant use dronekit for much without the ability to change to guided/auto mode.

Nilasstohr commented 3 years ago

Ok, so i think my problem was that dronekit was not pointing to the correct version of pymavlink after i downgraded to pymavlink 2.4.8 so fix this. Now it seem to takeoff (though with severel errors as seem in log below)

So the fix here was as in #1066 to downgrade from pymavlink 2.4.12 to 2.4.8. (and make sure dronekit is using 2.4.8 not something else)

So " @peterbarker can you please provide us with info of progress? I saw that the last response was back in july, can we expert a new official update soon?"

Log output: CRITICAL:autopilot:APM:Copter V3.3 (d6053245) CRITICAL:autopilot:Frame: QUAD CRITICAL:autopilot:Calibrating barometer CRITICAL:autopilot:Initialising APM... CRITICAL:autopilot:barometer calibration complete CRITICAL:autopilot:GROUND START Basic pre-arm checks Waiting for vehicle to initialise... Waiting for vehicle to initialise... Waiting for vehicle to initialise... Waiting for vehicle to initialise... Waiting for vehicle to initialise... Arming motors Waiting for arming... Waiting for arming... Waiting for arming... Waiting for arming... ERROR:autopilot:ARMING MOTORS CRITICAL:autopilot:GROUND START Waiting for arming... WARNING:dronekit:Link timeout, no heartbeat in last 5 seconds CRITICAL:autopilot:Initialising APM... Waiting for arming... Taking off! VehicleMode:STABILIZE Altitude: 0.0 VehicleMode:GUIDED Altitude: 0.0 VehicleMode:GUIDED Altitude: 0.19 VehicleMode:GUIDED Altitude: 1.85 VehicleMode:GUIDED Altitude: 3.77 VehicleMode:GUIDED Altitude: 5.87 VehicleMode:GUIDED Altitude: 8.63 VehicleMode:GUIDED Altitude: 10.87 VehicleMode:GUIDED Altitude: 13.11 VehicleMode:GUIDED Altitude: 15.34 VehicleMode:GUIDED Altitude: 17.98 VehicleMode:GUIDED Altitude: 19.28 Reached target altitude WARNING:dronekit:Link timeout, no heartbeat in last 5 seconds ERROR:autopilot:DISARMING MOTORS

danammeansbear commented 3 years ago

How did you make sure it was pointing to the right version of pymavlink

Nilasstohr commented 3 years ago

Try the following (importance that you use sudo)

sudo apt-get install python-pip3 python-dev sudo pip3 install dronekit sudo pip3 install dronekit-sitl sudo pip3 uninstall pymavlink (this removes the new buggy version introduced from 2.4.9) sudo pip3 install pymavlink==2.4.8 sudo install spyder (or what you prefer)

from spyder open your script right click connect(...) function and choose "go to defination" it will jump into dronekit library function init.py find and then right click on the function MAVConnection(ip, baud=baud, source_system=source_system,...) and choose "go to definition" it will jump into the pymavlink.py file it uses. Now right on the pymavlink.py folder tab and choose in "show en extrnal file folder", then then go to disp-packages folder (to levels back) here you can locate your mavlink version used by dronekit something like pymavlink.py-2.4.8.dis-info

danammeansbear commented 3 years ago

Thank you so much!

Nilasstohr commented 3 years ago

You are welcome, hope it solved your problem :)

o-gent commented 3 years ago

I've seen this too. I use https://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html this method instead with WSL. You can then use arducopter 4.1 rather than 3.3 which isn't very representative at this point.

IsmailAyvaz commented 3 years ago

You are welcome, hope it solved your problem :)

Can you make a pull request for your fix ?

danammeansbear commented 3 years ago

Just want to add, I seeminly only run into this problem when I skip running the simple scripts before branching off other peoples and getting the system confused. Be patient and dont try and do something you arent ready for but also dont stop challenging yourself. its a slow build.

Git-Ilan commented 2 years ago

I happened to encounter this problem today when I was using pymavlink 2.4.16 along with python 3.9. I did as said and downgraded pymavlink to version 2.4.8, but it did not work with Python 3.7 (and above). I had to use Python 3.6 to install it successfully. I write this down in case another one will run into the same problem as me.

prithvi2k2 commented 1 year ago

I happened to encounter this problem today when I was using pymavlink 2.4.16 along with python 3.9. I did as said and downgraded pymavlink to version 2.4.8, but it did not work with Python 3.7 (and above). I had to use Python 3.6 to install it successfully. I write this down in case another one will run into the same problem as me.

I tested @Git-Ilan 's suggestion and can confirm it works, I downgraded to python 3.6 from 3.9 and also downgraded pymavlink to version 2.4.8 -- It worked; Still hope that dronekit will support python 3 officially anytime later. Also, I didn't do any rigorous testing, I just tried to takeoff dronekit-sitl's sim, it worked.

ItayShiff commented 9 months ago

Any update on this?

Usbasuthkar commented 9 months ago

C:\Users\hp>pip install pymavlink==2.4.8 Collecting pymavlink==2.4.8 Using cached pymavlink-2.4.8.tar.gz (3.6 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: future in c:\users\hp\appdata\local\programs\python\python311\lib\site-packages (from pymavlink==2.4.8) (0.18.3) Requirement already satisfied: lxml in c:\users\hp\appdata\local\programs\python\python311\lib\site-packages (from pymavlink==2.4.8) (4.9.3) Building wheels for collected packages: pymavlink Building wheel for pymavlink (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for pymavlink (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [75 lines of output] ################################### Skipping mavnative ################################### running bdist_wheel running build running build_py WARNING: Failed to import lxml module etree. Are lxml, libxml2 and libxslt installed? XML validation will not be performed Using message definitions from C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\message_definitions Building C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\message_definitions\v1.0\ardupilotmega.xml for protocol 1.0 Traceback (most recent call last): File "C:\Users\hp\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "C:\Users\hp\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 251, in build_wheel return _build_backend().build_wheel(wheel_directory, config_settings, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\build_meta.py", line 434, in build_wheel return self._build_with_temp_dir( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\build_meta.py", line 419, in _build_with_temp_dir self.run_setup() File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup exec(code, locals()) File "", line 109, in File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools__init__.py", line 103, in setup return distutils.core.setup(attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\core.py", line 185, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\core.py", line 201, in run_commands dist.run_commands() File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 969, in run_commands self.run_command(cmd) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command super().run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 364, in run self.run_command("build") File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command super().run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\command\build.py", line 131, in run self.run_command(cmd_name) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command super().run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "", line 103, in run File "", line 64, in generate_content File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\generator\mavgen.py", line 247, in mavgen_python_dialect if not mavgen(opts, [xml]): ^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\generator\mavgen.py", line 142, in mavgen xml.append(mavparse.MAVXML(fname, opts.wire_protocol)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\generator\mavparse.py", line 420, in init m.crc_extra = message_checksum(m) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\generator\mavparse.py", line 447, in message_checksum crc.accumulate_str(msg.name + ' ') File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\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 Failed to build pymavlink ERROR: Could not build wheels for pymavlink, which is required to install pyproject.toml-based projects

when I tried installing pymavlink==2.4.8, this was the error I got, any comments or suggestion to resolve this, I am using latest version of python

danammeansbear commented 9 months ago

you will need to create a specific python ENV for your development. This can be done using anaconda or this can be done using docker. once you have the correct version of python installed you should be able to follow the steps previously listed and get working!

Adam Dabdoub Software Developer c: 513.886.0301

On Fri, Sep 29, 2023 at 8:32 AM Ujwal Basuthkar @.***> wrote:

C:\Users\hp>pip install pymavlink==2.4.8 Collecting pymavlink==2.4.8 Using cached pymavlink-2.4.8.tar.gz (3.6 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: future in c:\users\hp\appdata\local\programs\python\python311\lib\site-packages (from pymavlink==2.4.8) (0.18.3) Requirement already satisfied: lxml in c:\users\hp\appdata\local\programs\python\python311\lib\site-packages (from pymavlink==2.4.8) (4.9.3) Building wheels for collected packages: pymavlink Building wheel for pymavlink (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for pymavlink (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [75 lines of output] ################################### Skipping mavnative ################################### running bdist_wheel running build running build_py WARNING: Failed to import lxml module etree. Are lxml, libxml2 and libxslt installed? XML validation will not be performed Using message definitions from C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\message_definitions Building C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\message_definitions\v1.0\ardupilotmega.xml for protocol 1.0 Traceback (most recent call last): File "C:\Users\hp\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "C:\Users\hp\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 251, in build_wheel return _build_backend().build_wheel(wheel_directory, config_settings, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\build_meta.py", line 434, in build_wheel return self._build_with_temp_dir( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\build_meta.py", line 419, in _build_with_temp_dir self.run_setup() File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup super(

BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup exec(code, locals()) File "", line 109, in File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_init.py", line 103, in setup return distutils.core.setup(*attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\core.py", line 185, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\core.py", line 201, in run_commands dist.run_commands() File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 969, in run_commands self.run_command(cmd) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command super().run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 364, in run self.run_command("build") File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command super().run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\command\build.py", line 131, in run self.run_command(cmd_name) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command super().run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "", line 103, in run File "", line 64, in generate_content File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\generator\mavgen.py", line 247, in mavgen_python_dialect if not mavgen(opts, [xml]): ^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\generator\mavgen.py", line 142, in mavgen xml.append(mavparse.MAVXML(fname, opts.wire_protocol)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\generator\mavparse.py", line 420, in init* m.crc_extra = message_checksum(m) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\generator\mavparse.py", line 447, in message_checksum crc.accumulate_str(msg.name + ' ') File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\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 Failed to build pymavlink ERROR: Could not build wheels for pymavlink, which is required to install pyproject.toml-based projects

when I tried installing pymavlink==2.4.8, this was the error I got, any comments or suggestion to resolve this, I am using latest version of python

— Reply to this email directly, view it on GitHub https://github.com/dronekit/dronekit-python/issues/1083#issuecomment-1740818330, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHJKTGJE2XZZOK3QJGBPJEDX425WFANCNFSM4VEALZSA . You are receiving this because you commented.Message ID: @.***>

prithvi2k2 commented 9 months ago

@ItayShiff I don't think so it's a problem from dronekit... Please read this for further understanding - https://github.com/dronekit/dronekit-python/issues/484#issuecomment-377809030

Afaik, it's the pymavlink breaking dronekit when I tested it on windows(don't know about other platforms) back then, i don't exactly know what's the situation now.

What i did to fix was downgrading python version using PyLauncher and also installing lower version of pymavlink as I mentioned in previous comment.

I've also read somewhere that they aren't going to upgrade docs for python3, so maybe they aren't working on this. They still mention python 2.x in docs... https://dronekit-python.readthedocs.io/en/latest/develop/installation.html

prithvi2k2 commented 9 months ago

C:\Users\hp>pip install pymavlink==2.4.8 Collecting pymavlink==2.4.8 Using cached pymavlink-2.4.8.tar.gz (3.6 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: future in c:\users\hp\appdata\local\programs\python\python311\lib\site-packages (from pymavlink==2.4.8) (0.18.3) Requirement already satisfied: lxml in c:\users\hp\appdata\local\programs\python\python311\lib\site-packages (from pymavlink==2.4.8) (4.9.3) Building wheels for collected packages: pymavlink Building wheel for pymavlink (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for pymavlink (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [75 lines of output] ################################### Skipping mavnative ################################### running bdist_wheel running build running build_py WARNING: Failed to import lxml module etree. Are lxml, libxml2 and libxslt installed? XML validation will not be performed Using message definitions from C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\message_definitions Building C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\message_definitions\v1.0\ardupilotmega.xml for protocol 1.0 Traceback (most recent call last): File "C:\Users\hp\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "C:\Users\hp\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 251, in build_wheel return _build_backend().build_wheel(wheel_directory, config_settings, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\build_meta.py", line 434, in build_wheel return self._build_with_temp_dir( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\build_meta.py", line 419, in _build_with_temp_dir self.run_setup() File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup exec(code, locals()) File "", line 109, in File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools__init__.py", line 103, in setup return distutils.core.setup(attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\core.py", line 185, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\core.py", line 201, in run_commands dist.run_commands() File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 969, in run_commands self.run_command(cmd) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command super().run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 364, in run self.run_command("build") File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command super().run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\command\build.py", line 131, in run self.run_command(cmd_name) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools\dist.py", line 989, in run_command super().run_command(command) File "C:\Users\hp\AppData\Local\Temp\pip-build-env-gh_3ni4d\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "", line 103, in run File "", line 64, in generate_content File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\generator\mavgen.py", line 247, in mavgen_python_dialect if not mavgen(opts, [xml]): ^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\generator\mavgen.py", line 142, in mavgen xml.append(mavparse.MAVXML(fname, opts.wire_protocol)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\generator\mavparse.py", line 420, in init m.crc_extra = message_checksum(m) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\generator\mavparse.py", line 447, in message_checksum crc.accumulate_str(msg.name + ' ') File "C:\Users\hp\AppData\Local\Temp\pip-install-ln43nl_b\pymavlink_c1dbb76e397e410897ff00e34d003bb1\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 Failed to build pymavlink ERROR: Could not build wheels for pymavlink, which is required to install pyproject.toml-based projects

when I tried installing pymavlink==2.4.8, this was the error I got, any comments or suggestion to resolve this, I am using latest version of python

@Usbasuthkar What version of python are you on? If you're on windows, please try using PyLauncher and switch to Python 3.6 or lower as I mentioned before, install the same pymavlink==2.4.8 in <=py3.6 . It should hopefully work, I know this is a broken solution but there aren't any resolutions for this afaik, please let me know if there are any.

Usbasuthkar commented 9 months ago

Thanks a lot guys it worked, what I did was just reduced my python version to 2.7.18, pymavlink to 2.4.8, mavproxy to 1.8.22 and for trial I just used a python code from dronekit documentation.

viaSeunghyun commented 9 months ago

Looking at the release notes, it officially supports python 3.(after 2.9.1) However, I don't think it's supported for all versions. This is a problem that many python 2.7 based projects have when extending to python 3.

However, many Linux kernels are also adopting python3.x as the stable version of system python, so dronekit-python will have to change as well.

wangcongai commented 2 months ago

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