Thread: Syntax Error!
View Single Post
  #9   Spotlight this post!  
Unread 04-02-2006, 02:00
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Syntax Error!

The math.h trig functions only take radians.

If you want, you can do a macro to do degrees, i.e.:

#define PI 3.14159265f
#define dtan(x) tan(x*PI/180.0f)

Then, put this in your code where appropriate:

dtan(tilt_angle_rad);

The only thing that I can think of that would make your equation give bogus results is if the servo angle conversion function is off. Make sure that whatever Kevin's code defines as the servo's zero corresponds with 0 degrees of tilt - you may have to either rotate the servo horn or redefine the zero point (in tracking.h) to find a good zero.