Laser Sensing Display for UI interfaces in the real world

Dependencies:   mbed

Fork of skinGames_forktest by Alvaro Cassinelli

Revision:
7:0df17f3078bc
Parent:
5:73cd58b58f95
Child:
8:5816bb17536b
--- a/main.cpp	Thu Apr 05 13:06:24 2012 +0000
+++ b/main.cpp	Sat Apr 07 14:46:51 2012 +0000
@@ -16,7 +16,7 @@
 
 
 // To test the time it takes for executing one loop in the main program:
-#define LOOPTIMECOMPUTE
+//#define LOOPTIMECOMPUTE
 
 // To get serial commands (for debug, or other things using a Terminal - for instance, a laser scan)
 //#define SERIAL_COMMANDS
@@ -105,12 +105,13 @@
 
     // Tested modes:
     blobconf.clearConfig();
-   blobconf.addOneElasticLoopContractCentral();
+  blobconf.addOneElasticLoopContractCentral();
 //  blobconf.addOneElasticContourFollowing();
 
-//  blobconf.addOneRigidLoopBouncing();
+//blobconf.addOneRigidLoopBouncing();
 // blobconf.addOneRigidLoopFollowing();
 
+
 //blobconf.addOneRigidLoopTest();
 
     // Important: first, set the initial position for all the blobs, this will be useful because
@@ -124,7 +125,7 @@
     lsr.setConfigToRender(&blobconf);
 
     // Timer on the rendering function of the oneLoop object:
-   //  timerForRendering.attach(&lsr, &simpleLaserSensingRenderer::laserRenderThreadONEBLOBONLY, RENDER_INTERVAL); // the address of the object, member function, and interval (in seconds)
+   // timerForRendering.attach(&lsr, &simpleLaserSensingRenderer::laserRenderThreadONEBLOBONLY, RENDER_INTERVAL); // the address of the object, member function, and interval (in seconds)
    timerForRendering.attach(&lsr, &simpleLaserSensingRenderer::laserRenderThread, RENDER_INTERVAL); // the address of the object, member function, and interval (in seconds)
 
     // Timer for sending OSC data:
@@ -140,8 +141,9 @@
 
     while (true) {
 
-
-        if (measureUpdatePeriod.read_ms()>2) { // 4 or 5 ms seems to be the minimum time required for performing one main loop (for a blob of 40 points)
+        //NOTE: the updating period needs to be calculated as a function of the number of diplays points and the "refresh" rate of the laser.
+        // THIS IS THE EQUICALENT OF "VERTICAL SYNCH"...
+        if (measureUpdatePeriod.read_ms()>3) { // 4 or 5 ms seems to be the minimum time required for performing one main loop (for a blob of 40 points)
                                                // with laser rendering ISR every 110us (total loop time 4300us, 3100us of effective loop time, and each laser interrupt about 30us)
             measureUpdatePeriod.stop();
             measureUpdatePeriod.reset();
@@ -200,6 +202,7 @@
             sendMes.setSubAddress("/");
             long x=(long)(int(measureLoopPeriod.read_us()/1000.0));
            // long x=(long)(blobconf.blobArray[0]->displaySensingBuffer.lsdTrajectory.size());
+           // long x=(long)(blobconf.blobArray[0]->normRecenteringVector);
             sendMes.setArgs( "i", &x);
             osc.sendOsc( &sendMes );
             timeCounterNum=0;