Revision ff7ad65b

View differences:

components/MotorControl.cpp
434 434
    chprintf((BaseSequentialStream*)&SD1, "dGain %f\n", this->dGain );
435 435
}
436 436

  
437
void MotorControl::resetGains()
438
{
439
  // reset factors
440
  chSysLock();
441
  this->motorCalibrationFactor = 1.0f;
442
  this->pGain = 1000;
443
  this->iGain = 0.08f;
444
  this->dGain = 0.01f;
445
  chSysUnlock();
446

  
447
  // write reset factors to memory
448
  this->memory->setwheelfactor(this->motorCalibrationFactor);
449
  this->memory->setpGain(this->pGain);
450
  this->memory->setiGain(this->iGain);
451
  this->memory->setdGain(this->dGain);
452

  
453
  return;
454
}
455

  
437 456

  
438 457

  
439 458
void MotorControl::calcVelocity() {
devices/DiWheelDrive/main.cpp
670 670
}
671 671

  
672 672
void shellRequestMotorCalibrate(BaseSequentialStream *chp, int argc, char *argv[]) {
673
  global.motorcontrol.resetGains();
674
  chprintf((BaseSequentialStream*)&global.sercanmux1, "motor calibration starts in five seconds...\n");
675
  BaseThread::sleep(MS2ST(5000));
673 676
  global.motorcontrol.isCalibrating = true;
674 677

  
675 678
  return;
......
681 684
  return;
682 685
}
683 686

  
687
void shellRequestMotorResetGains(BaseSequentialStream *chp, int argc, char *argv[]) {
688
  global.motorcontrol.resetGains();;
689

  
690
  return;
691
}
692

  
684 693
static const ShellCommand commands[] = {
685 694
  {"shutdown", shellRequestShutdown},
686 695
  {"wakeup", shellRequestWakeup},
......
706 715
  {"motor_stop", shellRequestMotorStop},
707 716
  {"motor_calibrate", shellRequestMotorCalibrate},
708 717
  {"motor_getGains", shellRequestMotorGetGains},
718
  {"motor_resetGains", shellRequestMotorResetGains},
709 719
  {NULL, NULL}
710 720
};
711 721

  
include/amiro/MotorControl.h
130 130
     */
131 131
    void printGains();
132 132

  
133
    /**
134
     * @brief Resets control gains.
135
     */
136
    void resetGains();
137

  
133 138
  protected:
134 139
    virtual msg_t main(void);
135 140

  

Also available in: Unified diff