I am running a Mac M1. I followed the instructions on installing mavsdk. I get the following issue:
Traceback (most recent call last):
File "/Users/nm/PycharmProjects/MAVSDK-Python/examples/telemetry.py", line 4, in <module>
from mavsdk import System
File "/Users/nm/PycharmProjects/MAVSDK-Python/mavsdk/__init__.py", line 7, in <module>
from .system import System
File "/Users/nm/PycharmProjects/MAVSDK-Python/mavsdk/system.py", line 8, in <module>
from . import action
File "/Users/nm/PycharmProjects/MAVSDK-Python/mavsdk/action.py", line 5, in <module>
from . import action_pb2, action_pb2_grpc
File "/Users/nm/PycharmProjects/MAVSDK-Python/mavsdk/action_pb2.py", line 16, in <module>
from . import mavsdk_options_pb2 as mavsdk__options__pb2
File "/Users/nm/PycharmProjects/MAVSDK-Python/mavsdk/mavsdk_options_pb2.py", line 21, in <module>
_ASYNCTYPE = DESCRIPTOR.enum_types_by_name['AsyncType']
AttributeError: 'NoneType' object has no attribute 'enum_types_by_name'
A few weeks ago, I was able to run this file without any issues. Can someone point me in the right direction to resolve this?
When I use pip3 show mavsdk it shows that I have version 0.12.0. I see that the latest version is 1.4.9. I tried installing another version using pip3 install mavsdk==1.4.9 and get the message:
ERROR: Could not find a version that satisfies the requirement mavsdk==1.4.9 (from versions: 0.5.2, 0.7.0, 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.9.1, 0.10.0, 0.11.0, 0.12.0)
ERROR: No matching distribution found for mavsdk==1.4.9
I have not made any updates, have not installed anything new. I have tried running the examples in a venv. I have used pycharm, vscode, terminal, and the same issue happens.
From the backtrace, it looks like it is using MAVSDK locally from you MAVSDK-Python directory, right? I don’t think that’s right, and you should be using the one installed using pip instead.
Any chance that you installed the local version using pip3 install -e . If so, I would try to clean that up.
Is there a guide online that I can follow to do this?
I have installed mavsdk using pip3 install mavsdk and it installs version 0.12.0.
When I use brew install mavsdk it installs 1.4.9.
The brew install installs the MAVSDK C++ library. pip3 install mavsdk installs the MAVSDK Python wrappers and the C++ mavsdk_server_bin binary that the Python headers talk to.
What happens if you take that example and run it in another directory somewhere, so it doesn’t find MAVSDK-Python/mavsdk/…
So on the mac python 3.11.1 is installed, but in the venv in pycharm Python 3.9.6. I also noticed that when I did the mavsdk install, protobuf 4.21 was installed. So I uninstalled that one and installed protobuf 3.20.3
I am using the logfiles_download.py file to test. So the above errors seem to be gone. Now I get the following information when I run the file.
This installation does not provide an embedded 'mavsdk_server' binary.
If you installed using pip, this means that 'mavsdk_server' is not distributed
for your platform yet (e.g. arm).
You will need to get and run the 'mavsdk_server' binary manually:
1. Download 'mavsdk_server' from: https://github.com/mavlink/mavsdk/releases
or build it from source.
2. Run it, e.g. on port 50051:
'./mavsdk_server -p 50051'
3. Set the 'mavsdk_server_address' and port when creating the System:
'drone = System(mavsdk_server_address='localhost', port=50051)'
I thought the mavsdk_server would automatically be installed.
I am running PX4 and MavProxy on Ubuntu 20.04 and using my Mac IP address:14550, which is also being used in logfile_download.py. If I am doing this, will this also require me to create the mavsdk port? When this was working a few weeks ago, I did not have to go through this process.
I don’t know the state of the included mavsdk_server_bin for macOS on M1. The problem is that there don’t seem to be M1 Macs available in GitHub Action CI machines, and I also don’t have one at home to try this.
When I run the server on the terminal inside PyCharm (after cd into the directory where it is placed) I get the following:
zsh: command not found: mavsdk_server_macos
What puzzles me is that back in December everything was working just fine and from one day to the next I started having all these issues. I had even written some code to get the yaw, pitch, and roll. I had tested the telemetry.py and logfiles_download.py and it worked. No errors like this at all.
When you run the server with the MAVLink connection string mavsdk_server_macos udp://:14540 then you don’t add system_address=... in drone.connect().
mavlink on ubuntu side shows that partner IP is 127.0.0.1
and mavproxy.py has the following log:
nm@nm-ubuntu:~$ mavproxy.py --master=127.0.0.1:14550 --out=udpout:192.168.0.119:14550
WARNING: You should uninstall ModemManager as it conflicts with APM and Pixhawk
Connect 127.0.0.1:14550 source_system=255
Log Directory:
Telemetry log: mav.tlog
Waiting for heartbeat from 127.0.0.1:14550
MAV> Detected vehicle 1:1 on link 0
online system 1
LOITER> Mode LOITER
fence breach
GPS lock at 488 meters
AP: [logger] ./log/2023-01-05/20_12_44.ulg
AP: Preflight Fail: No manual control input
Received 845 parameters
Saved 846 parameters to mav.parm
Not sure if that has something to do with it.
Also, do you have a venmo or something similar so I can buy you a beer or something for all your help?
That’s ok, thanks. I’m planning to set up GitHub sponsors for MAVSDK maintenance at some point but that’s not done yet. And I’m sorry that the Python connection and debugging story is not straightforward at all, unfortunately.