Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   New C18 3.0+ Compatible FRC Code (http://www.chiefdelphi.com/forums/showthread.php?t=60377)

CardcaptorRLH85 18-02-2008 16:43

Re: New C18 3.0+ Compatible FRC Code
 
I'm in a bit of a bind...I'm having a bit of a problem integrating the PID code available at http://www.kevin.org/frc/2005/ with this new code. I've been looking through the PID code and I have absolutely no idea where to start trying to make them work with one another. I'd greatly appreciate any help I can get here....

spack 18-02-2008 21:30

Re: New C18 3.0+ Compatible FRC Code
 
Kevin.
I'm trying to get the camera code going with the new 3.0 code. I'm not receiving ACKs or NCKs so it fails at init state 3 return value 131. serial_ports.h/c looks ready to go for port2 9600 baud and interrupts.

Integrated camera.c terminal.c and tracking.c without any issues.

Anything obvious come to mind reagrding serial port initialization?

Chad

David Doerr 19-02-2008 07:59

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by spack (Post 701905)
Kevin.
I'm trying to get the camera code going with the new 3.0 code... Anything obvious come to mind reagrding serial port initialization?

Chad,

Try setting serial port 2 to 115200 baud.

Dave

Guy Davidson 19-02-2008 20:04

Re: New C18 3.0+ Compatible FRC Code
 
I've been running into an odd problem with encoders.

Encoder 1 works perfectly fine during the teleop period, but does not give me anything during the autonomous one. Encoder 2 works in both teleop and autonomous. The initialization functions is called during both the autonomous and disabled initialization routines.

I am running your latest code build, as far I as know, with MPLAB 8 and C18 3.10. While the robot is shipped already, I'd love to hear if you have any suggestions for what to try.

It could be that the encoder is working, and is giving the correct signals, but is always printing a zero in my debug statement, and the code that is executing makes me believe that it is seeing a zero (as the count). But when I print out the count in the teleop mode, I get numbers that make sense.

Lafleur 20-02-2008 00:20

New C18 3.0+ Compatible FRC Code
 
Kevin

Do you have access to an Explorer 16 board from Microchip??

pogenwurst 20-02-2008 00:32

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by sumadin (Post 702859)
I've been running into an odd problem with encoders.

Encoder 1 works perfectly fine during the teleop period, but does not give me anything during the autonomous one. Encoder 2 works in both teleop and autonomous. The initialization functions is called during both the autonomous and disabled initialization routines.

I am running your latest code build, as far I as know, with MPLAB 8 and C18 3.10. While the robot is shipped already, I'd love to hear if you have any suggestions for what to try.

It could be that the encoder is working, and is giving the correct signals, but is always printing a zero in my debug statement, and the code that is executing makes me believe that it is seeing a zero (as the count). But when I print out the count in the teleop mode, I get numbers that make sense.

I had the same issue in autonomous, except with both encoder 1 and encoder 2. I never had the chance to check in teleop mode, though.

I'll try with last year's board, if I can get the time (we removed our encoders from the bot for this reason).

Kevin Watson 20-02-2008 01:29

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by spack (Post 701905)
Kevin.
I'm trying to get the camera code going with the new 3.0 code. I'm not receiving ACKs or NCKs so it fails at init state 3 return value 131. serial_ports.h/c looks ready to go for port2 9600 baud and interrupts.

Integrated camera.c terminal.c and tracking.c without any issues.

Anything obvious come to mind reagrding serial port initialization?

Chad

I haven't done it, but I can't think of any reason it wouldn't work.

-Kevin

Kevin Watson 20-02-2008 01:38

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by sumadin (Post 702859)
I've been running into an odd problem with encoders.

Encoder 1 works perfectly fine during the teleop period, but does not give me anything during the autonomous one. Encoder 2 works in both teleop and autonomous. The initialization functions is called during both the autonomous and disabled initialization routines.

I am running your latest code build, as far I as know, with MPLAB 8 and C18 3.10. While the robot is shipped already, I'd love to hear if you have any suggestions for what to try.

It could be that the encoder is working, and is giving the correct signals, but is always printing a zero in my debug statement, and the code that is executing makes me believe that it is seeing a zero (as the count). But when I print out the count in the teleop mode, I get numbers that make sense.

A common reason for this is the wrong printf() format parameter is used. Use %ld instead of %d.

-Kevin

Kevin Watson 20-02-2008 01:42

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by Lafleur (Post 703065)
Kevin

Do you have access to an Explorer 16 board from Microchip??

No, most of my experience is with x86, PPC, Cell BE, TI DSP plus lots of FPGA work. My only real experience with PIC is side work using IFI hardware. Why do you ask?

-Kevin

Guy Davidson 20-02-2008 01:49

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by Kevin Watson (Post 703114)
A common reason for this is the wrong printf() format parameter is used. Use %ld instead of %d.

-Kevin

That would make sense, I guess. The DEBUG I use in the teleoperated code casts the variables to integers in the DEBUG, while the one I have in autonomous does not. But something's still lacking. In this case, why would encoder channel 2 print out properly, while one was not? I also tried connection the two encoders to the opposite channels (i.e. the left one was previously connected to 1, and I moved it to 2, and vice versa with the right encoder). When I did that, the signs flipped, but encoder 2 still changed and 1 still remained constant, while both worked in teleop, I believe.

Another weird thing with my autonomous code, is that unless I have a DEBUG in the PWM() function body, the robot doesn't move. I'm updating the PWM function every main loop, and I noticed that unless I have that DEBUG statement there, the robot doesn't move. Once I added it, or commented it in (when testing), the robot started moving again. Any ideas?

Thanks.

Kevin Watson 20-02-2008 02:14

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by sumadin (Post 703120)
That would make sense, I guess. The DEBUG I use in the teleoperated code casts the variables to integers in the DEBUG, while the one I have in autonomous does not. But something's still lacking. In this case, why would encoder channel 2 print out properly, while one was not? I also tried connection the two encoders to the opposite channels (i.e. the left one was previously connected to 1, and I moved it to 2, and vice versa with the right encoder). When I did that, the signs flipped, but encoder 2 still changed and 1 still remained constant, while both worked in teleop, I believe.

Another weird thing with my autonomous code, is that unless I have a DEBUG in the PWM() function body, the robot doesn't move. I'm updating the PWM function every main loop, and I noticed that unless I have that DEBUG statement there, the robot doesn't move. Once I added it, or commented it in (when testing), the robot started moving again. Any ideas?

Thanks.

Using the wrong format string can cause wacky behavior. I'll have a quick look if you zip up your code and e-mail it to me.

-Kevin

Lafleur 20-02-2008 10:36

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by Kevin Watson (Post 703116)
No, most of my experience is with x86, PPC, Cell BE, TI DSP plus lots of FPGA work. My only real experience with PIC is side work using IFI hardware. Why do you ask?

-Kevin

I have a early port of your ATD code working on the board with DMA, also have the serial drivers working with a few bugs...

this was done to gain experience with the tools and processors...

mandrews281 21-02-2008 18:13

Re: New C18 3.0+ Compatible FRC Code
 
There is a later theme about not allowing enough time for the circular buffer to fill. I suspect that might be what I was doing wrong.

BHOP 03-03-2008 16:53

Re: New C18 3.0+ Compatible FRC Code
 
Just wanted to post a big THANK YOU to Kevin for his code...

Kevin Watson 03-03-2008 17:06

Re: New C18 3.0+ Compatible FRC Code
 
Quote:

Originally Posted by BHOP (Post 711939)
Just wanted to post a big THANK YOU to Kevin for his code...

You're welcome :). Of the teams that used my code last week, did any bugs pop up?

-Kevin


All times are GMT -5. The time now is 14:28.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi