Verify ArduPilot RC Transmitter Input with RC Receive Block
This example shows how to test your RC transmitter n Simulink® using the RC Receive block in UAV Toolbox Support Package for ArduPilot® Autopilots. You can verify RC functionality on both the host target (simulation environment) and ArduPilot-based flight controller hardware.
This example shows how to:
Read raw RC channel data into Simulink from a Pixhawk flight controller.
Monitor status information such as flight mode, RSSI, arming status, and emergency stop state.
Apply trimming and deadzone settings to RC inputs using ArduPilot’s onboard configuration.
Test RC input in both hardware and simulation (host target) environments.
The RC Receive block reads RC channel data transmitted from your RC transmitter. It supports up to 16 RC channels, and provides access to additional vehicle and status information from the flight controller.
For more information on the compatible RC protocols, see Radio Control Systems — Copter documentation .
Prerequisites
Before you begin:
Complete the hardware setup. For more information, see Overview of Hardware Setup for ArduPilot Autopilots
Install Mission Planner for hardware calibration and configuration.
Ensure your RC transmitter and receiver are properly bound before starting.
Required Hardware
ArduPilot-compatible flight controller. This example uses Pixhawk 6x.
USB cable.
RC receiver and transmitter supported by ArduPilot protocols. This example uses an FS i6.
Connect Hardware
Connect Pixhawk 6x to your host Computer using a USB cable.
Connect the SBUS pins of the RC Receiver to the RC IN port of Pixhawk 6x, as shown in this image.

Configure RC Receiver Parameters
In the Mission Planner click Connect to establish a connection with the flight controller.
Go to Setup > Radio Calibration and perform the steps mentioned in Radio Control Calibration — Copter documentation .

Move the sticks and switches on your RC transmitter. The green channel bars in Mission Planner should move in real time.
Complete the calibration process as prompted.
This process sets the following RC input parameters for each channel (1–16):
-
RCx_MIN(minimum PWM)-
RCx_MAX(maximum PWM)-
RCx_TRIM(neutral point)
(where x is the channel number, 1–16)
Configure and Run Simulink Model
Perform these steps to set up your Simulink model to receive and interpret RC input.
Open MATLAB® and create a new Simulink® model.
Add RC Receive block.
Double-click anywhere in the model canvas. In the quick insert menu that appears, enter
RC Receive. A list of blocks appears. Verify that the RC Receive block from the UAV Toolbox Support Package for ArduPilot Autopilots library is selected. Check the library name listed under the block name and the block description in the pane to the right of the search results.
Add the RC Receive block to the model by pressing Enter.
Configure the Simulink model to use Pixhawk 6X.
In the Simulink model, go to Modeling> Model Settings.
In the Configuration Parameters dialog box, navigate to Hardware Implementation > Hardware board and select
ArduPilot Pixhawk 6Xfrom the drop-down list.
Click Apply and OK.
Set Up RC Channels in the Block.
By default, channels
1–4are included.Add or remove channels using the Add or Delete buttons in the block dialog. The number of RC channels you need depends on your specific application and hardware. For example, quadcopters typically require at least 4 channels (throttle, pitch, roll, yaw).
Choose data type for each channel.
Raw Data: The unprocessed PWM value received from the RC transmitter.
Using trim & deadzone: The raw values processed according to the trim (
RCx_TRIM) and deadzone (RCx_DZ) parameters set in Mission Planner (see Config > Full Parameter List).
Note
If you have already set trims on your RC transmitter and do not intend to use the parameters, select Raw Data.
Verify the trim and deadzone output from the RC Receive block by comparing it with the calculated value. For more information, see How Trim and Deadzone Output is Calculated in the RC Receive Block.
In the RC Receive block parameters dialog box, click Advanced and select these additional outputs:
Flight Mode
Arming Status
Emergency Stop Status
Configure Flight Mode Switching
In the Mission Planner, assign the
FLTMODE_CHparameter to the desired RC channel for flight mode switching.Click Write Params to save the change.
Go to Setup > Mandatory Hardware > Flight Modes in Mission Planner to map flight modes to different RC input ranges. This allows you to map specific flight modes to different ranges of values on the assigned RC channel.

The block outputs the flight mode index, which is a number (starting from
0) that corresponds to the position of the selected flight mode in your Mission Planner configuration. For example, STABILIZE has an index of2, Loiter has an index of11, and RTL has an index of10. The index value indicates which flight mode is currently selected. For more information, see Flight Mode Mapping.Note
If the flight mode change mode change fails, the block retains the previous flight mode value.
Configure Arming and Emergency Stop
In Mission Planner, go to Config> User Params.
Assign the Arm/Disarm (4.2 and higher) and Motor Emergency Stop options to different RC channels.
For example, assign arming to channel
5and emergency stop to channel6.
These functions activated when the RC channel value reaches maximum, and deactivated when the value is at its minimum.
The arm output is
1when the system is armed, and0when disarmed.The emergency stop output is
1when active, and0inactive.
Initiate Monitoring and Tuning
Disconnect Mission Planner.
In the Simulink model, go to the Hardware tab.
Click Monitor & Tune to run the model and connect to your hardware.
Test RC Inputs and Vehicle Status
Vary RC channel inputs on your transmitter and observe the corresponding channel values and vehicle status outputs in real time.
Failsafe Verification:
By default, the RC Receive block outputs the failsafe status. To test this functionality, turn off the RC transmitter while the model is running; the
failsafeoutput should switch to1indicating loss of signal and activation of thefailsafemode.
Test in Simulation Mode (Host Target)
You can test your Simulink model and RC Receive block in simulation mode, without needing physical flight controller hardware. This is known as Host Target mode.
Set the Hardware Board to Host Target.
In the Simulink model, click Modeling > Model Settings.
In the Configuration Parameters dialog, navigate to Hardware Implementation > Hardware board.
Select
ArduPilot Host Targetfrom the hardware board drop-down list.
Connect to Mission Planner.
Run your Simulink model and open Mission Planner. Mission Planner should automatically detect and connect to your Simulink model via UDP.
If Mission Planner does not connect automatically, manually connect Mission Planner to the correct UDP port used by the model.
Read and verify the following RC data.
RC channel data.
Flight mode
Arming status
Emergency stop status
The workflow for reading and interpreting these signals is the same as when using hardware.
Emulating RC Rx/Tx Behavior in SITL
In Software-in-the-Loop (SITL) simulation, there is no physical RC transmitter or receiver. Instead, you must emulate RC channel inputs to test your Simulink model and vehicle behavior. There are two primary methods:
Option1: Use MAVProxy Terminal
Use the MAVProxy console to directly set RC channel values. For example, enter the following command to set the output of RC channel 3 to 1700 in the Simulink block.
rc 3 1700
Use this method to manually set or script RC channel values for testing.
Option 2: Use a Joystick via Mission Planner
Connect a joystick or gamepad to your computer and configure Mission Planner to use it as an RC input device for SITL.
For setup instructions, see Joystick/Gamepad — Copter documentation . This method provides a more realistic piloting experience and is ideal for interactive testing.
Other Things to Try
Visualize RC Block Outputs
Visualize RC block outputs by running the same model in Connected I/O mode, which allows real-time interaction with your model while keeping Simulink on the host computer. For more information on Connected I/O mode, see Communicate with Hardware Using Connected I/O.