New Robotics Code
Fork of Project by
Welcome to the robot wiki.
Revision 21:c5713aafdc9d, committed 2013-04-09
- Comitter:
- LtBarbershop
- Date:
- Tue Apr 09 18:11:38 2013 +0000
- Parent:
- 20:344c088d3ead
- Child:
- 22:3cda0d788452
- Commit message:
- April 5th, 2013 - continued work on wall following.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Apr 05 17:41:23 2013 +0000
+++ b/main.cpp Tue Apr 09 18:11:38 2013 +0000
@@ -18,7 +18,7 @@
const float PWMPeriod = 0.00005;
// Control Update = 50ms (time should be 609/610) (if we want to change this we also have to change the way feedback speed is calculated)
//#define ControlUpdate 0.05
-const float ControlUpdate = 0.05;
+const float ControlUpdate = 0.04;
#define EncoderTime 610
@@ -61,7 +61,7 @@
float DR = 0;
float TSpeedL = 0;
float TSpeedR = 0;
-float Turn = 0.03;
+float Turn = 0.05;
float aeW = 0;
float eW = 0;
float uW = 0;
@@ -70,8 +70,8 @@
float Nominal = 35;
float Kpos = 0.01;
float Kor = 0.0;
-float KpW = 0.1;
-float KiW = 0.2;
+float KpW = 0.3;
+float KiW = 0.0;
Mutex Var_Lock;
@@ -184,7 +184,8 @@
break;
case 'r':
action = 4;
-
+ userSetL = 0.2;
+ userSetR = 0.2;
break;
default:
BtS.printf("\n\r Command not recognized \n\r");
@@ -200,12 +201,12 @@
switch(c)
{
case('w'):
- userSetL = userSetL + 0.05;
- userSetR = userSetR + 0.05;
+ userSetL = userSetL + 0.075;
+ userSetR = userSetR + 0.075;
break;
case('s'):
- userSetL = userSetL - 0.05;
- userSetR = userSetR - 0.05;
+ userSetL = userSetL - 0.075;
+ userSetR = userSetR - 0.075;
break;
case('a'):
userSetL = userSetL - 0.025;
@@ -411,10 +412,10 @@
//float eR = 0;
// Kp = 0.1, Ki = 0.5
- const float Kp = 0.3f;
+ const float Kp = 0.5f;
const float Ki = 0.8f;
- if (action == 2 || action == 4)
+ if (action == 2)
{
IRChecker();
}
@@ -485,10 +486,10 @@
{
if (RecCount < 100)
{
- RecX[RecCount] = DF;
- RecU[RecCount] = DR;
- RecV[RecCount] = eW;
- RecE[RecCount] = uW;
+ RecX[RecCount] = aeL;
+ RecU[RecCount] = u1;
+ RecV[RecCount] = fbSpeedL;
+ RecE[RecCount] = eL;
RecCount++;
}
}
@@ -729,6 +730,24 @@
{
DR = 80;
}
+ if (DF > 80)
+ {
+ DF = 80;
+ }
+ if (DR > 80)
+ {
+ DR = 80;
+ }
+ if (DF < 10)
+ {
+ DF = 10;
+ }
+ if (DR < 10)
+ {
+ DR = 10;
+ }
+
+
// TODO: conditions when something is too close to the sensor

