View Single Post
  #18   Spotlight this post!  
Unread 22-03-2005, 00:26
robotaddict's Avatar
robotaddict robotaddict is offline
Registered User
FRC #1294 (Screws Loose (hopefully going to be changed soon))
Team Role: Programmer
 
Join Date: Mar 2005
Location: Sammamish, Washington
Posts: 11
robotaddict is on a distinguished road
Talking Re: Holomonic Drive mathmatics discussion


Hooray! I have made a major breakthrough. Using my old ideas the robot could think it had an input greater than 255. What I have done is this:

cos(gyro_angle) * P1_y - sin(gyro_angle) * p1_x
cos(gyro_angle) + sin(gyro_angle)

What the bottom part does is makes it so that if both inputs are say, 255, then it boils down to (1*255)/1! This makes the scaled inputs never equal more or less than the maximum or minimum, respectively. I have left out the truncate function and the 0-centering of the inputs (and the extra +127 at the end) to simplify things, but you get the idea. No more of this here!

The conversion of these new, spiffy inputs to drive commands was a bit perplexing, too. Because the wheels look like this,

(imagine that they're at 90 degree angles to each other)
/....\

\..../

the computations are a bit tricky. I boiled it down to two major situations and two minor situations in one major. The major situations are whether or not the inputs are more along the drive axis of that set of wheels, or more not-along it. A deviation of 45 degrees or less means that the drive is more along the axis, but a deviation of the inputs by more that 45 degrees is not along the drive axis. The minor situations are whether the wheel set should be forwards or backwards when the drive is more-aligned with the axis. A topographical-style look of an inputs-to-outputs graph makes it out like so:

non-aligned w/axis:
\ \ \
\ \ \
\ \ \

aligned w/axis:
---|
--||
-|||

If you get what I mean. In the aligned w/axis case the motors drive at the greatest (or least, depending on direction) input. In the not-aligned w/axis case it becomes a simple "what's-this-angle?" and "what's this-cos?" problem.

Thank you for listening, I hope you enjoyed this. If you have any ideas on how to improve this process, just post it here and I'll get back to you. Maybe. I hope...