mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 10:46:33 +08:00
mc_att_control: don't store full vehicle_land_detected copy
This commit is contained in:
@@ -114,7 +114,6 @@ private:
|
|||||||
struct manual_control_setpoint_s _manual_control_setpoint {}; /**< manual control setpoint */
|
struct manual_control_setpoint_s _manual_control_setpoint {}; /**< manual control setpoint */
|
||||||
struct vehicle_control_mode_s _v_control_mode {}; /**< vehicle control mode */
|
struct vehicle_control_mode_s _v_control_mode {}; /**< vehicle control mode */
|
||||||
struct vehicle_status_s _vehicle_status {}; /**< vehicle status */
|
struct vehicle_status_s _vehicle_status {}; /**< vehicle status */
|
||||||
struct vehicle_land_detected_s _vehicle_land_detected {};
|
|
||||||
|
|
||||||
perf_counter_t _loop_perf; /**< loop duration performance counter */
|
perf_counter_t _loop_perf; /**< loop duration performance counter */
|
||||||
|
|
||||||
@@ -127,6 +126,7 @@ private:
|
|||||||
|
|
||||||
hrt_abstime _last_run{0};
|
hrt_abstime _last_run{0};
|
||||||
|
|
||||||
|
bool _landed{true};
|
||||||
bool _reset_yaw_sp{true};
|
bool _reset_yaw_sp{true};
|
||||||
|
|
||||||
uint8_t _quat_reset_counter{0};
|
uint8_t _quat_reset_counter{0};
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ MulticopterAttitudeControl::parameters_updated()
|
|||||||
float
|
float
|
||||||
MulticopterAttitudeControl::throttle_curve(float throttle_stick_input)
|
MulticopterAttitudeControl::throttle_curve(float throttle_stick_input)
|
||||||
{
|
{
|
||||||
const float throttle_min = _vehicle_land_detected.landed ? 0.0f : _param_mpc_manthr_min.get();
|
const float throttle_min = _landed ? 0.0f : _param_mpc_manthr_min.get();
|
||||||
|
|
||||||
// throttle_stick_input is in range [0, 1]
|
// throttle_stick_input is in range [0, 1]
|
||||||
switch (_param_mpc_thr_curve.get()) {
|
switch (_param_mpc_thr_curve.get()) {
|
||||||
@@ -268,7 +268,15 @@ MulticopterAttitudeControl::Run()
|
|||||||
/* check for updates in other topics */
|
/* check for updates in other topics */
|
||||||
_manual_control_setpoint_sub.update(&_manual_control_setpoint);
|
_manual_control_setpoint_sub.update(&_manual_control_setpoint);
|
||||||
_v_control_mode_sub.update(&_v_control_mode);
|
_v_control_mode_sub.update(&_v_control_mode);
|
||||||
_vehicle_land_detected_sub.update(&_vehicle_land_detected);
|
|
||||||
|
if (_vehicle_land_detected_sub.updated()) {
|
||||||
|
vehicle_land_detected_s vehicle_land_detected;
|
||||||
|
|
||||||
|
if (_vehicle_land_detected_sub.copy(&vehicle_land_detected)) {
|
||||||
|
_landed = vehicle_land_detected.landed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_vehicle_status_sub.update(&_vehicle_status);
|
_vehicle_status_sub.update(&_vehicle_status);
|
||||||
|
|
||||||
/* Check if we are in rattitude mode and the pilot is above the threshold on pitch
|
/* Check if we are in rattitude mode and the pilot is above the threshold on pitch
|
||||||
@@ -334,8 +342,7 @@ MulticopterAttitudeControl::Run()
|
|||||||
// reset yaw setpoint during transitions, tailsitter.cpp generates
|
// reset yaw setpoint during transitions, tailsitter.cpp generates
|
||||||
// attitude setpoint for the transition
|
// attitude setpoint for the transition
|
||||||
_reset_yaw_sp = (!attitude_setpoint_generated && !_v_control_mode.flag_control_rattitude_enabled) ||
|
_reset_yaw_sp = (!attitude_setpoint_generated && !_v_control_mode.flag_control_rattitude_enabled) ||
|
||||||
_vehicle_land_detected.landed ||
|
_landed || (_vehicle_status.is_vtol && _vehicle_status.in_transition_mode);
|
||||||
(_vehicle_status.is_vtol && _vehicle_status.in_transition_mode);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user