fs

Dependencies:   Locate Move mbed Servo

Fork of ARAI45th by 涼太郎 中村

_hakaba/h_move.cpp

Committer:
sakanakuuun
Date:
2016-09-02
Revision:
4:1604d599d40f
Child:
6:931d51a70200

File content as of revision 4:1604d599d40f:

/*
void pmovex2(int length)
{
    int px,py,ptheta,dx,dy,dtheta;
    int k_y=0.7;//P制御の係数。大きくすれば動きが大きくなる、小さくするとあまり変化しない。要はkはP制御の感度を表す係数です。
    int k_theta=5;//P制御の係数。大きくすれば動きが大きくなる、小さくするとあまり変化しない。要はkはP制御の感度を表す係数です。

    update();
    px=coordinateX();
    py=coordinateY();
    ptheta=coordinateTheta();
    move(rightspeed,leftspeed);

    while(1) {
        update();
        
        dx = coordinateX() - px;
        dy = coordinateY() - py;
        dtheta = coordinateTheta() - ptheta;

        if(dy>7) {
            dy=7;
        }
        else if(dy<-7) {
            dy=-7;
        }
        
        if(-3 < dy && dy < 3){
            move(rightspeed - k_y*dy - k_theta*dtheta, leftspeed + k_y*dy + k_theta*dtheta);
        }
        else{
            move(rightspeed -50 - k_y*dy*dy - k_theta*dtheta, leftspeed -50 + k_y*dy*dy + k_theta*dtheta);
       }     
        if(dx>length) {
            move(0,0);
            break;
        }
    }
}
*/