mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 06:31:35 +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()
|
Standard::parameters_update()
|
||||||
{
|
{
|
||||||
float v;
|
float v;
|
||||||
@@ -122,13 +122,10 @@ Standard::parameters_update()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Standard::update_vtol_state()
|
void Standard::update_vtol_state()
|
||||||
{
|
{
|
||||||
parameters_update();
|
|
||||||
|
|
||||||
/* After flipping the switch the vehicle will start the pusher (or tractor) motor, picking up
|
/* 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.
|
* 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.
|
* 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);
|
void set_max_mc(unsigned pwm_value);
|
||||||
|
|
||||||
int parameters_update();
|
virtual void parameters_update();
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ Tailsitter::~Tailsitter()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
Tailsitter::parameters_update()
|
Tailsitter::parameters_update()
|
||||||
{
|
{
|
||||||
float v;
|
float v;
|
||||||
@@ -117,13 +117,10 @@ Tailsitter::parameters_update()
|
|||||||
if (_params_tailsitter.airspeed_trans < _params_tailsitter.airspeed_blend_start + 1.0f) {
|
if (_params_tailsitter.airspeed_trans < _params_tailsitter.airspeed_blend_start + 1.0f) {
|
||||||
_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()
|
void Tailsitter::update_vtol_state()
|
||||||
{
|
{
|
||||||
parameters_update();
|
|
||||||
|
|
||||||
/* simple logic using a two way switch to perform transitions.
|
/* 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
|
* after flipping the switch the vehicle will start tilting in MC control mode, picking up
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Update parameters.
|
* Update parameters.
|
||||||
*/
|
*/
|
||||||
int parameters_update();
|
virtual void parameters_update();
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ Tiltrotor::~Tiltrotor()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
Tiltrotor::parameters_update()
|
Tiltrotor::parameters_update()
|
||||||
{
|
{
|
||||||
float v;
|
float v;
|
||||||
@@ -128,8 +128,6 @@ Tiltrotor::parameters_update()
|
|||||||
if (_params_tiltrotor.airspeed_trans < _params_tiltrotor.airspeed_blend_start + 1.0f) {
|
if (_params_tiltrotor.airspeed_trans < _params_tiltrotor.airspeed_blend_start + 1.0f) {
|
||||||
_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)
|
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()
|
void Tiltrotor::update_vtol_state()
|
||||||
{
|
{
|
||||||
parameters_update();
|
|
||||||
|
|
||||||
/* simple logic using a two way switch to perform transitions.
|
/* simple logic using a two way switch to perform transitions.
|
||||||
* after flipping the switch the vehicle will start tilting rotors, picking up
|
* after flipping the switch the vehicle will start tilting rotors, picking up
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Update parameters.
|
* Update parameters.
|
||||||
*/
|
*/
|
||||||
int parameters_update();
|
virtual void parameters_update();
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -564,6 +564,11 @@ VtolAttitudeControl::parameters_update()
|
|||||||
_params.fw_min_alt = v;
|
_params.fw_min_alt = v;
|
||||||
|
|
||||||
|
|
||||||
|
// update the parameters of the instances of base VtolType
|
||||||
|
if (_vtol_type != nullptr) {
|
||||||
|
_vtol_type->parameters_update();
|
||||||
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ public:
|
|||||||
|
|
||||||
mode get_mode() {return _vtol_mode;};
|
mode get_mode() {return _vtol_mode;};
|
||||||
|
|
||||||
|
virtual void parameters_update() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
VtolAttitudeControl *_attc;
|
VtolAttitudeControl *_attc;
|
||||||
mode _vtol_mode;
|
mode _vtol_mode;
|
||||||
|
|||||||
Reference in New Issue
Block a user