View Single Post
  #13   Spotlight this post!  
Unread 25-03-2007, 22:57
yoyodyne yoyodyne is offline
Registered User
AKA: Greg Smith
FRC #0116 (Epsilon Delta)
Team Role: Engineer
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Reston, VA
Posts: 61
yoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to beholdyoyodyne is a splendid one to behold
Re: VICTOR RESPONSE DELAY? - AGAIN

I got some preliminary data today on the Gyro response (still no direct measurements on PWM output delay or Victor delay)

The test setup picture is attached. The gyro/accelerometer board is taped to the top of a VEX wheel on a vertical shaft. The shaft is driven by a chain from a VEX motor. The other end of the shaft is directly drives a grayhill 256 pulse per revolution shaft encoder. Also in the setup is a slotted optical interrupt switch that a tab mounted on the wheel goes through. This provides a known position and was mostly just to make sure the shaft encoder was not missing or duplicating any pulses.

In summary, the gyro works well to a rate of about 148 degrees/sec. The gyro output (given our code infrastructure lags the shaft encoder output by about 150ms but there are no long (on the order of a second) settling delays in this data. We use Kevin Watson's ADC and Gyro code setup for 5 analog inputs and combined sample clock of 1000Hz - each channel is setup to average two samples so the sample rate of the gyro is either 100 or 200Hz depending on how you look at it. The other channels are the Y axis accelerometer (output from the accelerometer is also in the raw data dump), the arm angle pot, the ultrasonic foot detector, and the LCD display button decoder (analog voltages for left/right/up/down and enter). The gyro code is modified to read in milli-radians and outputs measurements from 0 to (2000Pi -1) - 0 degrees -> 0 90 degrees E -> Pi/2 and so on.

The time from a PWM control change until the shaft encoder detected a rate change either for starting or stopping was less than 50ms. This delay includes the PWM output delay plus the motor and internal VEX motor gear delay plus whatever chain slack there is. This data was using PWM15 with Kevin Watson's PWM driver code using timer 3. I also have data using PWM1 but have not had the time to reduce it.

As for the test the code is below. Basically before there is any motion our standard gyro bias measurement period (100ms) elapses and then the wheel rotates clockwise (as seen from above) until the tab on the wheel interrupts the optical detector. The wheel then is driven counterclockwise until the shaft encoder count of 100 is reached and then the motors are stopped for three seconds. Then the wheel is reversed and runs clockwise again until the shaft encoder count reaches -100 turn off motors and wait for 3 sec then the whole process repeats.

It turns out that for whatever reason the VEX motor moves a lot faster counter clockwise that clockwise.

The "raw" data capture text file is attached if anyone wants to do some more data analysis. See the printf in the code section so you know what is being printed out. The PU = XX% is the processor utilization measurement output that I forgot to turn off. It and the Gyro = lines just schedule themselves to run once a second.

If you think that these measurements are not valid or could be improved or would like some more data or change in a test case let me know while I still have this test setup together. I'll probably try a couple more things as well.

Greg




typedef enum{
INITIALIZE,
TURNING_CLOCKWISE,
TURNING_COUNTERCLOCKWISE,
WAITING,
FINISHED
} GYRO_TEST_STATE;
GYRO_TEST_STATE gyro_test_state = INITIALIZE;

#define GYRO_TST_C_RATE 25
#define GYRO_TST_CCR_RATE -25
void GyroTestIdleOver(long clockwise)
{
if(clockwise)
{
gyro_pwm_offset = GYRO_TST_CCR_RATE;
gyro_test_state = TURNING_COUNTERCLOCKWISE;

}
else{
gyro_pwm_offset = GYRO_TST_C_RATE;
gyro_test_state = TURNING_CLOCKWISE;
}
}


void Process_Data_From_Master_uP(void)
{
static unsigned char i;
int debug_shaft_count;

.
.
.


/****************** THIS IS GYRO RESPONSE TEST CODE *****************************/
debug_shaft_count = (int)Get_Encoder_1_Count();

switch (gyro_test_state)
{
case INITIALIZE:
if(!rc_dig_in17) // When the wheel tab interrupts the IR the wheel is at zero orientation
{
Reset_Encoder_1_Count();
Set_Gyro_Angle(0);
gyro_pwm_offset = -25;
gyro_test_state = TURNING_COUNTERCLOCKWISE;

}
break;

case TURNING_CLOCKWISE:
if(debug_shaft_count < -100)
{
ScheduleEventTimer(GyroTestIdleOver,3000,1); // Schedule GyroTesterIdleOver(1) to run in 3000 ms
gyro_pwm_offset = 0;
gyro_test_state = WAITING;
}
break;

case TURNING_COUNTERCLOCKWISE:
if(debug_shaft_count > 100)
{
ScheduleEventTimer(GyroTestIdleOver,3000,0);
gyro_pwm_offset = 0;
gyro_test_state = WAITING;
}
break;

case WAITING:

break;
case FINISHED:
gyro_pwm_offset = 0;
break;
}
pwm01 = pwm15 = 127 + gyro_pwm_offset;
printf("%d, %d, %d, %d, %d\r",(int)rc_dig_in17,debug_shaft_count,(int)Get_ Gyro_Angle(), (int)pwm01, (int)Get_Accel_Accel());

#ifndef _RC_8520
// see pwm_readme.txt for information about PWM();
PWM(pwm13,pwm14,pwm15,pwm16);
#endif
Putdata(&txdata); /* DO NOT CHANGE! */
}
Attached Thumbnails
Click image for larger version

Name:	Picture 001_small.jpg
Views:	53
Size:	88.3 KB
ID:	5337  
Attached Files
File Type: pdf initial_gyro_test_results.pdf (148.2 KB, 45 views)
File Type: txt gyro_tst6.txt (43.0 KB, 24 views)