ArduPilot / ArduPilot/ardupilot

SIM_RC_FAIL not producing virtual failsafe behavior when adjusted while SITL is running

Open
#33,017 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
15.9k
Forks
21.4k
Avg merge
3d 17h
Merged PRs (30d)
119

Description

# Bug Report

## Bug report

### Issue details

The RC failsafe simulation behavior is not working for any values of SIM_RC_FAIL set while the SITL is running. While the SIM_RC_FAIL parameter does retain the asserted value between runs of the SITL, the simulated flight controller does not issue any message pertaining to RC failsafes regardless of the value. However, the RC Failsafe behavior does exist when RC_PROTOCOLS is set to zero between runs of the SITL, but as soon as this is set to 1, the virtual flight controller clears the failsafe, and the RC controls are available to the virtual flight controller even when this is set back to zero. Hence, there is no work-around by setting and clearing RC_PROTOCOLS.

Starting at https://github.com/ArduPilot/ardupilot/commit/964c30e0533cd4585a3bd6ffc3123becc37532fa , the SITL RC data source was is switched from AP_RCProtocol_UDP to AP_RCProtocol_FDM if that source is available. A quick comparison between the libraries shows that while the _UDP library is sensitive to the SIM_RC_FAIL parameter, the _FDM does not handle this.

https://github.com/ArduPilot/ardupilot/blob/c1170033f4146db01056ef4d20ad5b4eca072b62/libraries/AP_RCProtocol/AP_RCProtocol_UDP.cpp#L152

Steps to reproduce:
1. Start a RealFlight SITL session (flightaxis), download either stable (4.6.3) or latest/dev (4.8.0) for the SITL binary.
2. In Mission Planner, find SIM_RC_FAIL and set to any value (1, 2, or 3)
3. Observe no indication that the aircraft is in RC failsafe.
4. Manually populate the Documents\Mission Planner\sitl folder with a ArduPlane.exe SITL binary of 4.6.0 or earlier. Repeat the above steps. The RC Failsafe behavior should manifest.

**Version**
4.6.3 and 4.80 both tested and fail. 4.6.0 has correct behavior.

**Platform**
[?] All
[ ] AntennaTracker
[ ] Copter
[X] Plane
[ ] Rover
[ ] Submarine

**Airframe type**
Simulated Fixed-Wing Quadplane

**Hardware type**
SITL: Various versions launched from Mission Planner 1.3.82 on Windows 10
RealFlight 9.5S on Windows 10, same PC as Mission Planner and SITL instance

**Logs**
No meaningful logs

Contributor guide

Open the contributing guide

Research direction

Start with libraries/AP_RCProtocol/AP_RCProtocol_UDP.cpp around the linked line, then inspect the corresponding AP_RCProtocol_FDM implementation and how SITL selects that source. Reproduce with SIM_RC_FAIL changed while SITL runs, and verify that the FDM path reports RC failsafe behavior consistently with the UDP path and the documented steps.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot, robotics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.