summaryrefslogtreecommitdiffstats
path: root/source/AVR_Studio/Soccer/navigation.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/AVR_Studio/Soccer/navigation.c')
-rwxr-xr-xsource/AVR_Studio/Soccer/navigation.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source/AVR_Studio/Soccer/navigation.c b/source/AVR_Studio/Soccer/navigation.c
index f2c1d1c..cbdbdc9 100755
--- a/source/AVR_Studio/Soccer/navigation.c
+++ b/source/AVR_Studio/Soccer/navigation.c
@@ -28,21 +28,21 @@ void Navigation::SetzeGeschwindigkeit(int nGeschwindigkeit) {
// Aktualieren ohne Parameter
void Navigation::Aktualisieren() {
// Richtung in x und y-Kompontente zerlegen
- float y = cos(richtung); // richtung ist winkel
- float x = sin(richtung);
+ double y = cos(richtung); // richtung ist winkel
+ double x = sin(richtung);
// Abweichung der Ausrichtung ermitteln(als winkel)
int w = sensor.GetAusrichtung() - ausrichtung;
- // Stärke der einzelnen Motoren berechnen
- float v0 = x;
- float v1 = (-x+sqrt(3)*y)/2;
- float v2 = (-x-sqrt(3)*y)/2;
+ // Stärke der einzelnen Motoren berechnen
+ double v0 = (-x-sqrt(3)*y)/2;
+ double v1 = x;
+ double v2 = (-x+sqrt(3)*y)/2;
// Ausgerechnete Stärke an die Motoren übergeben
- board.motor(0,(int)v0*geschwindigkeit +w);
- board.motor(1,(int)v1*geschwindigkeit +w);
- board.motor(2,(int)v2*geschwindigkeit +w);
+ board.motor(0,(int)((double)v0*geschwindigkeit +w));
+ board.motor(1,(int)((double)v1*geschwindigkeit +w));
+ board.motor(2,(int)((double)v2*geschwindigkeit +w));
}
// Aktualieren mit allen Parametern