Skip to content

Commit 16f9763

Browse files
sfuhrerMaEtUgR
authored andcommitted
Separate RC and manual control terms
Signed-off-by: Silvan Fuhrer <[email protected]>
1 parent e157520 commit 16f9763

File tree

9 files changed

+42
-44
lines changed

9 files changed

+42
-44
lines changed

src/modules/commander/HealthAndArmingChecks/checks/rcAndDataLinkCheck.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@ using namespace time_literals;
3737

3838
void RcAndDataLinkChecks::checkAndReport(const Context &context, Report &reporter)
3939
{
40-
// RC
4140
manual_control_setpoint_s manual_control_setpoint;
4241

4342
if (!_manual_control_setpoint_sub.copy(&manual_control_setpoint)) {
4443
manual_control_setpoint = {};
4544
reporter.failsafeFlags().manual_control_signal_lost = true;
4645
}
4746

48-
// Check if RC is valid
47+
// Check if manual control is valid
4948
if (!manual_control_setpoint.valid
5049
|| hrt_elapsed_time(&manual_control_setpoint.timestamp) > _param_com_rc_loss_t.get() * 1_s) {
5150

@@ -77,14 +76,14 @@ void RcAndDataLinkChecks::checkAndReport(const Context &context, Report &reporte
7776

7877
if (reporter.failsafeFlags().gcs_connection_lost) {
7978

80-
// Prevent arming if we neither have RC nor a GCS connection. TODO: disabled for now due to MAVROS tests
79+
// Prevent arming if we neither have manual control nor a GCS connection. TODO: disabled for now due to MAVROS tests
8180
bool gcs_connection_required = _param_nav_dll_act.get() > 0
8281
/*|| (rc_is_optional && reporter.failsafeFlags().manual_control_signal_lost) */;
8382
NavModes affected_modes = gcs_connection_required ? NavModes::All : NavModes::None;
8483
events::LogLevel log_level = gcs_connection_required ? events::Log::Error : events::Log::Info;
8584
/* EVENT
8685
* @description
87-
* To arm, at least a data link or manual control (RC) must be present.
86+
* To arm, at least a data link or RC must be present.
8887
*
8988
* <profile name="dev">
9089
* This check can be configured via <param>NAV_DLL_ACT</param> parameter.

src/modules/commander/commander_params.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ PARAM_DEFINE_INT32(COM_HOME_IN_AIR, 0);
190190
PARAM_DEFINE_INT32(COM_RC_IN_MODE, 3);
191191

192192
/**
193-
* RC input arm/disarm command duration
193+
* Manual control input arm/disarm command duration
194194
*
195195
* The default value of 1000 requires the stick to be held in the arm or disarm position for 1 second.
196196
*
@@ -421,9 +421,9 @@ PARAM_DEFINE_INT32(COM_ARM_MAG_ANG, 60);
421421
PARAM_DEFINE_INT32(COM_ARM_MAG_STR, 2);
422422

423423
/**
424-
* Enable RC stick override of auto and/or offboard modes
424+
* Enable manual control stick override
425425
*
426-
* When RC stick override is enabled, moving the RC sticks more than COM_RC_STICK_OV
426+
* When enabled, moving the sticks more than COM_RC_STICK_OV
427427
* immediately gives control back to the pilot by switching to Position mode and
428428
* if position is unavailable Altitude mode.
429429
* Note: Only has an effect on multicopters, and VTOLs in multicopter mode.
@@ -437,7 +437,7 @@ PARAM_DEFINE_INT32(COM_ARM_MAG_STR, 2);
437437
PARAM_DEFINE_INT32(COM_RC_OVERRIDE, 1);
438438

439439
/**
440-
* RC stick override threshold
440+
* Stick override threshold
441441
*
442442
* If COM_RC_OVERRIDE is enabled and the joystick input is moved more than this threshold
443443
* the autopilot the pilot takes over control.
@@ -601,11 +601,10 @@ PARAM_DEFINE_INT32(COM_TAKEOFF_ACT, 0);
601601
PARAM_DEFINE_INT32(NAV_DLL_ACT, 0);
602602

603603
/**
604-
* Set RC loss failsafe mode
604+
* Set manual control loss failsafe mode
605605
*
606-
* The RC loss failsafe will only be entered after a timeout,
607-
* set by COM_RC_LOSS_T in seconds. If RC input checks have been disabled
608-
* by setting the COM_RC_IN_MODE param it will not be triggered.
606+
* The manual control loss failsafe will only be entered after a timeout,
607+
* set by COM_RC_LOSS_T in seconds.
609608
*
610609
* @value 1 Hold mode
611610
* @value 2 Return mode
@@ -620,7 +619,7 @@ PARAM_DEFINE_INT32(NAV_DLL_ACT, 0);
620619
PARAM_DEFINE_INT32(NAV_RCL_ACT, 2);
621620

622621
/**
623-
* RC loss exceptions
622+
* Manual control loss exceptions
624623
*
625624
* Specify modes where manual control loss is ignored and no failsafe is triggered.
626625
* External modes requiring stick input will still failsafe.

src/modules/commander/failsafe/failsafe.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ void Failsafe::checkStateAndMode(const hrt_abstime &time_us, const State &state,
456456
vehicle_status_s::NAVIGATION_STATE_AUTO_VTOL_TAKEOFF
457457
&& in_forward_flight && !state.mission_finished;
458458

459-
// Manual control (RC) loss
459+
// Manual control (RC or joystick) loss
460460
if (!status_flags.manual_control_signal_lost) {
461461
// If manual control was lost and arming was allowed, consider it optional until we regain manual control
462462
_manual_control_lost_at_arming = false;

src/modules/commander/failsafe/failsafe_test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ TEST_F(FailsafeTest, general)
109109
ASSERT_EQ(updated_user_intented_mode, state.user_intended_mode);
110110
ASSERT_EQ(failsafe.selectedAction(), FailsafeBase::Action::None);
111111

112-
// RC lost -> Hold, then RTL
112+
// manual control lost -> Hold, then RTL
113113
time += 10_ms;
114114
failsafe_flags.manual_control_signal_lost = true;
115115
updated_user_intented_mode = failsafe.update(time, state, false, stick_override_request, failsafe_flags);
@@ -127,14 +127,14 @@ TEST_F(FailsafeTest, general)
127127
ASSERT_EQ(updated_user_intented_mode, state.user_intended_mode);
128128
ASSERT_EQ(failsafe.selectedAction(), FailsafeBase::Action::Descend);
129129

130-
// DL link regained -> RTL (RC still lost)
130+
// DL link regained -> RTL (manual control still lost)
131131
time += 10_ms;
132132
failsafe_flags.gcs_connection_lost = false;
133133
updated_user_intented_mode = failsafe.update(time, state, false, stick_override_request, failsafe_flags);
134134
ASSERT_EQ(updated_user_intented_mode, state.user_intended_mode);
135135
ASSERT_EQ(failsafe.selectedAction(), FailsafeBase::Action::RTL);
136136

137-
// RC lost cleared -> keep RTL
137+
// Manual control lost cleared -> keep RTL
138138
time += 10_ms;
139139
failsafe_flags.manual_control_signal_lost = false;
140140
updated_user_intented_mode = failsafe.update(time, state, false, stick_override_request, failsafe_flags);
@@ -425,7 +425,7 @@ TEST_F(FailsafeTest, skip_failsafe)
425425
ASSERT_EQ(updated_user_intented_mode, state.user_intended_mode);
426426
ASSERT_EQ(failsafe.selectedAction(), FailsafeBase::Action::None);
427427

428-
// RC lost while in RTL -> stay in RTL and only warn
428+
// Manual control lost while in RTL -> stay in RTL and only warn
429429
failsafe_flags.manual_control_signal_lost = true;
430430

431431
updated_user_intented_mode = failsafe.update(time, state, false, false, failsafe_flags);

src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ void FlightTaskAuto::_prepareLandSetpoints()
289289
_stick_acceleration_xy.getSetpoints(_land_position, _velocity_setpoint, _acceleration_setpoint);
290290

291291
} else {
292-
// Make sure we have a valid land position even in the case we loose RC while amending it
292+
// Make sure we have a valid land position even in the case we loose manual control while amending it
293293
if (!PX4_ISFINITE(_land_position(0))) {
294294
_land_position.xy() = Vector2f(_position);
295295
}

src/modules/flight_mode_manager/tasks/AutoFollowTarget/FlightTaskAutoFollowTarget.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void FlightTaskAutoFollowTarget::updateRcAdjustedFollowHeight(const Sticks &stic
144144
{
145145
// Only apply Follow height adjustment if height setpoint and current height are within time window
146146
if (fabsf(_position_setpoint(2) - _position(2)) < FOLLOW_HEIGHT_USER_ADJUST_SPEED * USER_ADJUSTMENT_ERROR_TIME_WINDOW) {
147-
// RC Throttle stick input for changing follow height
147+
// Manual Throttle stick input for changing follow height
148148
const float height_change_speed = FOLLOW_HEIGHT_USER_ADJUST_SPEED * sticks.getThrottleZeroCenteredExpo();
149149
const float new_height = _follow_height + height_change_speed * _deltatime;
150150
_follow_height = constrain(new_height, MINIMUM_SAFETY_ALTITUDE, FOLLOW_HEIGHT_MAX);
@@ -157,7 +157,7 @@ void FlightTaskAutoFollowTarget::updateRcAdjustedFollowDistance(const Sticks &st
157157
// Only apply Follow distance adjustment if distance setting and current distance are within time window
158158
if (fabsf(drone_to_target_vector.length() - _follow_distance) < FOLLOW_DISTANCE_USER_ADJUST_SPEED *
159159
USER_ADJUSTMENT_ERROR_TIME_WINDOW) {
160-
// RC Pitch stick input for changing distance
160+
// Manual Pitch stick input for changing distance
161161
const float distance_change_speed = FOLLOW_DISTANCE_USER_ADJUST_SPEED * sticks.getPitchExpo();
162162
const float new_distance = _follow_distance + distance_change_speed * _deltatime;
163163
_follow_distance = constrain(new_distance, MINIMUM_DISTANCE_TO_TARGET_FOR_YAW_CONTROL, FOLLOW_DISTANCE_MAX);
@@ -171,9 +171,9 @@ void FlightTaskAutoFollowTarget::updateRcAdjustedFollowAngle(const Sticks &stick
171171
// Wrap orbit angle difference, to get the shortest angle between them
172172
if (fabsf(matrix::wrap_pi(measured_orbit_angle - tracked_orbit_angle_setpoint)) < FOLLOW_ANGLE_USER_ADJUST_SPEED *
173173
USER_ADJUSTMENT_ERROR_TIME_WINDOW) {
174-
// RC Roll stick input for changing follow angle. When user commands RC stick input: +Roll (right), angle increases (clockwise)
174+
// Manual Roll stick input for changing follow angle. When user commands manual stick input: +Roll (right), angle increases (clockwise)
175175
// Constrain adjust speed [rad/s] so that drone can actually catch up. Otherwise, the follow angle
176-
// command can be too ahead that drone's behavior would be un-responsive to RC stick inputs.
176+
// command can be too ahead that drone's behavior would be un-responsive to manual stick inputs.
177177
const float angle_adjust_speed_max = min(FOLLOW_ANGLE_USER_ADJUST_SPEED,
178178
_param_flw_tgt_max_vel.get() / _follow_distance);
179179
const float angle_change_speed = angle_adjust_speed_max * sticks.getRollExpo();
@@ -319,7 +319,7 @@ bool FlightTaskAutoFollowTarget::update()
319319
// Actual orbit angle measured around the target, which is pointing from target to drone, so M_PI_F difference.
320320
const float measured_orbit_angle = matrix::wrap_pi(drone_to_target_heading + M_PI_F);
321321

322-
// Update the sticks object to fetch recent data and update follow distance, angle and height via RC commands
322+
// Update the sticks object to fetch recent data and update follow distance, angle and height via manual commands
323323
_sticks.checkAndUpdateStickInputs();
324324

325325
if (_sticks.isAvailable()) {

src/modules/flight_mode_manager/tasks/AutoFollowTarget/FlightTaskAutoFollowTarget.hpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,26 +101,26 @@ static constexpr float ORBIT_TRAJECTORY_MAX_JERK = 4.0;
101101
// [m/s^2] Maximum acceleration setting for generating the Follow Target Orbit trajectory
102102
static constexpr float ORBIT_TRAJECTORY_MAX_ACCELERATION = 2.0;
103103

104-
// << RC Adjustment related constants >>
104+
// << manual Adjustment related constants >>
105105

106-
// [m/s] Speed with which the follow distance will be adjusted by when commanded with deflection via RC command
106+
// [m/s] Speed with which the follow distance will be adjusted by when commanded with deflection via sticks
107107
static constexpr float FOLLOW_DISTANCE_USER_ADJUST_SPEED = 2.0;
108108

109-
// [m] Maximum follow distance that can be set by user's RC adjustment
109+
// [m] Maximum follow distance that can be set by user's manual adjustment
110110
static constexpr float FOLLOW_DISTANCE_MAX = 100.f;
111111

112-
// [m/s] Speed with which the follow height will be adjusted by when commanded with deflection via RC command
112+
// [m/s] Speed with which the follow height will be adjusted by when commanded with deflection via sticks
113113
static constexpr float FOLLOW_HEIGHT_USER_ADJUST_SPEED = 1.5;
114114

115-
// [m] Maximum follow height that can be set by user's RC adjustment
115+
// [m] Maximum follow height that can be set by user's manual adjustment
116116
static constexpr float FOLLOW_HEIGHT_MAX = 100.f;
117117

118-
// [rad/s] Angular rate with which the follow distance will be adjusted by when commanded with full deflection via RC command
118+
// [rad/s] Angular rate with which the follow distance will be adjusted by when commanded with full deflection via sticks
119119
static constexpr float FOLLOW_ANGLE_USER_ADJUST_SPEED = 1.5;
120120

121121
// [s] Time window constant that gets multiplied to user adjustment speed, to calculate the
122122
// 'acceptable' error in orbit angle / height / distance. If the difference between the setpoint
123-
// and actual state of the drone is smaller than this error, RC adjustments get applied.
123+
// and actual state of the drone is smaller than this error, manual adjustments get applied.
124124
// Prevents setpoints diverging from the vehicle's actual position too much
125125
static constexpr float USER_ADJUSTMENT_ERROR_TIME_WINDOW = 0.5f;
126126

@@ -146,33 +146,33 @@ class FlightTaskAutoFollowTarget : public FlightTask
146146
};
147147

148148
/**
149-
* Update the Follow height based on RC commands
149+
* Update the Follow height based on stick inputs
150150
*
151151
* If the drone's height error to the setpoint is within the an user adjustment error time window
152-
* follow_height will be adjusted with a speed proportional to user RC command
152+
* follow_height will be adjusted with a speed proportional to user stick inputs
153153
*
154-
* @param sticks Sticks object to get RC commanded values for adjustments
154+
* @param sticks Sticks object to get manually values for adjustments
155155
*/
156156
void updateRcAdjustedFollowHeight(const Sticks &sticks);
157157

158158
/**
159-
* Update the Follow distance based on RC commands
159+
* Update the Follow distance based on stick inputs
160160
*
161161
* If the drone's distance error to the setpoint is within the an user adjustment error time window
162-
* follow_distance will be adjusted with a speed proportional to user RC command
162+
* follow_distance will be adjusted with a speed proportional to user stick inputs
163163
*
164-
* @param sticks Sticks object to get RC commanded values for adjustments
164+
* @param sticks Sticks object to get manually values for adjustments
165165
* @param drone_to_target_vector [m] Tracked follow distance variable reference which will be updated to the new value
166166
*/
167167
void updateRcAdjustedFollowDistance(const Sticks &sticks, const Vector2f &drone_to_target_vector);
168168

169169
/**
170-
* Update the Follow angle based on RC commands
170+
* Update the Follow angle based on stick inputs
171171
*
172172
* If the drone's orbit angle in relation to target is within the an user adjustment error time window
173-
* away from the orbit angle setpoint, follow_angle will be adjusted with a speed proportional to user RC command
173+
* away from the orbit angle setpoint, follow_angle will be adjusted with a speed proportional to user stick inputs
174174
*
175-
* @param sticks Sticks object to get RC commanded values for adjustments
175+
* @param sticks Sticks object to get manually values for adjustments
176176
* @param measured_angle [rad] Measured current drone's orbit angle around the target (depends on tracked target orientation for reference)
177177
* @param tracked_orbit_angle_setpoint [rad] Rate constrained orbit angle setpoint value from last command
178178
*/
@@ -275,7 +275,7 @@ class FlightTaskAutoFollowTarget : public FlightTask
275275
// Second Order Filter to calculate kinematically feasible target position
276276
SecondOrderReferenceModel<matrix::Vector3f> _target_position_velocity_filter;
277277

278-
// Internally tracked Follow Target characteristics, to allow RC control input adjustments
278+
// Internally tracked Follow Target characteristics, to allow manual control input adjustments
279279
float _follow_distance{8.0f}; // [m]
280280
float _follow_height{10.0f}; // [m]
281281
float _follow_angle_rad{0.0f}; // [rad]

src/modules/flight_mode_manager/tasks/Orbit/flight_task_orbit_params.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ PARAM_DEFINE_FLOAT(MC_ORBIT_RAD_MAX, 1000.0f);
5050
* @value 1 Hold Initial Heading
5151
* @value 2 Uncontrolled
5252
* @value 3 Hold Front Tangent to Circle
53-
* @value 4 RC Controlled
53+
* @value 4 Manually (yaw stick) Controlled
5454
* @group Flight Task Orbit
5555
*/
5656
PARAM_DEFINE_INT32(MC_ORBIT_YAW_MOD, 0);

src/modules/fw_autotune_attitude_control/fw_autotune_attitude_control_params.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ PARAM_DEFINE_INT32(FW_AT_APPLY, 2);
105105
PARAM_DEFINE_INT32(FW_AT_AXES, 3);
106106

107107
/**
108-
* Enable/disable auto tuning using an RC AUX input
108+
* Enable/disable auto tuning using a manual control AUX input
109109
*
110-
* Defines which RC_MAP_AUXn parameter maps the RC channel used to enable/disable auto tuning.
110+
* Defines which RC_MAP_AUXn parameter maps the manual control channel used to enable/disable auto tuning.
111111
*
112112
* @value 0 Disable
113113
* @value 1 Aux1

0 commit comments

Comments
 (0)