Help with the float tan cammand

6 replies [Last post]
spartaboy300
Title: NooBot
Joined: 11/19/2013
Posts:
BotPoints: 7
User offline. Last seen 8 years 42 weeks ago.

I am trying to get our robot to turn a certain amount of degrees. I found the float tan command but when ever I use it, it says it isn't formatted correctly.

2timer
Title: NooBot
Joined: 12/03/2013
Posts:
BotPoints: 4
User offline. Last seen 8 years 42 weeks ago.

wow i haved same issue!! u just turn robot on and off

spartaboy300
Title: NooBot
Joined: 11/19/2013
Posts:
BotPoints: 7
User offline. Last seen 8 years 42 weeks ago.

Could I see an example on how it is supposed to be typed?

2timer
Title: NooBot
Joined: 12/03/2013
Posts:
BotPoints: 4
User offline. Last seen 8 years 42 weeks ago.

Just start all over and keep trying until you get it

spartaboy300
Title: NooBot
Joined: 11/19/2013
Posts:
BotPoints: 7
User offline. Last seen 8 years 42 weeks ago.

I tried this already. May I see an EXAMPLE on what it should look like.

JMonsorno
JMonsorno's picture
Title: NooBot
Joined: 11/28/2010
Posts:
BotPoints: 37
User offline. Last seen 5 years 28 weeks ago.

C Example:
const double PI = 3.14159265359;
printf("%f\n", tan(45 * PI / 180));

C++ Example:
printf("%f\n", tan(45 * PI / 180));

In C++ PI is already defined as 3.141590

Why use PI? The "tan" function uses radians as input, in these examples I'm performing the tangent on 45 degrees by converting it to radians first.

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

@spartaboy300: What exactly are you trying to do? I've never seen anyone use the tan() function for detecting turn distance.

@2timer: If you don't have something helpful to say, you really shouldn't be saying anything. Please refrain from further condescending posts.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS