MAVLink Connectivity for QGC, On-board Computer and Simulink Plant
Introduction
During the HIL simulation, both QGroundControl(QGC) and the plant model must communicate with the Pixhawk® hardware over serial. However, only one of these applications can hold the serial port and communicate with the PX4® hardware during the HIL Simulation. Hence, the application which communicates with the Pixhawk hardware must also bridge the MAVLink communication between the Pixhawk and the other applications such as onboard computer workflow.
In PX4 HITL Workflow, the simulator (Gazebo or jMAVSim) acts as a bridge to share MAVLink data between Pixhawk and QGroundControl.
To replace the plant dynamics with the Simulink Plant for HIL simulation, an internal bridge to share the MAVLink data with the other applications is required. MAVLink connectivity provides a way to route MAVLink data stream from Pixhawk hardware to the mission planning software QGroundControl(QGC), On-board computer hardware, Simulink Plant, and vice versa in HITL workflow.
PX4 HITL Workflow with Simulink Plant and MAVLink Bridge Blocks
The following diagram illustrates high level interface between multiple components used in PX4 HITL workflow.
MAVLink Bridge Blocks
MAVLink Bridge Source
The MAVLink Bridge Source block reads MAVLink data stream from the Pixhawk board connected to the serial port and routes it to the Simulink plant model and the configured UDP/TCP objects. This block allows you to configure Serial, UDP, and TCP connections.
Ports
Output
Parameters
MAVLink Bridge Sink
The MAVLink Bridge Sink block reads the MAVLink data from the source UDP/TCP ports, merges it with input data and writes to Pixhawk hardware connected to Serial port