Revision 98e7c69b components/MotorControl.cpp
| components/MotorControl.cpp | ||
|---|---|---|
| 540 | 540 |
} |
| 541 | 541 |
|
| 542 | 542 |
|
| 543 |
void MotorControl::setGains(motorGains *motorConfig){
|
|
| 544 |
chSysLock(); |
|
| 545 |
this->pGain = motorConfig->pGain; |
|
| 546 |
this->iGain = motorConfig->iGain; |
|
| 547 |
this->dGain = motorConfig->dGain; |
|
| 548 |
chSysUnlock(); |
|
| 549 |
} |
|
| 550 |
|
|
| 551 |
void MotorControl::getGains(motorGains *motorConfig){
|
|
| 552 |
motorGains gains; |
|
| 553 |
motorConfig->pGain = this->pGain; |
|
| 554 |
motorConfig->iGain = this->iGain; |
|
| 555 |
motorConfig->dGain = this->dGain; |
|
| 556 |
} |
|
| 557 | 543 |
|
| 558 | 544 |
void MotorControl::setMotorEnable(bool enable){
|
| 545 |
this->accumulatedErrorV = 0; |
|
| 546 |
this->accumulatedErrorW = 0; |
|
| 559 | 547 |
this->motorEnable = enable; |
| 560 | 548 |
} |
| 561 | 549 |
|
| 562 | 550 |
bool MotorControl::getMotorEnable(){
|
| 563 |
|
|
| 564 | 551 |
return this->motorEnable; |
| 565 | 552 |
} |
| 566 |
|
|
| 567 |
void MotorControl::toggleMotorEnable(){
|
|
| 568 |
this->accumulatedErrorV = 0; |
|
| 569 |
this->accumulatedErrorW = 0; |
|
| 570 |
this->motorEnable = !this->motorEnable; |
|
| 571 |
} |
|
Also available in: Unified diff