|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#226
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
We're testing the new gyro code, but it overrides all of our commands and sets our pwm outs to 0. Once we put anything referencing the pwm outs we're using, it messes them up. We searched through the code, but we can't find anything that might be causing this. Has anyone else come across this problem?
|
|
#227
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
-Kevin |
|
#228
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
We tried that on Monday. I don't have the results in front of me now, but they were all just definitions. I suspect it has something to do with the gyro code (as downloaded from this thread, not added in by us), as the plain C18 3.0 code doesn't cause this problem. We got this bug on 2 occasions, each time starting from scratch, adding only a few lines for straight joystick-to-PWM drive code, as well as removing the gyro calibration in one instance.
|
|
#229
|
|||
|
|||
|
Serial Ports
Kevin:
Is there a hard limit at 128 bytes in the Serial Queue's?? RX_1_QUEUE_SIZE 128 // Must be a power of two (i.e.,8,16,32,64,128) |
|
#230
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
(This may be a little bit of a tangent.)
I'd like to report to anyone who's interested that the C18 3.10 compiler works just fine under Wine (on Linux), after fixing one minor issue. I had v 2.4 working under Wine. I ran the upgrade, and then things did not work. I don't remember the exact error, but it did not compile successfully. I copied my mcc18 directory from one machine (where I'd run the upgrade) to a different machine, and it worked fine on the new machine. I then copied my ~/.wine directory from the new machine back to the old machine, and the compiler worked fine. If you plan on using v 3.10 under Wine, my recommendation is to do one of the following: - Run the upgrade on a Windows machine, and then copy over the mcc18 directory to run it under Wine - Make a backup of ~/.wine, then run the upgrade program under Wine, then restore ~/.wine. |
|
#231
|
||||
|
||||
|
Re: Serial Ports
Quote:
-Kevin |
|
#232
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
-Kevin |
|
#233
|
|||
|
|||
|
Re: Serial Ports
Quote:
thanks... |
|
#234
|
|||||
|
|||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Phil. |
|
#235
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Kevin,
This is just a thought and should be implemented by teams as they feel their needs require. In the teleop.c file, you currently have the gyro bias calculation process happen in the Teleop function. Code:
void Teleop(void)
{
static unsigned int i = 0;
static unsigned int j = 0;
int temp_gyro_rate;
long temp_gyro_angle;
int temp_gyro_bias;
i++;
j++; // this will rollover every ~1000 seconds
if(j == 10)
{
printf("\rCalculating Gyro Bias...");
}
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();
printf(" Gyro Bias=%d\r\n", temp_gyro_bias);
printf(" Gyro Rate=%d\r\n", temp_gyro_rate);
printf("Gyro Angle=%d\r\n\r\n", (int)temp_gyro_angle);
i = 0;
}
Update_OI_LEDs(); // located in ifi_code.c
}
This may be fine in some instances, but in competition, the robot is powered up in disabled mode, then transitions into autonomous(Hybrid) then back to disabled and finally into teleop. The gyro bias would never be calculated until well after it may be needed. Wouldn't it be better if this code were placed in the disabled.c file in the Disabled function. An additional flag could be set to prevent the bias calc process from running during any additional disabled periods. |
|
#236
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Code:
int limit(int value)
{
if(value >255);
value =255;
if(value <0);
value =0; <== because of the added semicolon above, this statement will always execute and will always set the return value to zero.
return value;
}
Code:
unsigned char limit(int value)
{
if(value >255);
value =255;
else if(value <0);
value =0;
return (unsigned char)value;
}
|
|
#237
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
-Kevin |
|
#238
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Code:
unsigned char limit(int value)
{
if(value > 255)
value = 255;
else if(value < 0)
value = 0;
return (unsigned char)value;
}
|
|
#239
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
Thank you. I thought it was probably something stupid I did.
|
|
#240
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Dave, thanks for catching my gaff <grin>. -Kevin |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Does the camera code suits to all versions of MPLAB and C18? | razer | Programming | 3 | 04-01-2007 14:50 |
| Trying to follow C18 interrupt context code... | dcbrown | Programming | 5 | 21-12-2006 09:01 |
| Error w/ FRC code | JamesBrown | Programming | 2 | 08-01-2005 16:17 |
| Programming code Fix FRC | Ferazel2001 | Programming | 6 | 08-02-2004 02:46 |
| FRC default code | hedgehogger | Programming | 2 | 21-01-2004 18:41 |