just a test

Dependencies:   mbed

Fork of scoreLight_Advanced by Alvaro Cassinelli

rigidLoop.h

Committer:
mbedalvaro
Date:
2012-09-21
Revision:
30:d8af03f01cd4
Parent:
28:44b7b6e35548
Child:
31:5f039cbddee8

File content as of revision 30:d8af03f01cd4:

#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_TRACK, SPOT_GHOST, SPOT_PACMAN, SPOT_BOUNCING, SPOT_AIR_HOCKEY, SPOT_LORENTZ_FORCE, 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, vector2Df _initPos, vector2Df _initSpeed);
    virtual void setRegionMotion(float mmix, float mmiy, float mmax, float 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);
    virtual void speedFactor(float speedfactor);
       
    // 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; // this belongs to soundSpot base class
    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; 
    
    // THINGS FOR CONTOUR FOLLOWING:
    float saccadeRadius_initial; // this is for SEARCH MODE (remember initial radius)
    bool justSearched;
    
    
    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