View Single Post
  #24   Spotlight this post!  
Unread 11-05-2011, 08:45
EthanMiller EthanMiller is offline
Lead Programmer
AKA: Socks
FTC #4356 (The Zip Ties)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Clayton, NY
Posts: 121
EthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura aboutEthanMiller has a spectacular aura about
Re: Offseason Project: Holonomic Kiwi Drive Robot

Okay, thanks. We're using the FTC stuff - an NXT programmed with RobotC - Do the FPGA issues apply to that, as well?

Okay - I think I may have found the issue. I was watching the variables and noticed at position (127,0) on the joystick, W1 and W2 were being sent 0's. The Joystick was scaled by dividing by 1.28 (Because 128 was the maximum negative value)

The code I used is:

Code:
 W1 = (- 1/2 * 99) - (sqrt(3)/2 * 0)
To test if I was off in my order of operations, I parenthesized more fully the code:

Code:
 W1 = ((-1 * (1/2)) * 99) - (((sqrt(3))/2) * 0)
And ran those calculations on RobotC - both returned 0. On a TI-89, they returned -49.5, which is what I expected.

I dove a bit deeper - I tried each individual expression.

Code:
  float test = -1/2;
  
  writeDebugStreamLine("%d", test);
Returned 0.

Then,
Code:
  float test = -.5;
  
  writeDebugStreamLine("%d", test);
Returned -1090519040.

sqrt(3)/2 returned 1063105496 - Any idea what the problem is?

EDIT 2:

Tested the sample math program, everything worked. It printed to the NXT screen, so I told it to print to the debug stream as well - lo and behold, something mucked up the numbers in between. I changed the code on the NXT to be -.5 instead of -1/2 and it works fine now - Why is that?
__________________
When all else fails, read the manual.

FRC 1713 K Island Gears 2009, 2010 (Not 2011 due to budget, hopefully 2012!) - Fingerlakes Regional

FTC 4356 The Zip Ties 2010-2011 Season - NNYRC (2010 9th seed).

Last edited by EthanMiller : 11-05-2011 at 10:39. Reason: Did more testing, here's the results.