To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1490
  Problems with NQC and math operations
 
Hi- I'm currently working on a project to get a dead-reckoning navigation system to work with NQC and the RCX. Right now I have a compass sensor and a rotation sensor hooked up and the idea is that with an angle and a distance, I can get an x and y (...) (22 years ago, 2-Feb-03, to lugnet.robotics.rcx.nqc)
 
  Re: Problems with NQC and math operations
 
Jeff, Your problem is with the 16 bit integer size that NQC uses. All integers are in the range -32768 to 32767. Using 10000 to simulate fixed point math operations is killing you. Everything works when you replace theta and D with constants because (...) (22 years ago, 2-Feb-03, to lugnet.robotics.rcx.nqc)
 
  Re: Problems with NQC and math operations
 
Dean, Well, that was the problem...changing the 10000 to 100 makes me get a value back, however I think the error is too big for the robots to navigate effectively..I'll probably have to learn legOS so I can use floating-point and get more precise (...) (22 years ago, 2-Feb-03, to lugnet.robotics.rcx.nqc)
 
  Re: Problems with NQC and math operations
 
(...) Did you considered that the RCX has only integer variables. So, the allowed operation range is -32768 32767. If at any stage of your operation you exceed these limits, the result will be corrupted. For the use of sine and cosine with integer (...) (22 years ago, 3-Feb-03, to lugnet.robotics.rcx.nqc)
 
  Re: Problems with NQC and math operations
 
In lugnet.robotics.rcx.nqc, Jeff Merrick writes: I'll probably have to learn legOS so I can use floating-point (...) Hi Jeff: If you are going to learn a new way of programming the RCX, I recommend LeJos. It implements the Java Math class in an (...) (22 years ago, 4-Feb-03, to lugnet.robotics.rcx.nqc)
 
  Re: Problems with NQC and math operations
 
Roger, I'd seen LeJOS mentioned but hadn't considered it as an option...that should really work well for what I'm doing.. Thanks, Jeff (22 years ago, 5-Feb-03, to lugnet.robotics.rcx.nqc)

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR