MAVLink needs to be enabled for establishing connection between the PX4 flight controller and QGroundControl. From QGroundControl, you can access the NSH via USB.
When you complete the hardware setup process for UAV Toolbox Support Package for PX4® Autopilots (using the Hardware Setup screens), MAVLink is turned off by default.
However, UAV Toolbox Support Package for PX4 Autopilots provides the option to enable or disable MAVLink, if required. To enable MAVLink, open the Configuration Parameters dialog box, go to Hardware Implementation > Target hardware resources > MAVLink, and click Enable MAVLink on /dev/ttyACM0.
To enable or disable MAVLink, selecting or clearing the checkbox alone is not sufficient. After you select or clear the checkbox (Enable MAVLink on /dev/ttyACM0), go to the Hardware tab in the Simulink model window and click Build, Deploy & Start. This action regenerates the code with MAVLink enabled or disabled.
If you enable MAVLink over USB (
/dev/ttyACM0), you cannot
perform signal monitoring and parameter tuning (Monitor and Tune feature in
Simulink) and PIL simulation over USB (the default port for these features being
/dev/ttyACM0). To run the Simulink model using the Monitor
and Tune feature or by using PIL, with MAVLink also enabled, you can choose any
other serial port for those features (for example, choose
/dev/ttyS6, under Target hardware resources > External mode ). However, in this case, you may need additional serial to USB
For UAV Toolbox Support Package for PX4 Autopilots versions prior to R2020a (20.1.0), you needed to edit
rc.txt file manually (by adding two lines) to enable MAVLink.
Therefore, when you migrate to version R2020a (20.1.0), which provides the option to
enable or disable MAVLink in the Configuration Parameters dialog box, ensure that
you remove the two lines in the
rc.txt file in the micro-SD card
connected to the PX4 flight controller. The lines that you need to remove from
rc.txt (if already added) are:
mavlink start -d /dev/ttyACM0 -m config -x