#include <avr/io.h>
#include "motorcontroller.h"
#include "timer.h"
Functions | |
void | setPortD (void) |
Set portD as output. | |
void | setMotorSpeed (double uTotal) |
Sets the speed and direction of the motor. | |
double | setError (double presentValue) |
Calculate the error. | |
double | pController (void) |
Proportional controller. | |
double | dController (void) |
Derrivative controller. | |
Variables | |
double | oldError = 0 |
double | error = 0 |
double | timeGap = 0 |
const int | KP = 250 |
const int | KD = 20 |
double dController | ( | void | ) |
Derrivative controller.
double pController | ( | void | ) |
Proportional controller.
double setError | ( | double | presentValue | ) |
Calculate the error.
presentValue | Frequency to determine the error from |
void setMotorSpeed | ( | double | uTotal | ) |
Sets the speed and direction of the motor.
uTotal | Value calculated by the PD-controller |
void setPortD | ( | void | ) |
Set portD as output.
double error = 0 |
const int KD = 20 |
const int KP = 250 |
double oldError = 0 |
double timeGap = 0 |