View unanswered posts | View active topics It is currently Tue Jul 29, 2014 8:58 pm






Reply to topic  [ 4 posts ] 
1.#QO value in global variable 
Author Message
Rookie

Joined: Sat Oct 25, 2008 12:18 am
Posts: 19
Post 1.#QO value in global variable
we are trying to program a holonomic drive and we are doing some sqrt(x^2 + y^2) .... stuff and get reasonable values in the first and 4th quadrants and MOST of the 3rd quadrant, but at maxX and maxY of the joystick, the global variable, which is a "float" becomes 1.#Q0 or 1.#Q0 as a value, and the motors stop. Any ideas??


Wed Jun 15, 2011 12:29 am
Profile
Rookie

Joined: Wed Feb 24, 2010 11:43 pm
Posts: 34
Post Re: 1.#QO value in global variable
a couple things,

1. It was pointed out to me that the ^ operator is not an exponent, but a shift...

2. You might be exceeding the limits of a type somewhere, so you might want to consider casting the value first
Code:
float gfValue = sqrt( ((float) x * (float) x) + ((float) y * (float) y));


just a couple ideas.


Thu Jun 16, 2011 2:23 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3164
Location: Rotterdam, The Netherlands
Post Re: 1.#QO value in global variable
The ^ operator is bitwise xor, not shift. Shift is << for left shift and >> for right shift.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Jun 17, 2011 7:34 am
Profile WWW
Rookie

Joined: Wed Feb 24, 2010 11:43 pm
Posts: 34
Post Re: 1.#QO value in global variable
mightor wrote:
The ^ operator is bitwise xor, not shift. Shift is << for left shift and >> for right shift.

- Xander


Thanks Xander!

You were the one that told me last time... and I didn't go back and look at my notes...


Wed Jun 29, 2011 8:02 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.