mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 10:43:34 +08:00
vehicle constraints: remove landing gear
- landing_gear: refactor state name - Add the keep state to the landing gear message - Adapt FlightTaskManual, FlightTaskAutoMapper, mc_pos_control, to review message definition
This commit is contained in:
committed by
Dennis Mannhart
parent
6dbed6636d
commit
de185726b3
@@ -89,7 +89,7 @@ bool FlightTaskAutoMapper::update()
|
||||
// during mission and reposition, raise the landing gears but only
|
||||
// if altitude is high enough
|
||||
if (_highEnoughForLandingGear()) {
|
||||
_constraints.landing_gear = vehicle_constraints_s::GEAR_UP;
|
||||
_gear.landing_gear = landing_gear_s::GEAR_UP;
|
||||
}
|
||||
|
||||
// update previous type
|
||||
@@ -121,7 +121,7 @@ void FlightTaskAutoMapper::_generateLandSetpoints()
|
||||
// set constraints
|
||||
_constraints.tilt = MPC_TILTMAX_LND.get();
|
||||
_constraints.speed_down = MPC_LAND_SPEED.get();
|
||||
_constraints.landing_gear = vehicle_constraints_s::GEAR_DOWN;
|
||||
_gear.landing_gear = landing_gear_s::GEAR_DOWN;
|
||||
}
|
||||
|
||||
void FlightTaskAutoMapper::_generateTakeoffSetpoints()
|
||||
@@ -134,7 +134,7 @@ void FlightTaskAutoMapper::_generateTakeoffSetpoints()
|
||||
_constraints.speed_up = math::gradual(_alt_above_ground, MPC_LAND_ALT2.get(),
|
||||
MPC_LAND_ALT1.get(), MPC_TKO_SPEED.get(), _constraints.speed_up);
|
||||
|
||||
_constraints.landing_gear = vehicle_constraints_s::GEAR_DOWN;
|
||||
_gear.landing_gear = landing_gear_s::GEAR_DOWN;
|
||||
}
|
||||
|
||||
void FlightTaskAutoMapper::_generateVelocitySetpoints()
|
||||
@@ -173,4 +173,4 @@ bool FlightTaskAutoMapper::_highEnoughForLandingGear()
|
||||
{
|
||||
// return true if altitude is above two meters
|
||||
return _alt_above_ground > 2.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ bool FlightTaskAutoMapper2::update()
|
||||
// during mission and reposition, raise the landing gears but only
|
||||
// if altitude is high enough
|
||||
if (_highEnoughForLandingGear()) {
|
||||
_constraints.landing_gear = vehicle_constraints_s::GEAR_UP;
|
||||
_gear.landing_gear = landing_gear_s::GEAR_UP;
|
||||
}
|
||||
|
||||
// update previous type
|
||||
@@ -129,7 +129,7 @@ void FlightTaskAutoMapper2::_prepareLandSetpoints()
|
||||
|
||||
// set constraints
|
||||
_constraints.tilt = MPC_TILTMAX_LND.get();
|
||||
_constraints.landing_gear = vehicle_constraints_s::GEAR_DOWN;
|
||||
_gear.landing_gear = landing_gear_s::GEAR_DOWN;
|
||||
}
|
||||
|
||||
void FlightTaskAutoMapper2::_prepareTakeoffSetpoints()
|
||||
@@ -139,7 +139,7 @@ void FlightTaskAutoMapper2::_prepareTakeoffSetpoints()
|
||||
const float speed_tko = (_alt_above_ground > MPC_LAND_ALT1.get()) ? _constraints.speed_up : MPC_TKO_SPEED.get();
|
||||
_velocity_setpoint = Vector3f(NAN, NAN, -speed_tko); // Limit the maximum vertical speed
|
||||
|
||||
_constraints.landing_gear = vehicle_constraints_s::GEAR_DOWN;
|
||||
_gear.landing_gear = landing_gear_s::GEAR_DOWN;
|
||||
}
|
||||
|
||||
void FlightTaskAutoMapper2::_prepareVelocitySetpoints()
|
||||
|
||||
@@ -91,7 +91,7 @@ bool FlightTaskManual::_evaluateSticks()
|
||||
// until he toggles the switch to avoid retracting the gear immediately on takeoff.
|
||||
int8_t gear_switch = _sub_manual_control_setpoint->get().gear_switch;
|
||||
|
||||
if (!_constraints.landing_gear) {
|
||||
if (!_gear.landing_gear) {
|
||||
if (gear_switch == manual_control_setpoint_s::SWITCH_POS_OFF) {
|
||||
_applyGearSwitch(gear_switch);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ bool FlightTaskManual::_evaluateSticks()
|
||||
/* Timeout: set all sticks to zero */
|
||||
_sticks.zero();
|
||||
_sticks_expo.zero();
|
||||
_constraints.landing_gear = vehicle_constraints_s::GEAR_KEEP;
|
||||
_gear.landing_gear = landing_gear_s::GEAR_KEEP;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -120,10 +120,10 @@ bool FlightTaskManual::_evaluateSticks()
|
||||
void FlightTaskManual::_applyGearSwitch(uint8_t gswitch)
|
||||
{
|
||||
if (gswitch == manual_control_setpoint_s::SWITCH_POS_OFF) {
|
||||
_constraints.landing_gear = vehicle_constraints_s::GEAR_DOWN;
|
||||
_gear.landing_gear = landing_gear_s::GEAR_DOWN;
|
||||
}
|
||||
|
||||
if (gswitch == manual_control_setpoint_s::SWITCH_POS_ON) {
|
||||
_constraints.landing_gear = vehicle_constraints_s::GEAR_UP;
|
||||
_gear.landing_gear = landing_gear_s::GEAR_UP;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user