Esempio n. 1
0
// -------------------------------------------
// called from main()
void pidSetup()
{
	int i;
	for(i = 0; i < NUM_PIDS; i++){
		initPIDObjPos( &(pidObjs[i]), DEFAULT_KP, DEFAULT_KI, DEFAULT_KD, DEFAULT_KAW, DEFAULT_FF); 
	}
	initPIDVelProfile();
	SetupTimer1();  // main interrupt used for leg motor PID

// returns pointer to queue with 8 move entries
	moveq = mqInit(8); 
	idleMove = malloc(sizeof(moveCmdStruct));
	idleMove->inputL = 0;
	idleMove->inputR = 0;
	idleMove->duration = 0;
	currentMove = idleMove;
	
	manualMove = malloc(sizeof(moveCmdStruct));
	manualMove->inputL = 0;
	manualMove->inputR = 0;
	manualMove->duration = 0;

	lastMoveTime = 0;
//  initialize PID structures before starting Timer1
	pidSetInput(0,0,0);
	pidSetInput(1,0,0);

	EnableIntT1; // turn on pid interrupts
	
	calibBatteryOffset(100);
}
Esempio n. 2
0
// -------------------------------------------
// called from main()
void pidSetup()
{
	int i;
	for(i = 0; i < NUM_PIDS; i++){
		initPIDObjPos( &(pidObjs[i]), DEFAULT_KP, DEFAULT_KI, DEFAULT_KD, DEFAULT_KAW, DEFAULT_FF); 
	}
	initPIDVelProfile();
	SetupTimer1();  // main interrupt used for leg motor PID

	lastMoveTime = 0;
//  initialize PID structures before starting Timer1
	pidSetInput(0,0);
	pidSetInput(1,0);
	
	EnableIntT1; // turn on pid interrupts

	calibBatteryOffset(100); //???This is broken for 2.5
}