Quote:
|
Originally Posted by doyler
So could I just add this at the end?
lookup[127]=127;
|
Sure
Quote:
|
and how would your array work
|
Not sure what you mean by that one...
Quote:
|
and why does it go to 128
|
The reason that you need to declare the array to size 128 is that array indecies C is zero-based. You want an index range of 0-127 (128 elements), therefore the size should be 128.
Quote:
|
The trigger is not supposed to make it do anything other then track
|
I just reread your original question...If the trigger is pressed you set p1_y = speed_control at line 384...but you never initialize speed_control. you go on to use p1_y in the Limit_Mix call on line 396 to set your outputs. So at that point, who knows what the y component of your output is going to be. If it happens to be in the speed controller deadbane (117-137 I think), you will get no forward motion. This could be why it spins.
I see a const int called speed_setting at line 46...did you mean to use this instead?
On a programming side note, the const ints steering_comp and speed_setting would be better written as
Code:
#define STEERING_COMP 30
#define SPEED_SETTING 150
You can put this in user_routines.h. Doing so will save you the size of two ints as well as a few program cycles of having to retrieve the values out of memory. Doesn't seem like a whole lot, but over time things like this add up and pretty soon you're out of space. Its better to get in the habit now so that you don't have to go back later and re-do it if you run into problems.