3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[MAVLINKのドキュメントの雑な日本語訳] Using Pymavlink Libraries (mavgen)

Last updated at Posted at 2019-02-07

Pymavlink is a low level and general purpose MAVLink message processing library, written in Python. It has been used to implement MAVLink communications many types of MAVLink systems, including a GCS (MAVProxy), Developer APIs (DroneKit) and numerous companion computer MAVLink applications.

PymavlinkはPythonで書かれた低レベルで汎用のMAVLinkメッセージ処理ライブラリです。 これは、GCS(MAVProxy)、Developer API(DroneKit)、および多数のコンパニオンコンピューター向けMAVLinkアプリケーションを含む、MAVLink通信の多くのタイプのMAVLinkシステムを実装するために使用されてきました。

The library can be used with Python 2.7+ (recommended) or Python 3.5+ and supports both MAVLink 1 and MAVLink 2 versions of the protocol.

このライブラリはPython 2.7以降(推奨)またはPython 3.5以降で使用でき、MAVLink 1とMAVLink 2の両方のバージョンのプロトコルをサポートします。

This topic explains how to get and use the Pymavlink MAVLink Python libraries (generated using mavgen).

このトピックでは、pymavlink MAVLink Pythonライブラリ(mavgenを使用して生成されます)の取得方法と使用方法について説明します。

Getting Libraries

If you need a standard dialect then you can install these (for both MAVLink 1 and 2) with pymavlink using pip:

(?)標準の方言が必要な場合は、pipを使ってpymavlinkを使って(MAVLink 1と2の両方に)これらをインストールすることができます。

pip install pymavlink

If you need libraries for a custom dialect then you will need to install mavgen and generate them yourself. You will also need to include them in pymavlink and install them locally on your system.

カスタムの方言用のライブラリが必要な場合は、mavgenをインストールして自分で生成する必要があります。 あなたはそれらをpymavlinkに含めてあなたのシステムにローカルにインストールする必要もあります。

  1. Generate the Python libraries for your dialect.
  2. Copy the generated .py dialect file(s) into the appropriate directory of your clone of the mavlink repo:
  • MAVLink 2: pymavlink/dialects/v20
  • MAVLink 1: pymavlink/dialects/v10
  1. Open a command prompt and navigate to the pymavlink directory.
  2. If needed, uninstall previous versions:
  • pip uninstall pymavlink
  1. Install dependencies (if you have not previously installed pymavlink using pip):
  • pip install lxml future
  1. Run the python setup program:
  • python setup.py install --user

The libraries can then be used in the same way as those installed using pip.

これで、ライブラリはpipを使用してインストールされたものと同じ方法で使用できます。

Using the Libraries

Overview

The pymavlink package includes the dialect-specific generated modules, which provide low-level functionality to encode and decode messages, and apply and check signatures.

pymavlinkパッケージには、メッセージのエンコードとデコード、および署名の適用とチェックを行うための低レベルの機能を提供する、方言固有の自動生成されたモジュールが含まれています。

Generally speaking, most developers will use the mavutil module to set up and manage the communication channel (because it makes get started very easy). This module provides simple mechanisms for setting up links, sending and receiving messages, and querying some basic autopilot properties (e.g. flight mode). It provides access to the dialect module used for encoding/decoding/signing via an attribute (mav).

一般的に言って、ほとんどの開発者はmavutilモジュールを使用して通信チャネルを設定および管理します(始めるのが非常に簡単になるため)。 このモジュールは、リンクを設定し、メッセージを送受信し、そしていくつかの基本的なオートパイロット特性(例えばフライトモード)を問い合わせるための簡単なメカニズムを提供する。 属性(mav)を介してエンコード/デコード/署名に使用される言語モジュールへのアクセスを提供します。

There are several main caveats to be aware of when using mavutil:

mavutilを使用する際に注意すべきいくつかの注意点があります。

  • The link does not properly handle multiple systems running on the same port. If you need a multi-vehicle network see source-system-filtering.

リンクは、同じポートで稼働している複数のシステムを正しく処理しません。マルチ車両ネットワークが必要な場合は、source-system-filteringを参照してください。

  • The module is optimised for ArduPilot and some functions may not work properly on other autopilots.

このモジュールはArduPilot用に最適化されており、他の自動操縦装置では正しく機能しない機能もあります。

  • mavutil is still a relatively low-level MAVLink API. It has limited support for even the most common MAVLink microservices.

mavutilはまだ比較的低レベルのMAVLink APIです。 最も一般的なMAVLinkマイクロサービスでさえもサポートが限定されています。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?