Skip to content

Commit

Permalink
SITL: FlightAxis: add option to ignore RCIN
Browse files Browse the repository at this point in the history
This allows for autotests to run using the same UDP interface as the
other vehicle frames.
  • Loading branch information
robertlong13 committed Oct 2, 2024
1 parent a605ae2 commit 17f956b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions libraries/SITL/SIM_FlightAxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const AP_Param::GroupInfo FlightAxis::var_info[] = {
// @Bitmask: 1: Swap first 4 and last 4 servos (for quadplane testing)
// @Bitmask: 2: Demix heli servos and send roll/pitch/collective/yaw
// @Bitmask: 3: Don't print frame rate stats
// @Bitmask: 4: Ignore RealFlight's RCIN and use UDP instead (for autotest)
// @User: Advanced
AP_GROUPINFO("OPTS", 1, FlightAxis, _options, uint8_t(Option::ResetPosition)),
AP_GROUPEND
Expand Down Expand Up @@ -545,14 +546,16 @@ void FlightAxis::update(const struct sitl_input &input)
rpm[1] = state.m_propRPM;
motor_mask = 3;

/*
the interlink interface supports 12 input channels
*/
rcin_chan_count = 12;
for (uint8_t i=0; i<rcin_chan_count; i++) {
rcin[i] = state.rcin[i];
// Check if we want to use RealFlight's RC inputs or the UDP RC input
if(!option_is_set(Option::IgnoreRCIN)) {
// the interlink interface supports 12 input channels
rcin_chan_count = 12;
for (uint8_t i=0; i<rcin_chan_count; i++) {
rcin[i] = state.rcin[i];
}
}


update_position();
time_advance();
uint64_t new_time_us = (state.m_currentPhysicsTime_SEC - initial_time_s)*1.0e6;
Expand Down
1 change: 1 addition & 0 deletions libraries/SITL/SIM_FlightAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ class FlightAxis : public Aircraft {
Rev4Servos = (1U<<1),
HeliDemix = (1U<<2),
SilenceFPS = (1U<<3),
IgnoreRCIN = (1U<<4),
};

// return true if an option is set
Expand Down

0 comments on commit 17f956b

Please sign in to comment.