MAVLink Peripherals (GCS/OSD/Gimbal/Camera/Companion)
Ground Control Stations (GCS), MAVLink On-Screen Displays (OSD), MAVLink Cameras and Gimbals, Remote IDs, Companion Computers, ADS-B receivers, and other MAVLink peripherals interact with PX4 using separate MAVLink streams, sent via different serial ports.
In order to configure that a particular serial port is used for MAVLink traffic with a particular peripheral, we use Serial Port Configuration, assigning one of the abstract "MAVLink instance" configuration parameters to the desired port. Потім ми встановлюємо інші властивості каналу MAVLink, використовуючи параметри, пов'язані з обраним екземпляром MAVLink, щоб вони відповідали вимогам нашого конкретного периферійного пристрою.
The most relevant parameters are described below (the full set are listed in the Parameter Reference > MAVLink).
Екземпляри MAVLink
In order to assign a particular peripheral to a serial port we use the concept of a MAVLink instance.
Кожен екземпляр MAVLink представляє певну конфігурацію MAVLink, яку ви можете застосувати до певного порту. Most boards define three MAVLink instances, each represented by a parameter MAV_X_CONFIG, where X is 0, 1, 2. A few boards define more, such as Agam Autopilot v6X-RT, which has five (X is 0 to 4).
INFO
The number of instances is set at build time by the Kconfig symbol CONFIG_MAVLINK_NUM_CONFIG_INSTANCES. At most 6 MAVLink instances can run at once (4 on constrained-memory boards), and USB uses one of them.
Each instance has associated parameters that you can use to define the properties of the instance on that port, such as the set of streamed messages (see MAV_X_MODE below), data rate (MAV_X_RATE), whether incoming traffic is forwarded to other MAVLink instances (MAV_X_FORWARD), and so on.
INFO
MAVLink instances are an abstract concept for a particular MAVLink configuration. Число в назві нічого не означає; ви можете призначити будь-який екземпляр до будь-якого порту.
Параметри для кожного екземпляру є:
- MAV_X_CONFIG - Set the serial port (UART) for this instance "X". It can be any unused port, e.g.:
TELEM2,TELEM3,GPS2etc. For more information see Serial Port Configuration. - MAV_X_MODE - Specify the MAVLink profile for the instance, such as Normal or OSD. Profiles define a particular set of streamed messages and their rates — you should choose a profile that is appropriate for your channel and the peripheral.
- MAV_X_RATE - Set the maximum data rate for this instance (bytes/second).
- Це комбінована ставка для всіх потоків окремого повідомлення (ставки для окремих повідомлень зменшуються, якщо загальна ставка перевищує це значення).
- За замовчуванням налаштування, як правило, буде прийнятним, але може бути зменшено, якщо телеметричний зв'язок стає насиченим і занадто багато повідомлень втрачається.
- Значення 0 встановлює швидкість передачі даних вдвічі менше теоретичного значення.
- MAV_X_FORWARD - Enable forwarding of MAVLink packets received by the current instance onto other interfaces. Це може бути використано, наприклад, для передачі повідомлень між GCS та супутнім комп'ютером, щоб GCS міг спілкуватися з камерою, підключеною до супутнього комп'ютера, яка підтримує MAVLink.
Next you need to set the baud rate for the serial port you assigned above (in MAV_X_CONFIG).
TIP
You will need to reboot PX4 to make the parameter available (i.e. in QGroundControl).
The parameter used will depend on the assigned serial port - for example: SER_GPS1_BAUD, SER_TEL2_BAUD, etc. Значення, яке ви використовуєте, буде залежати від типу підключення та можливостей підключеного периферійного пристрою MAVLink.
Default MAVLink Ports
TELEM1
The TELEM 1 port is almost always configured by default for the GCS telemetry stream ("Normal").
To support this there is a default serial port mapping of MAVLink instance 0 as shown below:
- MAV_0_CONFIG =
TELEM 1 - MAV_0_MODE =
Normal - MAV_0_RATE=
1200Bytes/s - MAV_0_FORWARD =
True - SER_TEL1_BAUD =
57600
TELEM2
The TELEM 2 port usually configured by default for a companion computer telemetry stream ("Onboard").
To support this there is a default serial port mapping of MAVLink instance 0 as shown below:
- MAV_1_CONFIG =
TELEM 2 - MAV_1_MODE =
Onboard - MAV_1_RATE=
0(Half maximum) - MAV_1_FORWARD =
Disabled - SER_TEL2_BAUD =
921600
ETHERNET
Пристрої Pixhawk 5x (і пізніші), які мають порт Ethernet, за замовчуванням налаштовані на підключення до GCS:
On this hardware, there is a default serial port mapping of MAVLink instance 2 as shown below:
- MAV_2_CONFIG =
Ethernet(1000) - MAV_2_BROADCAST =
1 - MAV_2_MODE =
0(normal/GCS) - MAV_2_RADIO_CTL =
0 - MAV_2_RATE =
100000 - MAV_2_REMOTE_IP =
0(auto-discover partner, see MAVLink Partner Address) - MAV_2_REMOTE_PRT=
14550(GCS) - MAV_2_UDP_PRT =
14550(GCS)
For more information see: PX4 Ethernet Setup
Налаштування пристрою
Links to setup instructions for specific MAVLink components:
- MAVLink Cameras (Camera Protocol v2) > PX4 Configuration
- Gimbal Configuration > MAVLink Gimbal (MNT_MODE_OUT=MAVLINK)