Revision f8cf404d components/MotorControl.cpp
components/MotorControl.cpp | ||
---|---|---|
232 | 232 |
System::getTime() - this->wheelCalibrationTime > 1500) { |
233 | 233 |
this->motorCalibrationFactor = (float)this->rightWValues[0]/(float)this->leftWValues[0]; |
234 | 234 |
|
235 |
chprintf((BaseSequentialStream*) &SD1, "motorCalibrationFactor = %f \n" ,this->motorCalibrationFactor);
|
|
236 |
chprintf((BaseSequentialStream*) &SD1, "rw = %i \n" ,this->rightWValues[0]);
|
|
237 |
chprintf((BaseSequentialStream*) &SD1, "lw = %i \n" ,this->leftWValues[0]);
|
|
235 |
chprintf((BaseSequentialStream*) &global.sercanmux1, "motorCalibrationFactor = %f \n" ,this->motorCalibrationFactor);
|
|
236 |
chprintf((BaseSequentialStream*) &global.sercanmux1, "rw = %i \n" ,this->rightWValues[0]);
|
|
237 |
chprintf((BaseSequentialStream*) &global.sercanmux1, "lw = %i \n" ,this->leftWValues[0]);
|
|
238 | 238 |
|
239 | 239 |
this->pwmPercentage[LEFT_WHEEL] = 0; |
240 | 240 |
this->pwmPercentage[RIGHT_WHEEL] = 0; |
... | ... | |
257 | 257 |
if (ziegler && ziegler2){ |
258 | 258 |
this->targetVelocity.x = 200000 * ((zieglerHelp%2 == 0) ? 1 : -1); |
259 | 259 |
this->pGain = 1000 + 100 * zieglerHelp; |
260 |
chprintf((BaseSequentialStream*) &SD1, "pgain = %i \n" , this->pGain);
|
|
260 |
chprintf((BaseSequentialStream*) &global.sercanmux1, "pgain = %i \n" , this->pGain);
|
|
261 | 261 |
zieglerHelp++; |
262 | 262 |
ziegler = false; |
263 | 263 |
ziegler2 = false; |
... | ... | |
281 | 281 |
zieglerHelp2++; |
282 | 282 |
if (zieglerHelp2 > 20){ |
283 | 283 |
this->zieglerPeriod = numberOfLastVelocitiesV * this->period / nsc; |
284 |
chprintf((BaseSequentialStream*) &SD1, "zieglerPeriod = %f \n" ,this->zieglerPeriod);
|
|
284 |
chprintf((BaseSequentialStream*) &global.sercanmux1, "zieglerPeriod = %f \n" ,this->zieglerPeriod);
|
|
285 | 285 |
|
286 | 286 |
this->targetVelocity.x = 0; |
287 | 287 |
this->pGain = (int) (this->pGain* 0.6); |
... | ... | |
290 | 290 |
this->memory->setpGain(this->pGain); |
291 | 291 |
this->memory->setiGain(this->iGain); |
292 | 292 |
this->memory->setdGain(this->dGain); |
293 |
chprintf((BaseSequentialStream*) &SD1, "pgain = %i \n" ,this->pGain);
|
|
294 |
chprintf((BaseSequentialStream*) &SD1, "igain = %f \n" ,this->iGain);
|
|
295 |
chprintf((BaseSequentialStream*) &SD1, "dgain = %f \n" ,this->dGain);
|
|
293 |
chprintf((BaseSequentialStream*) &global.sercanmux1, "pgain = %i \n" ,this->pGain);
|
|
294 |
chprintf((BaseSequentialStream*) &global.sercanmux1, "igain = %f \n" ,this->iGain);
|
|
295 |
chprintf((BaseSequentialStream*) &global.sercanmux1, "dgain = %f \n" ,this->dGain);
|
|
296 | 296 |
|
297 | 297 |
this->motorCalibration = true; |
298 | 298 |
ziegler = true; |
... | ... | |
428 | 428 |
} |
429 | 429 |
|
430 | 430 |
void MotorControl::printGains(){ |
431 |
chprintf((BaseSequentialStream*)&SD1, "motorCalibrationFactor %f\n", this->motorCalibrationFactor );
|
|
432 |
chprintf((BaseSequentialStream*)&SD1, "pGain %i\n", this->pGain );
|
|
433 |
chprintf((BaseSequentialStream*)&SD1, "iGain %f\n", this->iGain );
|
|
434 |
chprintf((BaseSequentialStream*)&SD1, "dGain %f\n", this->dGain );
|
|
431 |
chprintf((BaseSequentialStream*)&global.sercanmux1, "motorCalibrationFactor %f\n", this->motorCalibrationFactor );
|
|
432 |
chprintf((BaseSequentialStream*)&global.sercanmux1, "pGain %i\n", this->pGain );
|
|
433 |
chprintf((BaseSequentialStream*)&global.sercanmux1, "iGain %f\n", this->iGain );
|
|
434 |
chprintf((BaseSequentialStream*)&global.sercanmux1, "dGain %f\n", this->dGain );
|
|
435 | 435 |
} |
436 | 436 |
|
437 | 437 |
void MotorControl::resetGains() |
Also available in: Unified diff