Code-Work by Marian
This commit is contained in:
parent
ab9cf92c1a
commit
29618453d2
24 changed files with 1266 additions and 1012 deletions
|
@ -10,12 +10,19 @@ Ballsensor::Ballsensor() {
|
|||
winkel[5] = 260;
|
||||
winkel[6] = 300;
|
||||
winkel[7] = 330;
|
||||
|
||||
// Der Winkel ist erstmal 0
|
||||
ballwinkel = 0;
|
||||
}
|
||||
|
||||
Ballsensor::~Ballsensor() {
|
||||
}
|
||||
|
||||
int Ballsensor::getBallwinkel() {
|
||||
int Ballsensor::GetBallwinkel() {
|
||||
return ballwinkel;
|
||||
}
|
||||
|
||||
void Ballsensor::Aktualisieren() {
|
||||
// Erstelle ein Array für die Sensorwerte
|
||||
int sensor[NUM_BALLSENSOR];
|
||||
int result = 0; // und einer Variable fürs Ergebnis
|
||||
|
@ -30,6 +37,6 @@ int Ballsensor::getBallwinkel() {
|
|||
if(sensor[i] < current) result = i; // Ergebnis ist erstmal index
|
||||
}
|
||||
|
||||
// Gebe den Winkel zum index result zurück
|
||||
return winkel[result];
|
||||
// Setze den Winkel zum index result
|
||||
ballwinkel = winkel[result];
|
||||
}
|
||||
|
|
|
@ -12,11 +12,13 @@ class Ballsensor
|
|||
{
|
||||
private:
|
||||
int winkel[NUM_BALLSENSOR];
|
||||
int ballwinkel;
|
||||
public:
|
||||
Ballsensor();
|
||||
~Ballsensor();
|
||||
|
||||
int getBallwinkel(); // Gibt den aktuellen Winkel vom Ball zurück
|
||||
int GetBallwinkel(); // Gibt den aktuellen Winkel vom Ball zurück
|
||||
void Aktualisieren(); // Aktualisiert die Variable
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,10 +6,14 @@ Sensor::Sensor() :ballsensor() {
|
|||
Sensor::~Sensor() {
|
||||
}
|
||||
|
||||
// Aktualisiert die ganzen Sachen ;)
|
||||
void Sensor::Aktualisieren() {
|
||||
|
||||
position.Aktualisieren(); // Aktualisiere die Position
|
||||
ballsensor.Aktualisieren(); // Aktualisiere den Ballwinkel
|
||||
abstand.Aktualisieren(); // Aktualsiere die abstandsdaten
|
||||
}
|
||||
|
||||
int Sensor::getAusrichtung() {
|
||||
return 0;
|
||||
// Gebe die aktuelle Ausrichtung zurück
|
||||
int Sensor::GetAusrichtung() {
|
||||
return position.GetAusrichtung();
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
#include "../hal/board.h"
|
||||
#include "ballsensor.h"
|
||||
#include "../hal/maussensor.h"
|
||||
#include "position.h"
|
||||
#include "abstand.h"
|
||||
#include "../global.h"
|
||||
|
||||
extern Board board;
|
||||
|
@ -12,13 +13,15 @@ class Sensor
|
|||
{
|
||||
private:
|
||||
Ballsensor ballsensor;
|
||||
Position position;
|
||||
Abstand abstand;
|
||||
public:
|
||||
Sensor();
|
||||
~Sensor();
|
||||
|
||||
void Aktualisieren();
|
||||
|
||||
int getAusrichtung(); // Gibt die aktuelle Ausrichtung des Roboters zurück
|
||||
int GetAusrichtung(); // Gibt die aktuelle Ausrichtung des Roboters zurück
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Reference in a new issue