|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#271
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
-Kevin |
|
#272
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
-Guy Davidson |
|
#273
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
New and edited link on the first page. Or, go to his web site. The full and simple versions are up.
|
|
#274
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Kevin,
Now that I enabled the ISR's (grin) everything works fine. No need to include sonar code this year as the MaxBotix sensors have an analog output. Last edited by Jon236 : 22-01-2008 at 15:07. Reason: Change of plans! |
|
#275
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
Hmmm i dont know what the issue was, (i did have ISR enabled) I just now recompiled the code and loaded it, no issues. Serial communications issue on the load... I dont know.
|
|
#276
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
Hello, this is my first year doing the programming on my team and we are having a very confusing problem. We are using an unmodified version of Kevin’s 2008 beta code with mplab v8 and c18 v3.1 and the code compiles fine and loads onto the robot fine, and it seems run on the robot, but the robot doesn't react at all. Its equally frustrating because when we load a copy of the 2007 code it works fine. It seems that no one else has had this problem (that I saw), though it seemed that Kevin referenced it in one of his posts.
Quote:
|
|
#277
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
With out any code that is going to be hard to help you with, are you in teleop mode? What code do you have in your teleop function?
|
|
#278
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Code:
// map y-axis of the joystick on operator interface port #1 to the // motor controlled by the Victor 883 attached to PWM output #1 pwm01 = p1_y; // map y-axis of the joystick on operator interface port #2 to the // motor controlled by the Victor 883 attached to PWM output #2 pwm02 = p2_y; -Kevin |
|
#279
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
I'm having a variety of problems, with the new code(http://www.kevin.org/frc/ifi_frc_sensor_30.zip), and the old encoder code (http://www.kevin.org/frc/frc_encoder.zip).
First off, I'll talk about the problems we were having with frc_encoder. When I had MPLAB 7.20 installed and was using v2.4 of the C18 compiler, everything compiled, and the encoders worked great on the robot. Here was the problem... there seemed to be about a 1/2 second delay between the robot receiving data from the OI, so I would move a joystick, then it would take 1/2 a second for the motors to start moving. I would release the joystick, and it would take 1/2 a second to stop (I almost had a bad incident with our new 80lb robot running me over). Okay, now for the 3.0 compatible code. I have MPLAB 8.00 installed and version 3.10 of the C18 compiler. I can compile the code as it is downloaded no problem, but when I try to initialize encoder 1 and encoder 2 using the code where i take out the //, it fails at the link step: MPLINK 4.1, Linker Copyright (c) 2006 Microchip Technology Inc. Error - could not find definition of symbol 'Initialize_Encoder_2' in file 'C:\Robot Code\2008\ifi_frc_sensor_30\teleop.o'. Errors : 1 If I comment out "Initialize_Encoder_2" it will say the same thing about encoder 1. Is my MPLINK out of date, since it says 2006? Here are some snapshots of MPLAB with my horrible hand-eye coordination with my trackpad: The other 4 errors are with this part of code: Code:
// Remove the // below to initialize encoder #1
Initialize_Encoder_1();
// Remove the // below to initialize encoder #2
Initialize_Encoder_2();
//Skipped a bunch of code here to save you time reading this. The code exists in my version.
if(i == 37 && j >= 191)
{
Encoder_Count = Get_Encoder_1_Count();
printf("E1=%d\r\n",(int)Encoder_Count);
Encoder_Count = Get_Encoder_2_Count();
printf("E2=%d\r\n",(int)Encoder_Count);
/* Encoder_Count = Get_Encoder_3_Count();
printf("E3=%d\r\n",(int)Encoder_Count);
Encoder_Count = Get_Encoder_4_Count();
printf("E4=%d\r\n",(int)Encoder_Count);
Encoder_Count = Get_Encoder_5_Count();
printf("E5=%d\r\n",(int)Encoder_Count);
Encoder_Count = Get_Encoder_6_Count();
printf("E6=%d\r\n\r\n",(int)Encoder_Count); */
}
|
|
#280
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Yep, it appears you didn't follow the detailed instructions in readme.txt .-Kevin |
|
#281
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Oops, I never saw the pesky README.
I already see what I did wrong, and I will edit this post a bit later to tell you if I got it working.Also, the link to the beta4 software doesn't want to work. Thanks for the quick response though... I was hectically trying to get this code working because our programming mentor is about to go to Indonesia on business. EDIT: I got it working! Thanks a bunch! Last edited by RyanN : 23-01-2008 at 14:44. |
|
#282
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Thanks a lot for the code, saves a great deal of time. |
|
#283
|
|||||
|
|||||
|
Re: New C18 3.0+ Compatible FRC Code
I think I've found a bug in the Gyro code....
I know... it seems unlikely considering how long it's been in service, but this problem has been bugging me for a while and I finally got the clues I needed to locate it. Here is the function. Quote:
I think the problem is that GYRO_CAL_FACTOR is defined as 1000/1000, but the multiplication is being done AFTER the prior expression is cast to an integer... Therefore if ((((long)gyro_rate * GYRO_SENSITIVITY * 5L) / ADC_RANGE)) calculates to anything above 32 or below -32, then multiplying it by 1000 will cause the number to exceed the valid range of an integer. I think the second to last bracket is misplaced... I think it should be: return((int)((((long)gyro_rate * GYRO_SENSITIVITY * 5L) / ADC_RANGE) * GYRO_CAL_FACTOR)); I'm going to try it tomorrow... I'm just greatful I didn't have to write this code.... Thankyou Kevin... really. Phil. |
|
#284
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Okay, I'll have a look at it. I'm working on what I hope is the final release, so now is a good time to fix any bugs. Assuming it's a real bug, thanks for finding it.
Quote:
-Kevin |
|
#285
|
|||||
|
|||||
|
Re: New C18 3.0+ Compatible FRC Code
Kevin,
Would it be too much to ask for an updated library for the EDU-RC? ![]() |
![]() |
| 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 |