Bug fix
This commit is contained in:
@@ -173,33 +173,24 @@ void FlightController::stopAllRotors() {
|
||||
|
||||
void FlightController::setHeightControllerParams(float p, float i, float d) {
|
||||
if (_status == DeviceStatus::Idle) {
|
||||
_heightController->Kp = p;
|
||||
_heightController->Ki = i;
|
||||
_heightController->Kd = d;
|
||||
_heightController->save();
|
||||
_heightController->setParams({.p = p, .i = i, .d = d});
|
||||
}
|
||||
}
|
||||
|
||||
void FlightController::setYawControllerParams(float p, float i, float d) {
|
||||
if (_status == DeviceStatus::Idle) {
|
||||
_yawController->Kp = p;
|
||||
_yawController->Ki = i;
|
||||
_yawController->Kd = d;
|
||||
_heightController->save();
|
||||
_heightController->setParams({.p = p, .i = i, .d = d});
|
||||
}
|
||||
}
|
||||
|
||||
void FlightController::setPitchControllerParams(float p, float i, float d) {
|
||||
if (_status == DeviceStatus::Idle) {
|
||||
_tailRotorController->Kp = p;
|
||||
_tailRotorController->Ki = i;
|
||||
_tailRotorController->Kd = d;
|
||||
_heightController->save();
|
||||
_heightController->setParams({.p = p, .i = i, .d = d});
|
||||
}
|
||||
}
|
||||
|
||||
PidSettings FlightController::pidSettings() const {
|
||||
PidSettings settings;
|
||||
PidSettings settings{};
|
||||
settings.flightController = {.p = _heightController->Kp, .i = _heightController->Ki, .d = _heightController->Kd};
|
||||
settings.yawController = {.p = _yawController->Kp, .i = _yawController->Ki, .d = _yawController->Kd};
|
||||
settings.pitchController = {.p = _tailRotorController->Kp, .i = _tailRotorController->Ki, .d = _tailRotorController->Kd};
|
||||
|
||||
@@ -26,13 +26,14 @@ public:
|
||||
this->Kp = params.p;
|
||||
this->Ki = params.i;
|
||||
this->Kd = params.d;
|
||||
save();
|
||||
}
|
||||
|
||||
std::shared_ptr<PidParams> getParams() {
|
||||
std::shared_ptr params = std::make_unique<PidParams>();
|
||||
params->p = Kp;
|
||||
params->i = Ki;
|
||||
params->d = Kd;
|
||||
PidParams getParams() {
|
||||
PidParams params{};
|
||||
params.p = Kp;
|
||||
params.i = Ki;
|
||||
params.d = Kd;
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user