View Single Post
  #4   Spotlight this post!  
Unread 26-01-2005, 00:21
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: Where to insert code?

Quote:
Originally Posted by farmer
Ok new FIRST programmer here.....where are we allowed to insert code. For example, we want to change the sensitivity of our joy stick drive by using an array (we think). Does this go in user_routines.c ? and if so, does it matter where?
Files that you aren't supposed to modify are clearly labeled in the comments at the top of said files. The most common places of adding code are in user_routines.c (usually for driver code), and user_routines_fast.c (for autonomous, and processing interrupts and the like). In these files, you will find a comment to the effect of:
Code:
/*Add your code here.*/
If you put your code there, you are much more likely to get the results you expect.
Quote:
Originally Posted by russell
Yeah, what he said. You are going to want to study it some because the default code uses somthing called limit mix at least for the one joystick drive. I forget what it does but I think it had something to do with making sure that your pwm values did not exceed 255 or go below 0. Or something.
What the limit mix functions do is take the values of the x and y axis of the joystick, and convert them to the numbers that you would want the motors to do. It's just a little bit of math.
Quote:
Originally Posted by MikeWasHere05
Using some math functions you should be able to change the sensitivity of the joystick.
Yep... using a math formula is a much better idea than using a lookup table, which would be horribly inefficient with the limited resources we have. See this post for one example.
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_