View Single Post
  #9   Spotlight this post!  
Unread 30-10-2003, 14:28
Sachiel7's Avatar
Sachiel7 Sachiel7 is offline
<Yes I managed to flip it
AKA: Shayne Helms
FRC #1132 (RAPTAR Robotics)
 
Join Date: Sep 2002
Rookie Year: 2002
Location: Richmond, VA
Posts: 541
Sachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really niceSachiel7 is just really nice
Send a message via AIM to Sachiel7
Thank's for the response guys.
Let me tell you the application here.
The 82x3 matrix was a table of data for movement, specifically to write our team name, RAPTAR.
It was planned out extremely in-depth.
The main loop only contains this code:

void Process_Data_From_Master_uP(void)
{
Getdata(&rxdata);

pwm01 = pwm02 = 127;
pwm03 = pwm04 = 127;

if (F_Count < MAX_FUNC)
{
counter ++;

if (counter > Func[F_Count][2]*58)
{
counter =0;
F_Count ++;
}

if (F_Count == MAX_FUNC)
{
F_Count = 0;
}
pwm03 = Func[F_Count][0];
pwm04 = Func[F_Count][1];

}
Putdata(&txdata);
}

Simple, No?
F_Count is the Function counter. It keeps track of what current function we're on.
counter is a loop counter. Since the User_Routines.C loops every 17ms, It loops roughly 58 times/sec. This is where the Decimal Precision comes in. Func[82][3] is an array that holds movement data. As you can see from the code, Func[x][0] and Func[x][1] are the left/right pwm values. Func[x][2] is the Time Value. This is the number (in seconds) of time for the function to be carried out.
The decimals come in here: 90 degree rotation.
To get the time each wheel must travel for complete 90 degree rotation you simply do this:

((2*pi*(WD /2))/4)/(WC*(170/60))

Where WD is the distance in inches between the wheels, and WC is the circumference of a wheel. This is not done in code, I got the values ahead of time and hard coded them into the Func array.
The particular 90 deg. Rotation variable for our bot is this:
0.4085043078971248173852353625317 seconds

Now, I know there still isn't going to be that much precision, but trust me, there is a BIG difference between passing our decimal time than passing a 1 time for rotation.
One way to get around all this might be to measure cycle-by-cycle. Where Func[x][2] = Time in Cycles. But this would require some additional math. Not much, I suppose. That was my idea from the last post, and I'm just getting started on it.
That would turn our nasty decimal rotation time into about
240 cycles.
That would allow for an integer array.

I am led to believe that the size of the array might have been the
cause. I tested the code with smaller arrays, and it worked fine.
However, parts were re-written, so I'm still not 100% sure.

Anyway, I've got this method working up to an extent now. I'll continue to post here as EduCAD develops.
__________________
-=Sachiel7=-

There's no such thing as being too simple!
Look for Team #1132, RAPTAR Robotics at the VCU Regional this year!