summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/Concept/Framework/main.c')
-rwxr-xr-xsource/Concept/Framework/main.c53
1 files changed, 45 insertions, 8 deletions
diff --git a/source/Concept/Framework/main.c b/source/Concept/Framework/main.c
index fa6d718..7822933 100755
--- a/source/Concept/Framework/main.c
+++ b/source/Concept/Framework/main.c
@@ -132,13 +132,54 @@ int main()
uint16 value = 0;
int8 value2 = 0;
Display* ourDisplay = localRobot->GetModule<Display>(IO_DISPLAY_MAIN);
+ Keyboard* ourKeyboard = localRobot->GetModule<Keyboard>(IO_KEYBOARD_MAIN);
uint32 i = 1;
- Ball_Tracker* ourBallTracker = localRobot->GetModule<Ball_Tracker>(IO_BALL_TRACKER_MAIN);
+ Navigator* ourNavigator = localRobot->GetModule<Navigator>(IO_NAVIGATOR_MAIN);
+ float rotation = 0;
+
+ ourDisplay->Print("Starting...", 1, 1);
//Run
while(true)
{
- msleep(500);
+ uint8 someInput = ourKeyboard->GetInput();
+ switch(someInput)
+ {
+ case 1:
+ ourNavigator->Drive(225.0f * PI / 180.0f, rotation, 200, rotation);
+ break;
+ case 2:
+ ourNavigator->Drive(180.0f * PI / 180.0f, rotation, 200, rotation);
+ break;
+ case 3:
+ ourNavigator->Drive(135.0f * PI / 180.0f, rotation, 200, rotation);
+ break;
+ case 4:
+ ourNavigator->Drive(270.0f * PI / 180.0f, rotation, 200, rotation);
+ break;
+ case 5:
+ ourNavigator->Stop();
+ break;
+ case 6:
+ ourNavigator->Drive(90.0f * PI / 180.0f, rotation, 200, rotation);
+ break;
+ case 7:
+ ourNavigator->Drive(315.0f * PI / 180.0f, rotation, 200, rotation);
+ break;
+ case 8:
+ ourNavigator->Drive(0.0f * PI / 180.0f, rotation, 200, rotation);
+ break;
+ case 9:
+ ourNavigator->Drive(45.0f * PI / 180.0f, rotation, 200, rotation);
+ break;
+ case 10:
+ rotation -= 10;
+ break;
+ case 12:
+ rotation += 10;
+ break;
+ }
+ msleep(50);/*
ourDisplay->Clear();
ourDisplay->Print(i++);
ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_0_DEG);
@@ -172,15 +213,11 @@ int main()
ourSensor = localRobot->GetModule<IR_Sensor>(IO_SENSOR_IR_330_DEG);
value = ourSensor->GetIRIntensity();
ourDisplay->Print(value);
- ourDisplay->Print(";");
- value2 = (localRobot->GetModule<Mouse_Sensor>(IO_SENSOR_MOUSE_LEFT))->GetXMovement();
- ourDisplay->Print(value2, 10, 4);
- value2 = (localRobot->GetModule<Mouse_Sensor>(IO_SENSOR_MOUSE_LEFT))->GetYMovement();
- ourDisplay->Print(value2, 15, 4);
+ ourDisplay->Print(";");*/
localRobot->Update();
- ourDisplay->PrintFloat(ourBallTracker->GetBallDirection(), 1, 4);
+ //ourDisplay->PrintFloat(ourBallTracker->GetBallDirection(), 1, 4);
}
//Cleanup