void ZRUser(float myState[12], float otherState[12], float time) {
    if (time < 150) {
        //TODO: move to center of panel initialization circle, instead of
        //assuming that position from the start
        float attitude[3] = {0, 1, 0};
        ZRSetAttitudeTarget(attitude);
        //TODO: rotate around the circle to find the panel; in this case,
        //panel angle is 0 so we automatically see it after the attitude change
        if (isPanelFound() && time > 20) {
            float velocity[3] = {0, 0.01, 0};
            ZRSetVelocityTarget(velocity);
        }
        if (iHavePanel() && time > 70 && time < 75) {
            float stop[3] = {0, 0, 0};
            ZRSetVelocityTarget(stop);
        }
        if (iHavePanel() && time > 75 && time < 150) {
            float station[3] = {-.7, 0, 0};
            ZRSetPositionTarget(station);
        }
    }
    if (iHavePanel() && time == 150) {
        float searchStation[3] = {0, 0.1, 0};
        ZRSetTorques(searchStation);
    }
    if (isStationInSync() && time > 150) {
        float stop[3] = {0, 0, 0};
        float velocity[3] = {0, 0, .01};
        ZRSetTorques(stop);
        ZRSetVelocityTarget(velocity);
    }
}
Esempio n. 2
0
void rotateTau() {
	// Rotates about the x-axis by applying a torque of 0.025 N*m (?)
	// Requires an int tauSet to be set to 1 and a float correctPos to be set to 1.0;
	// Somewhat more unstable... depends on the previous performance of an attitude alignment being within a given bound
	// Sometimes the above mentioned alignment exceeds given time limits..
	// If alignment goes smoothly however, this function seems to work pretty well... but that's a big "if".
	
	float tau[3] = {0.0, 0.025, 0.0};
	if (correctPos < 2) {
		ZRSetPositionTarget(a);
		correctPos += 1.0;
	}
	if (tauSet == 1) {
		ZRSetTorques(tau);
		tauSet = 0;
	}
}
Esempio n. 3
0
static void spin (float c[3], float mystate[12])
{
//BEGIN::PROC::spin
/*
 * mmh.. Do I really need to
 * exaplain what this function
 * is for?
 */
float v[3];
char i;
float cosalfa=0;

if (ok<3) {
	PgetAsteroidNormal(v);
	
	for(i=0;i<3;i++)
		cosalfa+=v[i]*mystate[i+6];
		
	if(cosalfa<0)
		mathVecMul (v,v,-1);
			
	ZRSetAttitudeTarget(v);
	
	if (fabs(cosalfa)>0.986f)
		ok++;
}
else {
	v[0]=(0.5236f - mystate[9])/50;
	v[1]=0;
	v[2]=0;
	ZRSetTorques(v);
}
 
ZRSetPositionTarget(c); 
//END::PROC::spin
}