mavlink安装
Posted zhangkun35268
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mavlink安装相关的知识,希望对你有一定的参考价值。
[email protected]:~ $ pip install --user future
Collecting future
Downloading https://files.pythonhosted.org/packages/00/2b/8d082ddfed935f3608cc61140df6dcbf0edea1bc3ab52fb6c29ae3e81e85/future-0.16.0.tar.gz (824kB)
3% |█▏ | 30kB 7.0kB/s eta 0:01:53Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 821, in unpack_url
hashes=hashes
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 659, in unpack_http_url
hashes)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "/usr/lib/python2.7/dist-packages/pip/utils/hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 571, in written_chunks
for chunk in chunks:
File "/usr/lib/python2.7/dist-packages/pip/utils/ui.py", line 139, in iter
for x in it:
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 560, in resp_read
decode_content=False):
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/response.py", line 432, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/response.py", line 397, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/response.py", line 303, in _error_catcher
raise ReadTimeoutError(self._pool, None, ‘Read timed out.‘)
ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org‘, port=443): Read timed out.
[email protected]:~ $ pip install --user future
Collecting future
Downloading https://files.pythonhosted.org/packages/00/2b/8d082ddfed935f3608cc61140df6dcbf0edea1bc3ab52fb6c29ae3e81e85/future-0.16.0.tar.gz (824kB)
100% |████████████████████████████████| 829kB 60kB/s
Building wheels for collected packages: future
Running setup.py bdist_wheel for future ... done
Stored in directory: /home/pi/.cache/pip/wheels/bf/c9/a3/c538d90ef17cf7823fa51fc701a7a7a910a80f6a405bf15b1a
Successfully built future
Installing collected packages: future
Successfully installed future-0.16.0
[email protected]:~ $ sudo apt-get install python-tk
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-tk is already the newest version (2.7.13-1).
0 upgraded, 0 newly installed, 0 to remove and 99 not upgraded.
---
https://github.com/ArduPilot/pymavlink/issues/68
I installed pymavlink with the following commands:
sudo apt-get install libxml2-dev libxslt-dev python-dev
sudo pip2 install -U future lxml
sudo pip2 install -U pymavlink
I added the following line to .bashrc:
export PYTHONPATH="${PYTHONPATH}:/usr/local/lib/python2.7/dist-packages/pymavlink"
This works:
from pymavlink import mavutil
cd /usr/local/lib/python2.7/dist-packages/pymavlink
sudo mavgen.py -o mavlinkv10.py message_definitions/v1.0/common.xml
joe mavlinkv10.py
--> in line 13, replace ... with .
--> save
from pymavlink import mavlinkv10 as mavlink
is working now.
------
[email protected]:~/mavlink2_zk/mavlink $ echo $PYTHONPATH
/usr/local/lib/python3.5/dist-packages:/home/pi/mavlink2_zk/mavlink
python -m mavgenerate
以上是关于mavlink安装的主要内容,如果未能解决你的问题,请参考以下文章