Quote:
|
Originally Posted by Chris Hibner
Do you really need a sqare root? We originally had a square root in our waypoint calculation (to determine the distance from us to the waypoint), but we determined the square root was unessecary. Why? Because we're using feedback control to get to the position AND x^2 + y^2 becomes zero at the same point as sqrt(x^2 + y^2). Anyway, it's just a thought - you may not need the square root afterall.
-Chris
|
If you do find you need to compute sqrt(x^2+y^2), might I suggest the CORDIC algorithm (mentioned here before for sin/cos by Kevin Watson, I believe ... I found it very useful). Here is a very good file explaining it:
http://www.andraka.com/files/crdcsrvy.pdf. The nice thing about it, is that it is a "shift and add" algorithm ... which is very fast. Maybe I'm just wierd, but I thought it was cool, and was disappointed when I realized we wouldn't be using it ... like Chris said he didn't need to compute the sqrt, we figured that we might not need to compute trig functions ourselves either.