just a test

Dependencies:   mbed

Fork of scoreLight_Advanced by Alvaro Cassinelli

Files at this revision

API Documentation at this revision

Comitter:
mbedalvaro
Date:
Tue Dec 02 04:28:42 2014 +0000
Parent:
47:2312a8dc9658
Commit message:
this is the working version of the skin games sowtware (aka, scorelight but with pre-determined "games")

Changed in this revision

blobConfig.cpp Show annotated file Show diff for this revision Revisions of this file
classLaserSensingTrajectory.h Show annotated file Show diff for this revision Revisions of this file
hardwareIO/hardwareIO.h Show annotated file Show diff for this revision Revisions of this file
myVectorClass.h Show annotated file Show diff for this revision Revisions of this file
rigidLoop.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 2312a8dc9658 -r 7633d8e7b0d3 blobConfig.cpp
--- a/blobConfig.cpp	Tue Apr 01 14:57:37 2014 +0000
+++ b/blobConfig.cpp	Tue Dec 02 04:28:42 2014 +0000
@@ -81,7 +81,7 @@
             for (i=0; i<numblobs ; i++) {
                 float anglaux=1.0*i/numblobs*2*PI;
                 addOneRigidLoopBouncing(vector2Df(CENTER_AD_MIRROR_X+200*cos(anglaux), CENTER_AD_MIRROR_Y+200*sin(anglaux)), 
-                                        vector2Df(cos(anglaux),sin(anglaux))*10);
+                                        vector2Df(5*cos(anglaux),sin(anglaux))*10);
             }
         break;
         case VERTICAL_PINBALL_GAME:
diff -r 2312a8dc9658 -r 7633d8e7b0d3 classLaserSensingTrajectory.h
--- a/classLaserSensingTrajectory.h	Tue Apr 01 14:57:37 2014 +0000
+++ b/classLaserSensingTrajectory.h	Tue Dec 02 04:28:42 2014 +0000
@@ -14,7 +14,7 @@
 //(1) Autothreshold:
 // CONTRAST RATIO to compute autoThreshold:
 // MIN_CONTRAST_RATIO is the minimum contrast between max and min intensity necessary to "accept" a black and white zone:
-#define MIN_CONTRAST_RATIO 1.8//1.7 // 3 seems good when lookup table does not work 
+#define MIN_CONTRAST_RATIO 2.0//2.5//1.6//1.8//1.7 // 3 seems good when lookup table does not work 
 // THRESHOLD_FACTOR is where the threshold is actually placed between the min and max detected (with good contrast):
 #define THRESHOLD_FACTOR 0.5 //0.75 // 2/3 or 1/2 are good values 
 #define MIN_ACCEPTABLE_INTENSITY 16 // if maxI< this then we consider all the saccade on something black
diff -r 2312a8dc9658 -r 7633d8e7b0d3 hardwareIO/hardwareIO.h
--- a/hardwareIO/hardwareIO.h	Tue Apr 01 14:57:37 2014 +0000
+++ b/hardwareIO/hardwareIO.h	Tue Dec 02 04:28:42 2014 +0000
@@ -36,8 +36,8 @@
 
 //**** MIRRORS: 
 //The DAC is 12 bytes capable (Max=4096), but we will limit this a little. 
-#define MAX_AD_MIRRORS 3845 // note: 4095 is the absolute maximum for the SPI voltage (5V). This is for checking hardware compliance, but max and min angles can be defined for X and Y in each LivingSpot instance.
-#define MIN_AD_MIRRORS 250  // note: 0 is 0 volts for the SPI voltage. 
+#define MAX_AD_MIRRORS 4000//3845 // note: 4095 is the absolute maximum for the SPI voltage (5V). This is for checking hardware compliance, but max and min angles can be defined for X and Y in each LivingSpot instance.
+#define MIN_AD_MIRRORS 155//250  // note: 0 is 0 volts for the SPI voltage. 
 // We assume that the center of the mirror is at MAX_AD_MIRRORS/2 = 2000:
 #define CENTER_AD_MIRROR_X 2047 // This MUST BE the direction of the photodetector. 
 #define CENTER_AD_MIRROR_Y 2047 // This MUST BE the direction of the photodetector.
diff -r 2312a8dc9658 -r 7633d8e7b0d3 myVectorClass.h
--- a/myVectorClass.h	Tue Apr 01 14:57:37 2014 +0000
+++ b/myVectorClass.h	Tue Dec 02 04:28:42 2014 +0000
@@ -405,7 +405,7 @@
 inline float vector2D<T>::angleDeg( const vector2D<T>& vec ) const {
     return (float)(atan2( x*vec.y-y*vec.x, x*vec.x + y*vec.y )*RAD_TO_DEG); 
 }
-
+    
 template <class T>
 inline float vector2D<T>::angleRad( const vector2D<T>& vec ) const {
     return atan2( x*vec.y-y*vec.x, x*vec.x + y*vec.y );
diff -r 2312a8dc9658 -r 7633d8e7b0d3 rigidLoop.cpp
--- a/rigidLoop.cpp	Tue Apr 01 14:57:37 2014 +0000
+++ b/rigidLoop.cpp	Tue Dec 02 04:28:42 2014 +0000
@@ -86,7 +86,7 @@
             setColor(0x04);
              blueTouch=false;
 
-            saccadeRadius=45;//+rand()%20;
+            saccadeRadius=50;//+rand()%20;
             // default (initial) shape (the scafold belongs to the base class):
             bluePrint.buildCircularScafold(saccadeRadius, vector2Dd(0,0), 18); //(float _radius, vector2D _pos,vector2D _vel, int _numScafoldPoints);
 
@@ -144,7 +144,7 @@
             blueTouch=false;
             
             // default (initial) shape (the scafold belongs to the base class):
-            saccadeRadius=25;
+            saccadeRadius=18;
             bluePrint.buildCircularScafold(saccadeRadius, vector2Dd(0,0), 20); //(float _radius, vector2D _pos,vector2D _vel, int _numScafoldPoints);
 
             // Note: We may assume NO MASS for the center of the contour following loop. Adding mass may be interesting though (smooth motion).
@@ -203,7 +203,7 @@
             setColor(0x05);
             blueTouch=false;
             
-            saccadeRadius=30;//+rand()%20;
+            saccadeRadius=50;//+rand()%20;
             // default (initial) shape (the scafold belongs to the base class):
             bluePrint.buildCircularScafold(saccadeRadius, vector2Dd(0,0), 18); //(float _radius, vector2D _pos,vector2D _vel, int _numScafoldPoints);
 
@@ -530,7 +530,7 @@
             // ================================================================
         case  SPOT_TRACK:
         if (displaySensingBuffer.lightTouched) {
-            centerMass.pos +=recenteringVectorLoop;
+            centerMass.pos +=recenteringVectorLoop*0.6;
             centerMass.posOld=centerMass.pos; // this is necessary to compute bouceOffWalls using Verlet method... (MAKE A new variable INTEGRATION METHOD?)
             centerMass.bounceOffWalls(); // constrain position (and compute wall "hit")
             
@@ -542,7 +542,7 @@
 
             } else if (displaySensingBuffer.lightState==ALL_DARK) { // not touched nor on something white: SEARCH MODE
                 saccadeRadius+=20;
-                if (saccadeRadius>800) saccadeRadius=saccadeRadius_initial;
+                if (saccadeRadius>200) saccadeRadius=saccadeRadius_initial;
                 bluePrint.buildCircularScafold(saccadeRadius, vector2Dd(0,0), numPoints);
                 justSearched=true;
             }