-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Подключил либу PIReg Добавил обработчик if для регулятора по угловой скорости * Формирование управляющего сигнала * Реализована стабилизация крена * Добавлен режим стабилизации Арминг на отдельном свитче обычное управление нижнее положение тумблера А стабилизация - среднее положение тумблера А Отправка данных в любом режиме в юарт длина сообщения 100 * Добавил ФНЧ для ПВД * Поменял лог и его скорость ТЕперь отправляет getTick и весь лог шлется каждые 50 миллисекунд * Исправил формат логирования Исправил разделители для показаний гироскопа * Минорные фиксы либы ПИ регуля Убрал лишний инклюд Добавил имена переменных в прототипы функций * Минорные фиксы Исправил 0 и 1 на flase и true * Минорные фиксы либы ПИ рега Объединил объявление и инициализацию переменной
- Loading branch information
1 parent
4d2a84f
commit f0c5398
Showing
5 changed files
with
147 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "PIReg.h" | ||
#include "math.h" | ||
|
||
PIReg::PIReg(double k_int, double k_pr, int dt) | ||
{ | ||
this->k_int = k_int; | ||
this->k_pr = k_pr; | ||
this->dt = dt; | ||
|
||
this->integral = 0; | ||
this->error = 0; | ||
this->output = 0; | ||
} | ||
|
||
void PIReg::setError(double error) | ||
{ | ||
this->error = error; | ||
} | ||
|
||
void PIReg::calcOutput(void) | ||
{ | ||
double proportional = this->k_pr*this->error; | ||
|
||
this->integral += this->error*this->k_int; | ||
|
||
this->output = proportional+this->integral; | ||
} | ||
|
||
double PIReg::getOutput(void) | ||
{ | ||
return this->output; | ||
} | ||
|
||
void PIReg::integralReset(void) | ||
{ | ||
this->integral = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef _PIREG_LIB_H_ | ||
#define _PIREG_LIB_H_ | ||
|
||
class PIReg | ||
{ | ||
private: | ||
double k_int; | ||
double k_pr; | ||
double dt; | ||
double error; | ||
double integral; | ||
double output; | ||
|
||
public: | ||
PIReg(double k_int, double k_pr, int dt); //constructor | ||
void setError(double error); | ||
void calcOutput(void); | ||
double getOutput(void); | ||
void integralReset(void); | ||
|
||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters