Gruppe 3
/
PES1
für holdor
Fork of PES by
Diff: readCamera.cpp
- Revision:
- 24:be4fd3005611
- Parent:
- 23:6feed75772b6
- Child:
- 26:c2f7c6cdeece
diff -r 6feed75772b6 -r be4fd3005611 readCamera.cpp --- a/readCamera.cpp Mon May 01 12:35:14 2017 +0000 +++ b/readCamera.cpp Mon May 01 13:25:12 2017 +0000 @@ -9,7 +9,7 @@ static int range = 1; // 1: fährt strahl an, 2: fährt kegel an static int state = 0; static double distance = 0; -static int yLimit = 90; +static int yLimit = 130; int j; uint16_t blocks; @@ -32,7 +32,7 @@ // soll drehen bis in stahl, fahren bis kegel, 25 pixel links rechts kegel - if(xAxis < 180 && xAxis > 140 && yAxis > 0 && yAxis < yLimit ) { // wenn Klotz an Position zum aufnehmen + if(xAxis < 180 && xAxis > 140 && yAxis < 199 && yAxis > yLimit ) { // wenn Klotz an Position zum aufnehmen state = 400; range = 1; printf("\n\raufnehmen\n\r"); @@ -47,7 +47,7 @@ state = 200 + (int) distance; printf("\n\rfahre rechts\n\r"); } else{ // fährt gerade - distance = (((yAxis - yLimit)/(199-yLimit))*100); + distance = (((double) yAxis - (double) yLimit)/(double) yLimit)*-100.0; state = 300 + (int) distance; if (state == 400){ state=399; @@ -59,6 +59,8 @@ if (xAxis > 185 || xAxis < 135) { range = 1; } + distance = (((double) yAxis - (double) yLimit)/(double) yLimit)*-100.0; + state = 300 + (int) distance; } }