New Robotics Code
Fork of Project by
Welcome to the robot wiki.
Revision 24:f4f933d9194b, committed 2013-04-13
- Comitter:
- IanTheMBEDMaster
- Date:
- Sat Apr 13 21:42:56 2013 +0000
- Parent:
- 23:806c9b8af77c
- Commit message:
- Finished up
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Apr 13 19:19:20 2013 +0000
+++ b/main.cpp Sat Apr 13 21:42:56 2013 +0000
@@ -757,79 +757,20 @@
userSetR = TSpeedR - uW;
}
-
// data recording code
- if (action == 2)
+ if (action == 2)
+ {
+ if (RecCount < 200)
{
- if (RecCount < 200)
- {
- RecX[RecCount] = eW;
- RecU[RecCount] = uW;
- RecV[RecCount] = DF;
- RecE[RecCount] = DR;
- RecCount++;
- //
- }
+ RecX[RecCount] = eW;
+ RecU[RecCount] = uW;
+ RecV[RecCount] = DF;
+ RecE[RecCount] = DR;
+ RecCount++;
}
-
-
+ }
}
-/*
-void IRChecker()
-{
- float IRF, IRR;
- float aF = 22.6321; // 34.2911
- float bF = -0.1721; // -0.2608
- float aR = 22.6021; // 34.2456
- float bR = -0.0376; // -0.0569
- // float Nominal = 25;
-
- // Read Sensors
- IRF = 3.3*IRFront.read();
- IRR = 3.3*IRRear.read();
-
-
- // Calculate distance based on voltage
- DF = aF/(IRF+bF);
- DR = aR/(IRR+bR);
-
- // Display Distances
- // BtS.printf("IRD F: %f R: %f\n\r\n", DF, DR);
-
- // Compare to nominal voltage and adjust
- while(1)
- {
- if (DF > Nominal && DR > Nominal)
- {
- userSetR = TSpeedR + Turn;
- userSetL = TSpeedL - Turn;
- break;
- }
- if (DF < Nominal && DR < Nominal)
- {
- userSetR = TSpeedR - Turn;
- userSetL = TSpeedL + Turn;
- break;
- }
-
- // Compare rangers to each other
- if (DF > DR) // IRF further than IRR
- {
- userSetR = TSpeedR + Turn;
- userSetL = TSpeedL - Turn;
- break;
- }
- if (DF < DR) // IRF closer than IRR
- {
- userSetR = TSpeedR - Turn;
- userSetL = TSpeedL + Turn;
- break;
- }
- }
-}
-*/
-
void DisplayMenu()
{
BtS.printf("\r\n\nPress the corresponding key to do something:\r\n");

