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.