Quote:
|
Originally Posted by Jon236
Brad,
Does WPILib have a math function library?
Jon Mittelman
Team236
|
Jon -
There is no explicit math library. It does link with the standard Microchip libraries so that gets you all the math.h stuff. However I would not recommend doing too much floating point math - it's really slow on the little PIC processor.
Last year we used this library of
Cordic math functions - that used 24 bit (short long) arithmetic to do trig functions if that's what you're looking for. It was graciously posted by team 236.
It worked pretty well for us - those holonomic drive calculations needed a bunch of trig functions. So I'd recommend that solution to anyone who needs general purpose trig functions.
With that said, you might also try lookup tables if you don't need a small range of values to be calculated. This only works in some applications and might be useful this year.