pymavlink


Namepymavlink JSON
Version 2.4.40 PyPI version JSON
download
home_pagehttps://github.com/ArduPilot/pymavlink/
SummaryPython MAVLink code
upload_time2023-08-23 01:39:55
maintainer
docs_urlNone
author
requires_python
licenseLGPLv3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Build Status](https://travis-ci.org/ArduPilot/pymavlink.svg?branch=master)](https://travis-ci.org/ArduPilot/pymavlink)
# Pymavlink
This is a Python implementation of the MAVLink protocol.
It includes a source code generator (generator/mavgen.py) to create MAVLink protocol implementations for other programming languages as well.
Also contains tools for analyzing flight logs.

# Documentation

Please see http://ardupilot.org/dev/docs/mavlink-commands.html for mavlink command reference.

For realtime discussion please see the pymavlink [Gitter channel](https://gitter.im/ArduPilot/pymavlink)

Examples can be found [in the repository](examples/) or in the [ArduSub book](https://www.ardusub.com/developers/pymavlink.html)


# Installation 

Pymavlink supports both Python 2 and Python 3.

The following instructions assume you are using Python 3 and a Debian-based (like Ubuntu) installation.

.. note::

   pymavlink assumes the command "python" is in your path.  Your distribution may provide a package such as "python-is-python3" to ensure that "python" is in your path.

## Dependencies

Pymavlink has several dependencies :

    - [future](http://python-future.org/) : for Python 2 and Python 3 interoperability
    - [lxml](http://lxml.de/installation.html) : for checking and parsing xml file 

Optional :

    - numpy : for FFT
    - pytest : for tests

### On Linux

lxml has some additional dependencies that can be installed with your package manager (here with `apt-get`) :

.. note::

   If you continue to use Python 2 you may need to change package names here (e.g. python3-numpy => python-numpy)

```bash
sudo apt-get install libxml2-dev libxslt-dev
```

Optional for FFT scripts and tests:

```bash
sudo apt-get install python3-numpy python3-pytest
```

Using pip you can install the required dependencies for pymavlink :

```bash
sudo python -m pip install --upgrade future lxml
```

### On Windows

Use pip to install future as for Linux.
Lxml can be installed with a Windows installer from here : https://pypi.org/project/lxml


## Installation

### For users

It is recommended to install pymavlink from PyPI with pip, that way dependencies should be auto installed by pip.

```bash
sudo python -m pip install --upgrade pymavlink
```

#### Mavnative

Starting from September 2022, mavnative, a C extension for parsing mavlink, was deprecated and removed. Mavnative developpement was stalled for long time, it only supports MAVLink1 and doesn't get any fix on the protocol.

### For developers

From the pymavlink directory, you can use :

```bash
sudo MDEF=PATH_TO_message_definitions python -m pip install . -v
```

Since pip installation is executed from /tmp, it is necessary to point to the directory containing message definitions with MDEF. MDEF should not be set to any particular message version directory but the parent folder instead. If you have cloned from mavlink/mavlink then this is ```/mavlink/message_definitions``` . Using pip should auto install dependencies and allow you to keep them up-to-date. 

Or:

```bash
sudo python setup.py install
```

### Ardupilot Custom Modes

By default, `pymavlink` will map the Ardupilot mode names to mode numbers per the definitions in the [ardupilotmega.xml](https://mavlink.io/en/messages/ardupilotmega.html#PLANE_MODE) file. However, during development, it can be useful to add to or update the default mode mappings.

To do this:
  - create a folder named `.pymavlink` in your home directory (i.e. `$HOME` on Linux, `$USERPROFILE` on Windows); and
  - add a JSON file called `custom_mode_map.json` to this new `.pymavlink` folder.

The JSON file is a dictionary that maps vehicle [`MAV_TYPE`](https://mavlink.io/en/messages/minimal.html#MAV_TYPE) value to a dictionary of mode numbers to mode names. An example that duplicates the existing mapping for `MAV_TYPE_FIXED_WING` (`enum` value of `1`) vehicles is as follows:
```json
{
    "1": {
        "0":  "MANUAL",
        "1":  "CIRCLE",
        "2":  "STABILIZE",
        "3":  "TRAINING",
        "4":  "ACRO",
        "5":  "FBWA",
        "6":  "FBWB",
        "7":  "CRUISE",
        "8":  "AUTOTUNE",
        "10": "AUTO",
        "11": "RTL",
        "12": "LOITER",
        "13": "TAKEOFF",
        "14": "AVOID_ADSB",
        "15": "GUIDED",
        "16": "INITIALISING",
        "17": "QSTABILIZE",
        "18": "QHOVER",
        "19": "QLOITER",
        "20": "QLAND",
        "21": "QRTL",
        "22": "QAUTOTUNE",
        "23": "QACRO",
        "24": "THERMAL"
    }
}
```

This `custom_mode_map.json` file can be used to:
  - change the display name of an existing mode (e.g. change `"TAKEOFF"` to `"LAUNCH"`);
  - add a new mode (e.g. add `"25": "NEW_MODE"`); and
  - add a mapping for an unsupported vehicle type (e.g. add a mapping for `MAV_TYPE_AIRSHIP` (`enum` value of `7`) vehicles).

Notes:
  - Whilst the `MAV_TYPE` and mode numbers are integers, they need to be defined as `string`s in the JSON file, as raw integers can't be used as dictionary keys in JSON.
  - This feature _updates_ the default definitions. You can use it to change the name-to-number mapping for a mode, but you completely can't remove an existing mapping.


# License
---------

pymavlink is released under the GNU Lesser General Public License v3 or later.

The source code generated by generator/mavgen.py is available under the permissive MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ArduPilot/pymavlink/",
    "name": "pymavlink",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/60/4c/5f53854ac006c6ce14b634384b962ca9445217b606ccceee981bdf42014d/pymavlink-2.4.40.tar.gz",
    "platform": null,
    "description": "[![Build Status](https://travis-ci.org/ArduPilot/pymavlink.svg?branch=master)](https://travis-ci.org/ArduPilot/pymavlink)\n# Pymavlink\nThis is a Python implementation of the MAVLink protocol.\nIt includes a source code generator (generator/mavgen.py) to create MAVLink protocol implementations for other programming languages as well.\nAlso contains tools for analyzing flight logs.\n\n# Documentation\n\nPlease see http://ardupilot.org/dev/docs/mavlink-commands.html for mavlink command reference.\n\nFor realtime discussion please see the pymavlink [Gitter channel](https://gitter.im/ArduPilot/pymavlink)\n\nExamples can be found [in the repository](examples/) or in the [ArduSub book](https://www.ardusub.com/developers/pymavlink.html)\n\n\n# Installation \n\nPymavlink supports both Python 2 and Python 3.\n\nThe following instructions assume you are using Python 3 and a Debian-based (like Ubuntu) installation.\n\n.. note::\n\n   pymavlink assumes the command \"python\" is in your path.  Your distribution may provide a package such as \"python-is-python3\" to ensure that \"python\" is in your path.\n\n## Dependencies\n\nPymavlink has several dependencies :\n\n    - [future](http://python-future.org/) : for Python 2 and Python 3 interoperability\n    - [lxml](http://lxml.de/installation.html) : for checking and parsing xml file \n\nOptional :\n\n    - numpy : for FFT\n    - pytest : for tests\n\n### On Linux\n\nlxml has some additional dependencies that can be installed with your package manager (here with `apt-get`) :\n\n.. note::\n\n   If you continue to use Python 2 you may need to change package names here (e.g. python3-numpy => python-numpy)\n\n```bash\nsudo apt-get install libxml2-dev libxslt-dev\n```\n\nOptional for FFT scripts and tests:\n\n```bash\nsudo apt-get install python3-numpy python3-pytest\n```\n\nUsing pip you can install the required dependencies for pymavlink :\n\n```bash\nsudo python -m pip install --upgrade future lxml\n```\n\n### On Windows\n\nUse pip to install future as for Linux.\nLxml can be installed with a Windows installer from here : https://pypi.org/project/lxml\n\n\n## Installation\n\n### For users\n\nIt is recommended to install pymavlink from PyPI with pip, that way dependencies should be auto installed by pip.\n\n```bash\nsudo python -m pip install --upgrade pymavlink\n```\n\n#### Mavnative\n\nStarting from September 2022, mavnative, a C extension for parsing mavlink, was deprecated and removed. Mavnative developpement was stalled for long time, it only supports MAVLink1 and doesn't get any fix on the protocol.\n\n### For developers\n\nFrom the pymavlink directory, you can use :\n\n```bash\nsudo MDEF=PATH_TO_message_definitions python -m pip install . -v\n```\n\nSince pip installation is executed from /tmp, it is necessary to point to the directory containing message definitions with MDEF. MDEF should not be set to any particular message version directory but the parent folder instead. If you have cloned from mavlink/mavlink then this is ```/mavlink/message_definitions``` . Using pip should auto install dependencies and allow you to keep them up-to-date. \n\nOr:\n\n```bash\nsudo python setup.py install\n```\n\n### Ardupilot Custom Modes\n\nBy default, `pymavlink` will map the Ardupilot mode names to mode numbers per the definitions in the [ardupilotmega.xml](https://mavlink.io/en/messages/ardupilotmega.html#PLANE_MODE) file. However, during development, it can be useful to add to or update the default mode mappings.\n\nTo do this:\n  - create a folder named `.pymavlink` in your home directory (i.e. `$HOME` on Linux, `$USERPROFILE` on Windows); and\n  - add a JSON file called `custom_mode_map.json` to this new `.pymavlink` folder.\n\nThe JSON file is a dictionary that maps vehicle [`MAV_TYPE`](https://mavlink.io/en/messages/minimal.html#MAV_TYPE) value to a dictionary of mode numbers to mode names. An example that duplicates the existing mapping for `MAV_TYPE_FIXED_WING` (`enum` value of `1`) vehicles is as follows:\n```json\n{\n    \"1\": {\n        \"0\":  \"MANUAL\",\n        \"1\":  \"CIRCLE\",\n        \"2\":  \"STABILIZE\",\n        \"3\":  \"TRAINING\",\n        \"4\":  \"ACRO\",\n        \"5\":  \"FBWA\",\n        \"6\":  \"FBWB\",\n        \"7\":  \"CRUISE\",\n        \"8\":  \"AUTOTUNE\",\n        \"10\": \"AUTO\",\n        \"11\": \"RTL\",\n        \"12\": \"LOITER\",\n        \"13\": \"TAKEOFF\",\n        \"14\": \"AVOID_ADSB\",\n        \"15\": \"GUIDED\",\n        \"16\": \"INITIALISING\",\n        \"17\": \"QSTABILIZE\",\n        \"18\": \"QHOVER\",\n        \"19\": \"QLOITER\",\n        \"20\": \"QLAND\",\n        \"21\": \"QRTL\",\n        \"22\": \"QAUTOTUNE\",\n        \"23\": \"QACRO\",\n        \"24\": \"THERMAL\"\n    }\n}\n```\n\nThis `custom_mode_map.json` file can be used to:\n  - change the display name of an existing mode (e.g. change `\"TAKEOFF\"` to `\"LAUNCH\"`);\n  - add a new mode (e.g. add `\"25\": \"NEW_MODE\"`); and\n  - add a mapping for an unsupported vehicle type (e.g. add a mapping for `MAV_TYPE_AIRSHIP` (`enum` value of `7`) vehicles).\n\nNotes:\n  - Whilst the `MAV_TYPE` and mode numbers are integers, they need to be defined as `string`s in the JSON file, as raw integers can't be used as dictionary keys in JSON.\n  - This feature _updates_ the default definitions. You can use it to change the name-to-number mapping for a mode, but you completely can't remove an existing mapping.\n\n\n# License\n---------\n\npymavlink is released under the GNU Lesser General Public License v3 or later.\n\nThe source code generated by generator/mavgen.py is available under the permissive MIT License.\n",
    "bugtrack_url": null,
    "license": "LGPLv3",
    "summary": "Python MAVLink code",
    "version": "2.4.40",
    "project_urls": {
        "Homepage": "https://github.com/ArduPilot/pymavlink/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3c43002219afff335348d2cde196845bcfd62bd335af230305ee8e5b14f46462",
                "md5": "dce9efa8f89d02cce68ba0834d089bac",
                "sha256": "f1be2eb9ceafe1686c99876fa762774dabd66de8134ec10fd5d3c9469bf23949"
            },
            "downloads": -1,
            "filename": "pymavlink-2.4.40-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dce9efa8f89d02cce68ba0834d089bac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11524495,
            "upload_time": "2023-08-23T01:39:52",
            "upload_time_iso_8601": "2023-08-23T01:39:52.539129Z",
            "url": "https://files.pythonhosted.org/packages/3c/43/002219afff335348d2cde196845bcfd62bd335af230305ee8e5b14f46462/pymavlink-2.4.40-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "604c5f53854ac006c6ce14b634384b962ca9445217b606ccceee981bdf42014d",
                "md5": "79c75428e21c11ba08de1a01431d2485",
                "sha256": "3d6a552ad344a1fff9e0c811361ac9d8bb8201cf6aacad7224d516fa037ccb30"
            },
            "downloads": -1,
            "filename": "pymavlink-2.4.40.tar.gz",
            "has_sig": false,
            "md5_digest": "79c75428e21c11ba08de1a01431d2485",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11315893,
            "upload_time": "2023-08-23T01:39:55",
            "upload_time_iso_8601": "2023-08-23T01:39:55.233811Z",
            "url": "https://files.pythonhosted.org/packages/60/4c/5f53854ac006c6ce14b634384b962ca9445217b606ccceee981bdf42014d/pymavlink-2.4.40.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-23 01:39:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ArduPilot",
    "github_project": "pymavlink",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pymavlink"
}
        
Elapsed time: 0.10555s