mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-28 05:50:35 +08:00
Modify occurrences of control_mode to vehicle_control_mode in MulticopterPositionControl.cpp/hpp to reflect the existing naming convention in the files.
This commit is contained in:
@@ -273,7 +273,7 @@ void MulticopterPositionControl::Run()
|
||||
const bool was_in_failsafe = _in_failsafe;
|
||||
_in_failsafe = false;
|
||||
|
||||
_control_mode_sub.update(&_control_mode);
|
||||
_vehicle_control_mode_sub.update(&_vehicle_control_mode);
|
||||
_vehicle_land_detected_sub.update(&_vehicle_land_detected);
|
||||
|
||||
if (_param_mpc_use_hte.get()) {
|
||||
@@ -288,7 +288,7 @@ void MulticopterPositionControl::Run()
|
||||
|
||||
PositionControlStates states{set_vehicle_states(local_pos)};
|
||||
|
||||
if (_control_mode.flag_multicopter_position_control_enabled) {
|
||||
if (_vehicle_control_mode.flag_multicopter_position_control_enabled) {
|
||||
|
||||
_trajectory_setpoint_sub.update(&_setpoint);
|
||||
|
||||
@@ -326,9 +326,9 @@ void MulticopterPositionControl::Run()
|
||||
_vehicle_constraints.speed_up = _param_mpc_z_vel_max_up.get();
|
||||
}
|
||||
|
||||
if (_control_mode.flag_control_offboard_enabled) {
|
||||
if (_vehicle_control_mode.flag_control_offboard_enabled) {
|
||||
|
||||
bool want_takeoff = _control_mode.flag_armed && _vehicle_land_detected.landed
|
||||
bool want_takeoff = _vehicle_control_mode.flag_armed && _vehicle_land_detected.landed
|
||||
&& hrt_elapsed_time(&_setpoint.timestamp) < 1_s;
|
||||
|
||||
if (want_takeoff && PX4_ISFINITE(_setpoint.z)
|
||||
@@ -357,11 +357,12 @@ void MulticopterPositionControl::Run()
|
||||
}
|
||||
|
||||
// handle smooth takeoff
|
||||
_takeoff.updateTakeoffState(_control_mode.flag_armed, _vehicle_land_detected.landed, _vehicle_constraints.want_takeoff,
|
||||
_takeoff.updateTakeoffState(_vehicle_control_mode.flag_armed, _vehicle_land_detected.landed,
|
||||
_vehicle_constraints.want_takeoff,
|
||||
_vehicle_constraints.speed_up, false, time_stamp_now);
|
||||
|
||||
const bool not_taken_off = (_takeoff.getTakeoffState() < TakeoffState::rampup);
|
||||
const bool flying = (_takeoff.getTakeoffState() >= TakeoffState::flight);
|
||||
const bool not_taken_off = (_takeoff.getTakeoffState() < TakeoffState::rampup);
|
||||
const bool flying = (_takeoff.getTakeoffState() >= TakeoffState::flight);
|
||||
const bool flying_but_ground_contact = (flying && _vehicle_land_detected.ground_contact);
|
||||
|
||||
// make sure takeoff ramp is not amended by acceleration feed-forward
|
||||
@@ -456,7 +457,8 @@ void MulticopterPositionControl::Run()
|
||||
|
||||
} else {
|
||||
// an update is necessary here because otherwise the takeoff state doesn't get skiped with non-altitude-controlled modes
|
||||
_takeoff.updateTakeoffState(_control_mode.flag_armed, _vehicle_land_detected.landed, false, 10.f, true, time_stamp_now);
|
||||
_takeoff.updateTakeoffState(_vehicle_control_mode.flag_armed, _vehicle_land_detected.landed, false, 10.f, true,
|
||||
time_stamp_now);
|
||||
}
|
||||
|
||||
// Publish takeoff status
|
||||
@@ -485,7 +487,7 @@ void MulticopterPositionControl::failsafe(const hrt_abstime &now, vehicle_local_
|
||||
const PositionControlStates &states, bool warn)
|
||||
{
|
||||
// do not warn while we are disarmed, as we might not have valid setpoints yet
|
||||
if (!_control_mode.flag_armed) {
|
||||
if (!_vehicle_control_mode.flag_armed) {
|
||||
warn = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user