View Single Post
  #21   Spotlight this post!  
Unread 09-06-2015, 20:56
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,725
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Arduino Micro with Talon SR

Quote:
Originally Posted by AdamHeard View Post
Depending on how fast all this is running (and what else is going on) using floats may be out of the question due to the slower math.
I did say ideally!

I'm fully aware of the need to program for integers in some cases. I even wrote a fully integer semi-swerve drive inverse kinematics a few years ago. My semi-swerve platform was about 1/3 FRC scale, with a 0-180 degree maximum steering angle steered by servos, and 25mm 1000rpm gear motors for drive, and yes, it was controlled with an Arduino. Unfortunately, the only hard drive that the code was on has since died. The key was that I wrote a hypoti(x,y) subroutine that calculated an integer hypotenuse using max(x, y) and the ratio 256 * min(x,y) / max(x,y) (where x and y were preprocessed to be non-negative), and an atan2id(y,x) that returned atan2(y,x) in degrees based on the same ratio, whether abs(x) or abs(y) was larger, and the two input signs. IIRC, the atan2id() routine had two separate cubic fits to cover the span from 0 to 45 degrees, that broke based on whether 2*min(x,y)/max(x,y) was 0 or 1 (that is, at about 28.8 degrees).
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.