0
0

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.

[WIP] [MAVLINKのドキュメントの雑な日本語訳] - MAVLink C UDP Example

Posted at

原文: https://mavlink.io/en/examples/c_udp.html

MAVLink C UDP Example

The MAVLink UDP Example is a simple C example that sends some data to QGroundControl using MAVLink over UDP. QGroundControl responds with heartbeats and other messages, which are then printed by this program.

MAVLink UDPのサンプルコードは、MAVLink over UDPを使用してQGroundControlにデータを送信する単純なCのサンプルです。QGroundControlはハートビートや他のメッセージで応答し、それらのメッセージはこのプログラムによって出力されます。

The example should work on any Unix-like system (Linux, MacOS, BSD, etc.). These instructions were tested on a clean Ubuntu LTS 16.04 installation using the default version of gcc (5.4.0).

このサンプルコードは、Unix系のシステム(Linux、MacOS、BSDなど)で動作するはずです。これらの手順は、デフォルトバージョンのgcc(5.4.0)を使用して、クリーンインストールしたUbuntu LTS 16.04でテストされました。

Building/Running the Example - サンプルコードのビルドと起動

The following instructions show how to build and run the example.

  1. Install MAVLink and generate the MAVLink 1.0 libraries into the mavlink/include directory.
  • Alternatively you can clone the mavlink/mavlink repository and Download prebuilt headers to the same location. We recommend that you use MAVLink 1.0 headers as some ground control software may not yet support MAVLink 2.0.
  • You can put/generate the library wherever you like, but the build command below assumes they are located in directory named include below the MAVLink root directory.
  1. Open a terminal and navigate to examples/linux
  2. Compile with GCC using the following command:
  • gcc -std=c99 -I ../../include/common -o mavlink_udp mavlink_udp.c
  1. Run the executable from the terminal:
  • ./mavlink_udp
  • By default, the example will listen for data on the localhost IP address, port 14551. You can specify another IP address as a command line argument (use ./mavlink_udp --help to see usage).
  1. Open QGroundControl on the same machine.
  • QGroundControl immediately starts broadcasting its HEARTBEAT on port 14551.
  1. The example should start displaying the received data in the terminal:
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?