just a test

Dependencies:   mbed

Fork of scoreLight_Advanced by Alvaro Cassinelli

rigidLoop.h

Committer:
mbedalvaro
Date:
2012-04-04
Revision:
4:f9d364f10335
Parent:
1:a4050fee11f7
Child:
7:0df17f3078bc

File content as of revision 4:f9d364f10335:

#ifndef RIGID_LOOP
#define RIGID_LOOP

// Include the basic objects to create the loop
#include "soundSpot.h"
#include "classPointMass.h" // this may be used to move the center of the RIGID loop in dynamically "real" ways
#include "classSpring.h"    // same remark than above

using namespace std;

enum RigidLoopMode {SPOT_FOLLOWING, SPOT_BOUNCING, SPOT_TEST};

class rigidLoop : public soundSpot  {

public:
   
    // Constructor and destructor:
    rigidLoop();
    ~rigidLoop();
    
    // instantiation of the virtual methods of the base class (we don't need to append "virtual", but for clarity I do):
    void createBlob(int _id, RigidLoopMode _rigidBlobMode, vector2D _initPos, vector2D _initSpeed);
    virtual void setRegionMotion(int mmix, int mmiy, int mmax, int mmay); // attention: initial position posX and posY should be inside this bounding box...
    virtual void update();  // update dynamics of the mass loop   
    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).
    virtual void computeBoundingBox();
    virtual void sendDataSpecific(void);
       
    // methods that are new to this class (not in base class): 
    void initSizeBlob(int _numPoints);
    void createLoopFromScafold(void); // this is much simpler than the elastic blob (here, we only need to add a central mass)
   // void processLoopData(); // not needed, because the loop is rigid.  

    RigidLoopMode updateMode;

 // 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)
    int numPoints;
    pointMass centerMass; // this is the center of the rigidLoop. Note that it can have mass or not, this will depend on the RigidLoopMode
    
   // The following are common to all blobs:
    // float angleCorrectionForceLoop;
   // vector2D recenteringVectorLoop;
   // float angleRecenteringVector; // auxiliary variables for sending data (for the recenteringVectorLoop)
   // float normRecenteringVector;
    
  // other modes: 
     bool slidingDirection; // for contour following
   
   // numeric parameters:
    float saccadeRadius; 
    
    float rotationAngle; // note: in the future, rotation would be done by the openGL-like renderer
    
    float massCenter;
    float dampMotionCenterMass; 
    
    float speedContourFollowing; // this is given as a percentage of the radius of the circle
    float factorBouncingForce;
};

#endif