Skip to content

Commit

Permalink
Use native asides (#576)
Browse files Browse the repository at this point in the history
* Use vitepress native asides - prettier screws up githu

* minor clean

* prettier_output
  • Loading branch information
hamishwillee authored Nov 27, 2024
1 parent 356c5ef commit 63a111f
Show file tree
Hide file tree
Showing 49 changed files with 1,063 additions and 834 deletions.
7 changes: 4 additions & 3 deletions en/about/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ uint16_t checksum; ///< CRC-16/MCRF4XX
uint8_t signature[13]; ///< Signature which allows ensuring that the link is tamper-proof (optional)
```

> [!NOTE]
> The [MAVLink 1 packet format](../guide/serialization.md#v1_packet_format) is similar, but omits `incompat_flags`, `compat_flags` and `signature`, and only has a single byte for the message address.
> For more information see [Serialization > Packet Format](../guide/serialization.md#packet_format).
::: info
The [MAVLink 1 packet format](../guide/serialization.md#v1_packet_format) is similar, but omits `incompat_flags`, `compat_flags` and `signature`, and only has a single byte for the message address.
For more information see [Serialization > Packet Format](../guide/serialization.md#packet_format).
:::

## Serialization

Expand Down
7 changes: 4 additions & 3 deletions en/about/support.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ If directed by the development team, issues may be raised on [Github here](https

MAVLink developers, adopting companies and the surrounding community of users meet regularly to help define the direction of the project, discuss RFCs, Issues and have a Q&A session.

> [!TIP]
> The call is open to anyone who wants to contribute to the ongoing development of the project (not just the dev team).
> This is a great opportunity to meet the team.
::: tip
The call is open to anyone who wants to contribute to the ongoing development of the project (not just the dev team).
This is a great opportunity to meet the team.
:::

#### Who should attend: {#who-should-attend}

Expand Down
5 changes: 3 additions & 2 deletions en/contributing/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ Primarily this means that the team developing the generator must provide suffici
git checkout -b mydescriptivebranchname
```

> [!NOTE]
> _Always_ branch off master for new features.
::: info
_Always_ branch off master for new features.
:::

3. Commit your changes with a descriptive commit message.

Expand Down
12 changes: 7 additions & 5 deletions en/file_formats/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ Often the information is defined on one system and used on another (e.g. logs fr

There is a _defacto_ standard used in many GCS systems and developer APIs for storing _mission_ information: [plain-text file format](#mission_plain_text_file).

> [!NOTE]
> At time of writing there are no MAVLink standards (defacto or otherwise) for: geofence, rally points, parameters etc.
> There is a discussion about standardising file formats in [Issue #989](https://github.com/mavlink/mavlink/issues/989).
::: info
At time of writing there are no MAVLink standards (defacto or otherwise) for: geofence, rally points, parameters etc.
There is a discussion about standardising file formats in [Issue #989](https://github.com/mavlink/mavlink/issues/989).
:::

## Mission Plain-Text File Format {#mission_plain_text_file}

Expand All @@ -22,8 +23,9 @@ QGC WPL <VERSION>
<INDEX> <CURRENT WP> <COORD FRAME> <COMMAND> <PARAM1> <PARAM2> <PARAM3> <PARAM4> <PARAM5/X/LATITUDE> <PARAM6/Y/LONGITUDE> <PARAM7/Z/ALTITUDE> <AUTOCONTINUE>
```

> [!NOTE]
> The spaces between the numbers/fields above are `<tab>` (i.e. `\t` in most programming languages).
::: info
The spaces between the numbers/fields above are `<tab>` (i.e. `\t` in most programming languages).
:::

For example:

Expand Down
49 changes: 29 additions & 20 deletions en/getting_started/generate_libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,33 @@ This page shows how to use the following two code generators provided with the M
- GUI tool: [mavgenerate](#mavgenerate)
- Command line tool: [mavgen](#mavgen), which is the backend tool used also by mavgenerate

> [!NOTE]
> These generators can build MAVLink 2 and MAVLink 1 libraries for the following programming languages: C, C++11, Python, Typescript, Java, and WLua. The following programming languages are supported for MAVLink 1 libraries only: C#, JavaScript, ObjC, Swift.
::: info
These generators can build MAVLink 2 and MAVLink 1 libraries for the following programming languages: C, C++11, Python, Typescript, Java, and WLua.
The following programming languages are supported for MAVLink 1 libraries only: C#, JavaScript, ObjC, Swift.
:::

> [!TIP]
> Generators for other programming languages are supported and documented in independent projects.
> For more information see [Supported Languages](../index.md#supported_languages).
::: tip
Generators for other programming languages are supported and documented in independent projects.
For more information see [Supported Languages](../index.md#supported_languages).
:::

## Pre-requisites

1. You must already have [Installed the MAVLink toolchain](../getting_started/installation.md), which includes the mavgenerate and mavgen tools used below as well as the [XML Message Definitions](../messages/index.md).
1. If you are generating messages for a [custom dialect](../messages/index.md#dialects), copy the dialect [XML definition file(s)](../messages/index.md#xml-definition-files--dialects) into the directory [message_definitions/v1.0/](https://github.com/mavlink/mavlink/tree/master/message_definitions/v1.0).

> [!NOTE]
> _mavgen_ can handle dialects that have relative paths for included XML files (e.g typically [common.xml](../messages/common.md)), but other generators may not.
> We recommend putting custom dialects in the same folder as the ones that come with the [mavlink/mavlink](https://github.com/mavlink/mavlink) repository.
::: info
_mavgen_ can handle dialects that have relative paths for included XML files (e.g typically [common.xml](../messages/common.md)), but other generators may not.
We recommend putting custom dialects in the same folder as the ones that come with the [mavlink/mavlink](https://github.com/mavlink/mavlink) repository.
:::

## Building MAVLink libraries using the Mavgenerate GUI {#mavgenerate}

**mavgenerate.py** is GUI code generator for MAVLink, written in Python.

> [!NOTE]
> _Mavgenerate_ provides a GUI front end to the [mavgen](#mavgen) command line code generator, and supports the same [options](#mavgen_options).
::: info
_Mavgenerate_ provides a GUI front end to the [mavgen](#mavgen) command line code generator, and supports the same [options](#mavgen_options).
:::

The GUI can be launched from anywhere using Python's `-m` argument:

Expand All @@ -42,8 +47,9 @@ Steps for generating the MAVLink library code:

1. Choose the target XML file (typically in [mavlink/message_definitions/1.0](https://github.com/mavlink/mavlink/tree/master/message_definitions/v1.0)).

> [!NOTE]
> If using a custom dialect, first copy it into the above directory (if the dialect is dependent on **common.xml** it must be located in the same directory).
::: info
If using a custom dialect, first copy it into the above directory (if the dialect is dependent on **common.xml** it must be located in the same directory).
:::

1. Choose an output directory (e.g. **mavlink/include**).
1. Select the target output programming language.
Expand All @@ -58,33 +64,36 @@ Steps for generating the MAVLink library code:

1. Select the target MAVLink protocol version. Ideally use 2.0 if the generator supports it.

> **Caution** Generation will fail if the protocol is not [supported](../index.md#supported_languages) by the selected programming language.
::: warning
Generation will fail if the protocol is not [supported](../index.md#supported_languages) by the selected programming language.
:::

1. Optionally check _Validate_ and/or _Validate Units_, which validates XML specifications.

1. Click **Generate** to create the source files for the MAVLink library and the chosen dialect.

## Building MAVLink libraries using the Mavgen Command Line Tool {#mavgen}

**mavgen.py** is a command line tool for generating MAVLink libraries for various programming languages.
You can run mavgen from the `mavlink` directory. However, if you are outside of the mavlink directory, you need to add the `mavlink` directory to the `PYTHONPATH` environment variable.

> [!TIP]
> Mavgen is the backend used by [mavgenerate](#mavgenerate).
> The documentation below explains all the options for both tools.
::: tip
Mavgen is the backend used by [mavgenerate](#mavgenerate).
The documentation below explains all the options for both tools.
:::

Below is an example for how to generate _MAVLink 2_ libraries for the C programming language using a dialect named **your_custom_dialect.xml**:

```sh
python3 -m pymavlink.tools.mavgen --lang=C --wire-protocol=2.0 --output=generated/include/mavlink/v2.0 message_definitions/v1.0/your_custom_dialect.xml
```

> [!NOTE]
> The syntax for for generating Python modules is the same, except that the `--output` specifies a _filename_ rather than a directory.
::: info
The syntax for for generating Python modules is the same, except that the `--output` specifies a _filename_ rather than a directory.
:::

<!-- https://github.com/ArduPilot/pymavlink/issues/203 -->

<span id="mavgen_options"></span>
<a id="mavgen_options"></a>
The full syntax and options can be output by running `mavgen.py -h` flag, which is reproduced below:

```
Expand Down
7 changes: 4 additions & 3 deletions en/getting_started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

This topic explains how to install the [MAVLink toolchain](https://github.com/mavlink/mavlink). The toolchain includes the [XML message definitions](../messages/index.md) as well as the the GUI/command line tools that use the definitions to [Generate MAVLink Source Files](../getting_started/generate_libraries.md).

> [!TIP]
> You do not need to install or generate the source files if you are using the C programming language and a standard [dialect](../messages/index.md#dialects).
> Just get the [prebuilt libraries](../index.md#prebuilt_libraries) and then jump to [Using C Libraries](../mavgen_c/index.md).
::: tip
You do not need to install or generate the source files if you are using the C programming language and a standard [dialect](../messages/index.md#dialects).
Just get the [prebuilt libraries](../index.md#prebuilt_libraries) and then jump to [Using C Libraries](../mavgen_c/index.md).
:::

## Prerequisites

Expand Down
7 changes: 4 additions & 3 deletions en/getting_started/use_libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

The linked documents explain how to use the MAVLink libraries for different programming languages (and from different code generators).

> [!NOTE]
> Not all of the libraries are documented.
> If you have experience with the other libraries, please help us update those sections!
::: info
Not all of the libraries are documented.
If you have experience with the other libraries, please help us update those sections!
:::

- Mavgen

Expand Down
14 changes: 8 additions & 6 deletions en/guide/crc.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

MAVLink services that need to use a Cyclic Redundancy Check (CRC) should choose the CRC32 algorithm described below.

> [!NOTE]
> Using the same CRC implementation for all cases means that only one implementation is required.
> Do not introduce another unless there without a compelling technical reason.
> [!NOTE]
> This CRC is [used for higher level services](#implementations) (it is not related to the CRC16 used for the checksum in [MAVLink serialization](serialization.md#checksum)).
::: info
Using the same CRC implementation for all cases means that only one implementation is required.
Do not introduce another unless there without a compelling technical reason.
:::

::: info
This CRC is [used for higher level services](#implementations) (it is not related to the CRC16 used for the checksum in [MAVLink serialization](serialization.md#checksum)).
:::

## CRC32 Algorithm

Expand Down
Loading

0 comments on commit 63a111f

Please sign in to comment.