MAVProxy icon indicating copy to clipboard operation
MAVProxy copied to clipboard

Map can't be loaded and then it can't be viewed in the logs

Open NemanjaDragisic opened this issue 6 months ago • 7 comments

There is a logs that appears when I run the simulation and want to have map with me.

/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_tile.py:601: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. import pkg_resources Process Process-3: Traceback (most recent call last): File "/usr/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/usr/lib/python3.12/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_slipmap.py", line 87, in child_task self.mt = mp_tile.MPTile(download=self.download, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_tile.py", line 210, in init self._loading = mp_icon('loading.jpg') ^^^^^^^^^^^^^^^^^^^^^^ File "/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_tile.py", line 615, in mp_icon img = cv2.imdecode(raw, cv2.IMREAD_COLOR) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cv2.error: OpenCV(4.11.0) 👎 error: (-5:Bad argument) in function 'imdecode'

NemanjaDragisic avatar Jun 13 '25 12:06 NemanjaDragisic

Can you update to latest github source and try again?

stephendade avatar Jun 15 '25 05:06 stephendade

I have just pulled the latest version of github source but again the problem is

Traceback (most recent call last): File "/usr/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/usr/lib/python3.12/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_slipmap.py", line 87, in child_task self.mt = mp_tile.MPTile(download=self.download, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_tile.py", line 210, in init self._loading = mp_icon('loading.jpg') ^^^^^^^^^^^^^^^^^^^^^^ File "/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_tile.py", line 615, in mp_icon img = cv2.imdecode(raw, cv2.IMREAD_COLOR) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cv2.error: OpenCV(4.11.0) :-1: error: (-5:Bad argument) in function 'imdecode'

Overload resolution failed:

  • buf is not a numpy array, neither a scalar
  • Expected Ptrcv::UMat for argument 'buf'

NemanjaDragisic avatar Jun 15 '25 08:06 NemanjaDragisic

File "/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_tile.py", line 210, in init self._loading = mp_icon('loading.jpg')

This is actually line 213 in current master: https://github.com/ArduPilot/MAVProxy/blob/master/MAVProxy/modules/mavproxy_map/mp_tile.py#L213, so your source code doesn't match what is in the repository.

Could you double-check you're running latest master?

stephendade avatar Jun 15 '25 23:06 stephendade

I manually changed this file because even after running upgrade of git repository and MAVProxy they did not upgrade by themselves. If you can give me the commands, I would be really pleased.

Anyway, after manual upgrade this is a traceback. Traceback (most recent call last): File "/usr/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/usr/lib/python3.12/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_slipmap.py", line 87, in child_task self.mt = mp_tile.MPTile(download=self.download, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_tile.py", line 213, in init self._loading = mp_icon('loading.jpg') ^^^^^^^^^^^^^^^^^^^^^^ File "/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_tile.py", line 635, in mp_icon img = cv2.imdecode(raw, cv2.IMREAD_COLOR) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cv2.error: OpenCV(4.11.0) :-1: error: (-5:Bad argument) in function 'imdecode'

Overload resolution failed:

  • buf is not a numpy array, neither a scalar
  • Expected Ptrcv::UMat for argument 'buf'

NemanjaDragisic avatar Jun 16 '25 09:06 NemanjaDragisic

I ran command showed on the website of ArduPilot python3 -m pip install mavproxy git+https://github.com/ArduPilot/mavproxy.git@master

After this update, I got this output Collecting git+https://github.com/ArduPilot/mavproxy.git@master Cloning https://github.com/ArduPilot/mavproxy.git (to revision master) to /tmp/pip-req-build-jw6ar5an Running command git clone --filter=blob:none --quiet https://github.com/ArduPilot/mavproxy.git /tmp/pip-req-build-jw6ar5an Resolved https://github.com/ArduPilot/mavproxy.git to commit 89477687ecd95e89d41bf96f9c792208ef8c6489 Running command git submodule update --init --recursive -q Preparing metadata (setup.py) ... done Requirement already satisfied: mavproxy in /venv-ardupilot/lib/python3.12/site-packages (1.8.71) Requirement already satisfied: pymavlink>=2.4.14 in /home/dragi/venv-ardupilot/lib/python3.12/site-packages (from MAVProxy==1.8.71) (2.4.47) Requirement already satisfied: pyserial>=3.0 in /usr/lib/python3/dist-packages (from MAVProxy==1.8.71) (3.5) Requirement already satisfied: numpy in /venv-ardupilot/lib/python3.12/site-packages (from MAVProxy==1.8.71) (2.3.0) Requirement already satisfied: pynmeagps in /venv-ardupilot/lib/python3.12/site-packages (from MAVProxy==1.8.71) (1.0.50) Requirement already satisfied: future in /venv-ardupilot/lib/python3.12/site-packages (from pymavlink>=2.4.14->MAVProxy==1.8.71) (1.0.0) Requirement already satisfied: lxml in /venv-ardupilot/lib/python3.12/site-packages (from pymavlink>=2.4.14->MAVProxy==1.8.71) (5.4.0)

This hash 89477687ecd95e89d41bf96f9c792208ef8c6489 corresponds to the last commit in current master. And even after that the same error arises.

/venv-ardupilot/lib/python3.12/site-packages/matplotlib/projections/init.py:63: UserWarning: Unable to import Axes3D. This may be due to multiple versions of Matplotlib being installed (e.g. as a system package and as a pip package). As a result, the 3D projection is not available. warnings.warn("Unable to import Axes3D. This may be due to multiple versions of " /venv-ardupilot/lib/python3.12/site-packages/matplotlib/projections/init.py:63: UserWarning: Unable to import Axes3D. This may be due to multiple versions of Matplotlib being installed (e.g. as a system package and as a pip package). As a result, the 3D projection is not available. warnings.warn("Unable to import Axes3D. This may be due to multiple versions of "

Maybe important thing for this part I tried to see why Axes3D can't be imported and I found that there is a problem with file /usr/lib/python3/dist-packages/mpl_toolkits/mplot3d/init.py in line 35 where we have

from matplotlib.tri.triangulation import Triangulation

According to the documentation in matplotlib.tri we have class Triangulation and due to that module matplotlib.tri.triangulation can't be found since it does not exist.

In the same file on the line 723 there was given _set_ticklabels instead of set_ticklabels. So, these are 2 things that I saw.

After these changes, I tried to run it again and I got /venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_tile.py:601: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. import pkg_resources Process Process-2: Traceback (most recent call last): File "/usr/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/usr/lib/python3.12/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/home/dragi/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_slipmap.py", line 87, in child_task self.mt = mp_tile.MPTile(download=self.download, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/dragi/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_tile.py", line 210, in init self._loading = mp_icon('loading.jpg') ^^^^^^^^^^^^^^^^^^^^^^ File "/home/dragi/venv-ardupilot/lib/python3.12/site-packages/MAVProxy/modules/mavproxy_map/mp_tile.py", line 615, in mp_icon img = cv2.imdecode(raw, cv2.IMREAD_COLOR) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cv2.error: OpenCV(4.11.0) :-1: error: (-5:Bad argument) in function 'imdecode'

Overload resolution failed:

  • buf is not a numpy array, neither a scalar
  • Expected Ptrcv::UMat for argument 'buf'

Since as you can see this pkg_resource is depricated. Maybe it is the problem. But I am not sure

NemanjaDragisic avatar Jun 16 '25 17:06 NemanjaDragisic

I have solved the problem at least for my device, since I am running it on WSL Ubuntu. I added the command

raw = np.frombuffer(raw, dtype=np.uint8) - after line 614 in the file mp_tile.py.

The problem was that after the icon was recorder the raw stayed in bytes, but it has to be changed to numpy array.

NemanjaDragisic avatar Jun 16 '25 18:06 NemanjaDragisic

Thanks for reporting this. It is indeed a bug and is fixed in #1584. Could you confirm this patch fixes your issue?

stephendade avatar Jun 17 '25 11:06 stephendade