View Single Post
  #2   Spotlight this post!  
Unread 19-02-2006, 17:38
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Code malfunction after robot reset?

Quote:
Originally Posted by jgannon
I have found myself in a most perplexing programming situation, and I'm hoping someone can help me figure it out in time to actually get this robot programmed before shipping. We have been using Kevin Watson's encoder code as a basis for our own code. The only modification I've made to it so far is to add our own joystick mixing function to user_routines.c, and call it in Process_Data_from_Master_uP(). This function does not do anything with the encoders. I downloaded the fresh code from Kevin's website, put his patched header file in the right place, pasted in the mixing function, compiled it, and downloaded it to the robot. I tested the joysticks, and it worked exactly as expected. I turned off the robot, and came back to it later to find that the code was flipping out. The motors spin at random without touching the joysticks, and if I look in Dashboard, I can see that several of the PWM outputs (including ones my code doesn't touch) are forever incrementing and overflowing, hence the motor craziness. When I switch the robot into autonomous mode, it keeps doing the same thing, despite me having no code in the autonomous function (aside from the IFI default to set all of the PWMs to 127, which is apparently not happening). I have sent the same HEX file to the robot again, and it continues to be crazy. When I put the IFI default code with our mixing function onto the robot, everything behaves again. I replace it with the encoder code, and it flips out.

Basically, my question is, how can the same code work and then suddenly not work? Does the encoder code leave some sort of persistent change even after reset? The fact that this problem persists into autonomous mode indicates to me that this problem extends beyond a simple coding error. Thank you in advance.

EDIT: One other important tidbit. I'm not using PWM 13-16, so I don't think it's a problem with the encoders causing the "special" PWMs to wig out.
Post your user_routines_fast.c file.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org