just a test

Dependencies:   mbed

Fork of scoreLight_Advanced by Alvaro Cassinelli

Committer:
mbedalvaro
Date:
Sat Mar 31 08:19:31 2012 +0000
Revision:
1:a4050fee11f7
Child:
4:f9d364f10335
new scorelight methods added. VERY STRANGE problem with oldPos and pos in Verlet method, that have strange behaviour depending on the value of damp factor...

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedalvaro 1:a4050fee11f7 1 #ifndef RIGID_LOOP
mbedalvaro 1:a4050fee11f7 2 #define RIGID_LOOP
mbedalvaro 1:a4050fee11f7 3
mbedalvaro 1:a4050fee11f7 4 // Include the basic objects to create the loop
mbedalvaro 1:a4050fee11f7 5 #include "soundSpot.h"
mbedalvaro 1:a4050fee11f7 6 #include "classPointMass.h" // this may be used to move the center of the RIGID loop in dynamically "real" ways
mbedalvaro 1:a4050fee11f7 7 #include "classSpring.h" // same remark than above
mbedalvaro 1:a4050fee11f7 8
mbedalvaro 1:a4050fee11f7 9 using namespace std;
mbedalvaro 1:a4050fee11f7 10
mbedalvaro 1:a4050fee11f7 11 enum RigidLoopMode {SPOT_FOLLOWING, SPOT_BOUNCING};
mbedalvaro 1:a4050fee11f7 12
mbedalvaro 1:a4050fee11f7 13 class rigidLoop : public soundSpot {
mbedalvaro 1:a4050fee11f7 14
mbedalvaro 1:a4050fee11f7 15 public:
mbedalvaro 1:a4050fee11f7 16
mbedalvaro 1:a4050fee11f7 17 // Constructor and destructor:
mbedalvaro 1:a4050fee11f7 18 rigidLoop();
mbedalvaro 1:a4050fee11f7 19 ~rigidLoop();
mbedalvaro 1:a4050fee11f7 20
mbedalvaro 1:a4050fee11f7 21 // instantiation of the virtual methods of the base class (we don't need to append "virtual", but for clarity I do):
mbedalvaro 1:a4050fee11f7 22 void createBlob(int _id, RigidLoopMode _rigidBlobMode, vector2D _initPos);
mbedalvaro 1:a4050fee11f7 23 virtual void setRegionMotion(int mmix, int mmiy, int mmax, int mmay); // attention: initial position posX and posY should be inside this bounding box...
mbedalvaro 1:a4050fee11f7 24 virtual void update(); // update dynamics of the mass loop
mbedalvaro 1:a4050fee11f7 25 virtual void draw(void); // draw the blob (renders on the laser trajectory object lsdTrajectory from the base class, using the openGL laser renderer - not yet done).
mbedalvaro 1:a4050fee11f7 26 virtual void computeBoundingBox();
mbedalvaro 1:a4050fee11f7 27 virtual void sendDataSpecific(void);
mbedalvaro 1:a4050fee11f7 28
mbedalvaro 1:a4050fee11f7 29 // methods that are new to this class (not in base class):
mbedalvaro 1:a4050fee11f7 30 void initSizeBlob(int _numPoints);
mbedalvaro 1:a4050fee11f7 31 void createLoopFromScafold(void); // this is much simpler than the elastic blob (here, we only need to add a central mass)
mbedalvaro 1:a4050fee11f7 32 // void processLoopData(); // not needed, because the loop is rigid.
mbedalvaro 1:a4050fee11f7 33
mbedalvaro 1:a4050fee11f7 34 RigidLoopMode updateMode;
mbedalvaro 1:a4050fee11f7 35
mbedalvaro 1:a4050fee11f7 36 // The number of points in the loop (in this case, is just the number of points in the scaffold, as well as the number of points in the lsdTrajectory)
mbedalvaro 1:a4050fee11f7 37 int numPoints;
mbedalvaro 1:a4050fee11f7 38 pointMass centerMass; // this is the center of the rigidLoop. Note that it can have mass or not, this will depend on the RigidLoopMode
mbedalvaro 1:a4050fee11f7 39
mbedalvaro 1:a4050fee11f7 40 // The following are common to all blobs:
mbedalvaro 1:a4050fee11f7 41 // float angleCorrectionForceLoop;
mbedalvaro 1:a4050fee11f7 42 // vector2D recenteringVectorLoop;
mbedalvaro 1:a4050fee11f7 43 // float angleRecenteringVector; // auxiliary variables for sending data (for the recenteringVectorLoop)
mbedalvaro 1:a4050fee11f7 44 // float normRecenteringVector;
mbedalvaro 1:a4050fee11f7 45
mbedalvaro 1:a4050fee11f7 46 // other modes:
mbedalvaro 1:a4050fee11f7 47 bool slidingDirection; // for contour following
mbedalvaro 1:a4050fee11f7 48
mbedalvaro 1:a4050fee11f7 49 // numeric parameters:
mbedalvaro 1:a4050fee11f7 50 float saccadeRadius;
mbedalvaro 1:a4050fee11f7 51
mbedalvaro 1:a4050fee11f7 52 float massCenter;
mbedalvaro 1:a4050fee11f7 53 float dampMotionCenterMass;
mbedalvaro 1:a4050fee11f7 54
mbedalvaro 1:a4050fee11f7 55 float speedContourFollowing; // this is given as a percentage of the radius of the circle
mbedalvaro 1:a4050fee11f7 56 float factorBouncingForce;
mbedalvaro 1:a4050fee11f7 57 };
mbedalvaro 1:a4050fee11f7 58
mbedalvaro 1:a4050fee11f7 59 #endif