Go to Post HEY! a robot that occupies 4 dimensional space is against the rules! - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Spotlight this post!  
Unread 29-05-2014, 01:20
jrw jrw is offline
Registered User
FRC #4774 (The Drop Bears)
Team Role: Mentor
 
Join Date: Sep 2013
Rookie Year: 2013
Location: Sydney
Posts: 6
jrw is an unknown quantity at this point
Lightbulb Re: Using atan2 on the cRIO

For anyone hitting the same obscure problem here is the answer.

I note from the github repo of the OP's code that they are using the C++11 toolchain from FirstForge. We haven't used the original toolchain, only the C++11 toolchain too, so it might only affect those teams using this.

Anyway, the problem is that the compiler substitutes the float version of trig functions if it thinks you don't need the extra precision.
If you have:
Code:
float f = atan2(float x, float y)
then the compiler will substitute this for the atan2f function, and this is not on board the cRIO.

Change your code to:
Code:
double d = atan2(double x, double y)
and it will be plain sailing. Even casting the floats to doubles as you call the function will work.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:41.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi