@@ -207,23 +207,18 @@ FixedWingModeManager::wind_poll(const hrt_abstime now)
207
207
void
208
208
FixedWingModeManager::manual_control_setpoint_poll ()
209
209
{
210
- _manual_control_setpoint_sub. update (&_manual_control_setpoint );
210
+ _sticks. checkAndUpdateStickInputs ( );
211
211
212
- _manual_control_setpoint_for_height_rate = _manual_control_setpoint. pitch ;
213
- _manual_control_setpoint_for_airspeed = _manual_control_setpoint. throttle ;
212
+ _manual_control_setpoint_for_height_rate = _sticks. getPitch () ;
213
+ _manual_control_setpoint_for_airspeed = _sticks. getThrottleZeroCentered () ;
214
214
215
215
if (_param_fw_pos_stk_conf.get () & STICK_CONFIG_SWAP_STICKS_BIT) {
216
216
/* Alternate stick allocation (similar concept as for multirotor systems:
217
217
* demanding up/down with the throttle stick, and move faster/break with the pitch one.
218
218
*/
219
- _manual_control_setpoint_for_height_rate = -_manual_control_setpoint.throttle ;
220
- _manual_control_setpoint_for_airspeed = _manual_control_setpoint.pitch ;
221
- }
222
219
223
- // send neutral setpoints if no update for 1 s
224
- if (hrt_elapsed_time (&_manual_control_setpoint.timestamp ) > 1_s) {
225
- _manual_control_setpoint_for_height_rate = 0 .f ;
226
- _manual_control_setpoint_for_airspeed = 0 .f ;
220
+ _manual_control_setpoint_for_height_rate = -_sticks.getThrottleZeroCentered ();
221
+ _manual_control_setpoint_for_airspeed = _sticks.getPitch ();
227
222
}
228
223
}
229
224
@@ -1156,7 +1151,7 @@ FixedWingModeManager::control_auto_takeoff(const hrt_abstime &now, const float c
1156
1151
fixed_wing_runway_control_s fw_runway_control{};
1157
1152
fw_runway_control.timestamp = now;
1158
1153
fw_runway_control.wheel_steering_enabled = true ;
1159
- fw_runway_control.wheel_steering_nudging_rate = _param_rwto_nudge.get () ? _manual_control_setpoint. yaw : 0 .f ;
1154
+ fw_runway_control.wheel_steering_nudging_rate = _param_rwto_nudge.get () ? _sticks. getYaw () : 0 .f ;
1160
1155
1161
1156
_fixed_wing_runway_control_pub.publish (fw_runway_control);
1162
1157
@@ -1329,7 +1324,7 @@ FixedWingModeManager::control_auto_takeoff_no_nav(const hrt_abstime &now, const
1329
1324
fixed_wing_runway_control_s fw_runway_control{};
1330
1325
fw_runway_control.timestamp = now;
1331
1326
fw_runway_control.wheel_steering_enabled = true ;
1332
- fw_runway_control.wheel_steering_nudging_rate = _param_rwto_nudge.get () ? _manual_control_setpoint. yaw : 0 .f ;
1327
+ fw_runway_control.wheel_steering_nudging_rate = _param_rwto_nudge.get () ? _sticks. getYaw () : 0 .f ;
1333
1328
1334
1329
_fixed_wing_runway_control_pub.publish (fw_runway_control);
1335
1330
@@ -1578,7 +1573,7 @@ FixedWingModeManager::control_auto_landing_straight(const hrt_abstime &now, cons
1578
1573
fw_runway_control.timestamp = now;
1579
1574
fw_runway_control.wheel_steering_enabled = true ;
1580
1575
fw_runway_control.wheel_steering_nudging_rate = _param_fw_lnd_nudge.get () > LandingNudgingOption::kNudgingDisabled ?
1581
- _manual_control_setpoint. yaw : 0 .f ;
1576
+ _sticks. getYaw () : 0 .f ;
1582
1577
1583
1578
_fixed_wing_runway_control_pub.publish (fw_runway_control);
1584
1579
@@ -1743,7 +1738,7 @@ FixedWingModeManager::control_auto_landing_circular(const hrt_abstime &now, cons
1743
1738
fw_runway_control.timestamp = now;
1744
1739
fw_runway_control.wheel_steering_enabled = true ;
1745
1740
fw_runway_control.wheel_steering_nudging_rate = _param_fw_lnd_nudge.get () > LandingNudgingOption::kNudgingDisabled ?
1746
- _manual_control_setpoint. yaw : 0 .f ;
1741
+ _sticks. getYaw () : 0 .f ;
1747
1742
1748
1743
_fixed_wing_runway_control_pub.publish (fw_runway_control);
1749
1744
@@ -1795,7 +1790,7 @@ FixedWingModeManager::control_manual_altitude(const float control_interval, cons
1795
1790
_ctrl_configuration_handler.setPitchMin (min_pitch);
1796
1791
_ctrl_configuration_handler.setThrottleMax (throttle_max);
1797
1792
1798
- const float roll_body = _manual_control_setpoint. roll * radians (_param_fw_r_lim.get ());
1793
+ const float roll_body = _sticks. getRoll () * radians (_param_fw_r_lim.get ());
1799
1794
const DirectionalGuidanceOutput sp = {.course_setpoint = NAN, .lateral_acceleration_feedforward = rollAngleToLateralAccel (roll_body)};
1800
1795
fixed_wing_lateral_setpoint_s fw_lateral_ctrl_sp{empty_lateral_control_setpoint};
1801
1796
fw_lateral_ctrl_sp.timestamp = hrt_absolute_time ();
@@ -1831,8 +1826,8 @@ FixedWingModeManager::control_manual_position(const hrt_abstime now, const float
1831
1826
1832
1827
/* heading control */
1833
1828
// TODO: either make it course hold (easier) or a real heading hold (minus all the complexity here)
1834
- if (fabsf (_manual_control_setpoint. roll ) < HDG_HOLD_MAN_INPUT_THRESH &&
1835
- fabsf (_manual_control_setpoint. yaw ) < HDG_HOLD_MAN_INPUT_THRESH) {
1829
+ if (fabsf (_sticks. getRoll () ) < HDG_HOLD_MAN_INPUT_THRESH &&
1830
+ fabsf (_sticks. getYaw () ) < HDG_HOLD_MAN_INPUT_THRESH) {
1836
1831
1837
1832
/* heading / roll is zero, lock onto current heading */
1838
1833
if (fabsf (_yawrate) < HDG_HOLD_YAWRATE_THRESH && !_yaw_lock_engaged) {
@@ -1891,13 +1886,13 @@ FixedWingModeManager::control_manual_position(const hrt_abstime now, const float
1891
1886
_ctrl_configuration_handler.setPitchMin (min_pitch);
1892
1887
_ctrl_configuration_handler.setThrottleMax (throttle_max);
1893
1888
1894
- if (!_yaw_lock_engaged || fabsf (_manual_control_setpoint. roll ) >= HDG_HOLD_MAN_INPUT_THRESH ||
1895
- fabsf (_manual_control_setpoint. yaw ) >= HDG_HOLD_MAN_INPUT_THRESH) {
1889
+ if (!_yaw_lock_engaged || fabsf (_sticks. getRoll () ) >= HDG_HOLD_MAN_INPUT_THRESH ||
1890
+ fabsf (_sticks. getYaw () ) >= HDG_HOLD_MAN_INPUT_THRESH) {
1896
1891
1897
1892
_hdg_hold_enabled = false ;
1898
1893
_yaw_lock_engaged = false ;
1899
1894
1900
- const float roll_body = _manual_control_setpoint. roll * radians (_param_fw_r_lim.get ());
1895
+ const float roll_body = _sticks. getRoll () * radians (_param_fw_r_lim.get ());
1901
1896
fixed_wing_lateral_setpoint_s fw_lateral_ctrl_sp{empty_lateral_control_setpoint};
1902
1897
fw_lateral_ctrl_sp.timestamp = hrt_absolute_time ();
1903
1898
fw_lateral_ctrl_sp.lateral_acceleration = rollAngleToLateralAccel (roll_body);
@@ -2380,14 +2375,14 @@ FixedWingModeManager::initializeAutoLanding(const hrt_abstime &now, const positi
2380
2375
Vector2f
2381
2376
FixedWingModeManager::calculateTouchdownPosition (const float control_interval, const Vector2f &local_land_position)
2382
2377
{
2383
- if (fabsf (_manual_control_setpoint. yaw ) > MANUAL_TOUCHDOWN_NUDGE_INPUT_DEADZONE
2378
+ if (fabsf (_sticks. getYaw () ) > MANUAL_TOUCHDOWN_NUDGE_INPUT_DEADZONE
2384
2379
&& _param_fw_lnd_nudge.get () > LandingNudgingOption::kNudgingDisabled
2385
2380
&& !_flare_states.flaring ) {
2386
2381
// laterally nudge touchdown location with yaw stick
2387
2382
// positive is defined in the direction of a right hand turn starting from the approach vector direction
2388
2383
const float signed_deadzone_threshold = MANUAL_TOUCHDOWN_NUDGE_INPUT_DEADZONE * math::signNoZero (
2389
- _manual_control_setpoint. yaw );
2390
- _lateral_touchdown_position_offset += (_manual_control_setpoint. yaw - signed_deadzone_threshold) *
2384
+ _sticks. getYaw () );
2385
+ _lateral_touchdown_position_offset += (_sticks. getYaw () - signed_deadzone_threshold) *
2391
2386
MAX_TOUCHDOWN_POSITION_NUDGE_RATE * control_interval;
2392
2387
_lateral_touchdown_position_offset = math::constrain (_lateral_touchdown_position_offset, -_param_fw_lnd_td_off.get (),
2393
2388
_param_fw_lnd_td_off.get ());
0 commit comments