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); } }
void HistDump(float * myState, float * otherState, int time) { float pos[3] = {0,0,0}; int k; for (k=0; k<3; k++) { pos[k] = myState[k]; } for (k=0; k<12; k++) { history[35*time+k] = myState[k]; history[35*time+12+k] = otherState[k]; } history[35*time+24] = iHavePanel(); history[35*time+25] = otherHasPanel(); history[35*time+26] = isPanelFound(); history[35*time+27] = isPanelInSync(); history[35*time+28] = isStationInSync(); history[35*time+29] = getCurrentScore(); history[35*time+30] = getOtherCurrentScore(); history[35*time+31] = getPercentChargeRemaining(); history[35*time+32] = getPercentFuelRemaining(); history[35*time+33] = otherRepelling(); history[35*time+34] = outsideBoundary(pos); }