mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 09:13:32 +08:00
vtol_attitude_control: hotfix, do not update parameters on every iteration
Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
@@ -75,7 +75,7 @@ Standard::~Standard()
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
Standard::parameters_update()
|
||||
{
|
||||
float v;
|
||||
@@ -122,13 +122,10 @@ Standard::parameters_update()
|
||||
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void Standard::update_vtol_state()
|
||||
{
|
||||
parameters_update();
|
||||
|
||||
/* After flipping the switch the vehicle will start the pusher (or tractor) motor, picking up
|
||||
* forward speed. After the vehicle has picked up enough speed the rotors shutdown.
|
||||
* For the back transition the pusher motor is immediately stopped and rotors reactivated.
|
||||
|
||||
@@ -110,7 +110,6 @@ private:
|
||||
|
||||
void set_max_mc(unsigned pwm_value);
|
||||
|
||||
int parameters_update();
|
||||
|
||||
virtual void parameters_update();
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -81,7 +81,7 @@ Tailsitter::~Tailsitter()
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
Tailsitter::parameters_update()
|
||||
{
|
||||
float v;
|
||||
@@ -117,13 +117,10 @@ Tailsitter::parameters_update()
|
||||
if (_params_tailsitter.airspeed_trans < _params_tailsitter.airspeed_blend_start + 1.0f) {
|
||||
_params_tailsitter.airspeed_trans = _params_tailsitter.airspeed_blend_start + 1.0f;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void Tailsitter::update_vtol_state()
|
||||
{
|
||||
parameters_update();
|
||||
|
||||
/* simple logic using a two way switch to perform transitions.
|
||||
* after flipping the switch the vehicle will start tilting in MC control mode, picking up
|
||||
|
||||
@@ -122,7 +122,7 @@ private:
|
||||
/**
|
||||
* Update parameters.
|
||||
*/
|
||||
int parameters_update();
|
||||
virtual void parameters_update();
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -75,7 +75,7 @@ Tiltrotor::~Tiltrotor()
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
Tiltrotor::parameters_update()
|
||||
{
|
||||
float v;
|
||||
@@ -128,8 +128,6 @@ Tiltrotor::parameters_update()
|
||||
if (_params_tiltrotor.airspeed_trans < _params_tiltrotor.airspeed_blend_start + 1.0f) {
|
||||
_params_tiltrotor.airspeed_trans = _params_tiltrotor.airspeed_blend_start + 1.0f;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int Tiltrotor::get_motor_off_channels(int channels)
|
||||
@@ -154,7 +152,6 @@ int Tiltrotor::get_motor_off_channels(int channels)
|
||||
|
||||
void Tiltrotor::update_vtol_state()
|
||||
{
|
||||
parameters_update();
|
||||
|
||||
/* simple logic using a two way switch to perform transitions.
|
||||
* after flipping the switch the vehicle will start tilting rotors, picking up
|
||||
|
||||
@@ -133,7 +133,7 @@ private:
|
||||
/**
|
||||
* Update parameters.
|
||||
*/
|
||||
int parameters_update();
|
||||
virtual void parameters_update();
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -564,6 +564,11 @@ VtolAttitudeControl::parameters_update()
|
||||
_params.fw_min_alt = v;
|
||||
|
||||
|
||||
// update the parameters of the instances of base VtolType
|
||||
if (_vtol_type != nullptr) {
|
||||
_vtol_type->parameters_update();
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -139,6 +139,8 @@ public:
|
||||
|
||||
mode get_mode() {return _vtol_mode;};
|
||||
|
||||
virtual void parameters_update() = 0;
|
||||
|
||||
protected:
|
||||
VtolAttitudeControl *_attc;
|
||||
mode _vtol_mode;
|
||||
|
||||
Reference in New Issue
Block a user