execute.h

I am currently working on the structure of the autonomous mode. I created an autonomous code structure in execute.c Is it possible so that i can call Do_execute(); in autonomous mode and it will work? In execute.c I am using many of gyro and encoder functions. So when I move them to autonomous in useroutines_fast.c. will all those gyro and encoder functions will work?

You should be able to, there is no difference (ok this isn’t completely true but close enough so you can assume it is) between calling a function and just copying and pasting it into the code.

here in the attachment is my execute. c

and i want to call the function in userroutines_fast.c, so this is what i am doing:
while (autonomous_mode) /* DO NOT CHANGE! /
{
// new ADC data available?
if(Get_ADC_Result_Count())
{
Process_Gyro_Data();
Reset_ADC_Result_Count();
}
if (statusflag.NEW_SPI_DATA) /
26.2ms loop area /
{
Getdata(&rxdata); /
DO NOT DELETE, or you will be stuck here forever! */

    /* Add your own autonomous code here. */

/******* 1219 Autonomous Code Starts Here*********************/

i++;
j++; // this will rollover every ~1000 seconds

if(j == 60)
{
	// start a gyro bias calculation
	Start_Gyro_Bias_Calc();
}

if(j == 300)
{
	// terminate the gyro bias calculation
	Stop_Gyro_Bias_Calc();

	// reset the gyro heading angle
	Reset_Gyro_Angle();

	printf("Done\r");
}

if(i >= 30 && j >= 300)
{
	temp_gyro_bias = Get_Gyro_Bias();
	temp_gyro_rate = Get_Gyro_Rate();
	temp_gyro_angle = (Get_Gyro_Angle()/100);
	printf(" Gyro Bias=%d

“, temp_gyro_bias);
printf(” Gyro Rate=%d
", temp_gyro_rate);
printf("Gyro Angle=%d

", (int)temp_gyro_angle);

	i = 0;
}
/*************GYRO CODES ENDS HERE ***************/

/************Processing Camera Information************/
Tracking_Info_Terminal();
Camera_Handler();
Servo_Track();
/********Camera Processing Ends Here********/

if(Get_Tracking_State() == CAMERA_ON_TARGET)
{
	
	Do_executive(); // Runs the function from execute.c
}

    PWM(pwm13,pwm14,pwm15,pwm16);
    Putdata(&txdata);   /* DO NOT DELETE, or you will get no PWM outputs! */
}

}
}

executive.c (15.4 KB)


executive.c (15.4 KB)