Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of scoreLight_Advanced by
simpleLaserRenderer.h@15:56a0bf424e8d, 2012-04-12 (annotated)
- Committer:
- mbedalvaro
- Date:
- Thu Apr 12 14:50:50 2012 +0000
- Revision:
- 15:56a0bf424e8d
- Parent:
- 14:0fc33a3a7b4b
- Child:
- 16:2ff1cb2ae1b1
this is not bad, but still two or more spots produce problems. Need to re-trace TWICE a spot - or do like before, do a little more of it's trajectory.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedalvaro | 0:345b3bc7a0ea | 1 | #ifndef simpleLaserSensingRenderer_h |
mbedalvaro | 0:345b3bc7a0ea | 2 | #define simpleLaserSensingRenderer_h |
mbedalvaro | 0:345b3bc7a0ea | 3 | |
mbedalvaro | 0:345b3bc7a0ea | 4 | #include "blobConfig.h" |
mbedalvaro | 0:345b3bc7a0ea | 5 | // Include hardware interface for display and sensing: |
mbedalvaro | 0:345b3bc7a0ea | 6 | #include "hardwareIO.h" |
mbedalvaro | 0:345b3bc7a0ea | 7 | |
mbedalvaro | 0:345b3bc7a0ea | 8 | //extern DigitalOut myled3; // for tests... |
mbedalvaro | 0:345b3bc7a0ea | 9 | |
mbedalvaro | 0:345b3bc7a0ea | 10 | #define debugDelayMirrors // this is to check visually the mirror delay (but it is also beautiful) |
mbedalvaro | 0:345b3bc7a0ea | 11 | |
mbedalvaro | 15:56a0bf424e8d | 12 | #define RED_BLANKING // note: RED blanking introduce a lot of problems because the Lock-in looses signal |
mbedalvaro | 15:56a0bf424e8d | 13 | |
mbedalvaro | 5:73cd58b58f95 | 14 | #define RENDER_INTERVAL 0.00011 // good value in previous version (monaco) was 0.00011 // in seconds (Ticker) |
mbedalvaro | 4:f9d364f10335 | 15 | |
mbedalvaro | 14:0fc33a3a7b4b | 16 | #define WAIT_NORMAL 0 // good :0 // (minimum is 0) waiting time for setting mirror position MINUS waiting laser time (note that this total waiting time may be equal to 0 if we set a good sampling freq for the renderer, but |
mbedalvaro | 4:f9d364f10335 | 17 | // and if the shape is regular so that this time does not change significatively - this is not the case for multiple blobs or highly deformed blobs). |
mbedalvaro | 15:56a0bf424e8d | 18 | #define WAIT_LASER 0 // (minimum is 0) waiting time for activating the laser (if there are color changes IN BETWEEN points). Maybe needed for the green laser |
mbedalvaro | 15:56a0bf424e8d | 19 | // WHEN THERE IS MORE THAN ONE SPOT: |
mbedalvaro | 15:56a0bf424e8d | 20 | #define WAIT_FIRST 4 // special waiting time for mirror positining to first point on next blob BEFORE activating laser |
mbedalvaro | 15:56a0bf424e8d | 21 | #define WAIT_FIRST_LASER 2 // IMPORTANT waiting time for the activation of the RED laser and LOCK-IN (also waiting time for the mirrors) |
mbedalvaro | 9:3321170d157c | 22 | #define WAIT_LAST 2 // special waiting time for last point |
mbedalvaro | 4:f9d364f10335 | 23 | |
mbedalvaro | 4:f9d364f10335 | 24 | enum lsdStateType {NORMAL_POINT, LAST_POINT, MOVE_NEXT_BLOB, START_POINT}; |
mbedalvaro | 0:345b3bc7a0ea | 25 | |
mbedalvaro | 0:345b3bc7a0ea | 26 | class simpleLaserSensingRenderer { |
mbedalvaro | 0:345b3bc7a0ea | 27 | public: |
mbedalvaro | 0:345b3bc7a0ea | 28 | |
mbedalvaro | 0:345b3bc7a0ea | 29 | void setConfigToRender(blobConfig*); |
mbedalvaro | 0:345b3bc7a0ea | 30 | //void startRenderer(); // pb: I cannot use the ticker function inside the class! |
mbedalvaro | 0:345b3bc7a0ea | 31 | void laserRenderThread(); |
mbedalvaro | 7:0df17f3078bc | 32 | void laserRenderThreadONEBLOBONLY(); |
mbedalvaro | 0:345b3bc7a0ea | 33 | // void laserRender(blobConfig*); |
mbedalvaro | 0:345b3bc7a0ea | 34 | |
mbedalvaro | 0:345b3bc7a0ea | 35 | blobConfig* ptBlobCfToRender; |
mbedalvaro | 4:f9d364f10335 | 36 | |
mbedalvaro | 4:f9d364f10335 | 37 | lsdStateType stateLsd; |
mbedalvaro | 0:345b3bc7a0ea | 38 | int totalBlobs; |
mbedalvaro | 0:345b3bc7a0ea | 39 | int currentBlob; |
mbedalvaro | 0:345b3bc7a0ea | 40 | int currentPoint; |
mbedalvaro | 0:345b3bc7a0ea | 41 | int currentMirrorDelay; |
mbedalvaro | 0:345b3bc7a0ea | 42 | int currentTotalPoints; |
mbedalvaro | 0:345b3bc7a0ea | 43 | int currentColor; |
mbedalvaro | 9:3321170d157c | 44 | unsigned short x,y; // auxiliary variables storing mirror position(0-4096) |
mbedalvaro | 9:3321170d157c | 45 | |
mbedalvaro | 13:9f03eac02700 | 46 | // New method to check complete display of one loop: |
mbedalvaro | 13:9f03eac02700 | 47 | unsigned char configTotalPoints; |
mbedalvaro | 13:9f03eac02700 | 48 | unsigned char pointDisplayCounter; |
mbedalvaro | 13:9f03eac02700 | 49 | bool endedFullDisplay(); |
mbedalvaro | 13:9f03eac02700 | 50 | void startFullDisplay(); |
mbedalvaro | 4:f9d364f10335 | 51 | |
mbedalvaro | 15:56a0bf424e8d | 52 | int waitNormal, waitLaser, waitFirst, waitFirstLaser, waitLast; |
mbedalvaro | 0:345b3bc7a0ea | 53 | }; |
mbedalvaro | 0:345b3bc7a0ea | 54 | |
mbedalvaro | 0:345b3bc7a0ea | 55 | #endif |
mbedalvaro | 0:345b3bc7a0ea | 56 | |
mbedalvaro | 0:345b3bc7a0ea | 57 | |
mbedalvaro | 0:345b3bc7a0ea | 58 |