To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 12671
12670  |  12672
Subject: 
NQC versus Lego RCX Code Speed
Newsgroups: 
lugnet.robotics
Date: 
Wed, 4 Oct 2000 18:13:37 GMT
Original-From: 
Wilcox, Doug <doug.wilcox@imckesson&StopSpammers&.com>
Viewed: 
658 times
  
Am I imagining things, or is NQC much faster than RCX Code when programmed
to do similar tasks.

As part of my ongoing NQC study, I replaced today a program I'd originally
written with the drag-n-drop RCX Code generator, with one written in NQC.
It's a simple program that starts the robot moving forward, and then backs
up and turns. Two touch sensors are used, and if one is triggered, the robot
turns one way, and if the other is triggered, it turns the other way.

The NQC version _seems_ to be responding to sensor input more quickly.
I had thought that the end result would be the same from either source when
it actually gets to the RCX.

Am I imagining the speed increase, or does the compiled program that goes to
the RCX in NQC much faster than the program RCX Code downloads? (And: Is the
RCX Code stuff compiled and then sent, or does the RCX have to interpret
it?)

--Doug Wilcox

Here's the RCX code, if you're interested:
-------------------------------------
#define backTime 40
#define turnTime 20
#define loopCount 200
int loops;


task main()
{
  // move foward until a touch sensor is triggered
  SetSensor(SENSOR_1,SENSOR_TOUCH); SetSensor(SENSOR_3,SENSOR_TOUCH);
  OnFwd(OUT_A + OUT_C);

  while (true)
  // Above sets an infinite loop
  {
    if (SENSOR_1 == 1)
    {
     OnRev(OUT_A + OUT_C);
     Wait(backTime);
     OnFwd(OUT_A);
     Wait(turnTime);
     OnFwd(OUT_A + OUT_C);
    }

    if (SENSOR_3 == 1)
    {
     OnRev(OUT_A + OUT_C);
     Wait(backTime);
     OnFwd(OUT_C);
     Wait(turnTime);
     OnFwd(OUT_A + OUT_C);
    }

    loops += 1;

    if (loops == loopCount)
    {
    PlaySound(1);
    loops = 0;
    }
  }
}



Doug Wilcox
Senior Web Developer
iMcKesson Provider Solutions Group-Needham
160 Gould Street, Suite 130
Needham, MA 02494-2308
Phone: 781.453.2900 x 237
Fax: 781.455.7990
e-mail: Doug.Wilcox@iMcKesson.com
http://www.imckesson.com

"You see, I had this space suit. How it happened was like this ..."
(Opening lines from Robert A. Heinlein's Have Space Suit-Will Travel)



Message has 1 Reply:
  Re: NQC versus Lego RCX Code Speed
 
I've also notice NQC codes are much smaller in comparision to RCX. I think the speed and size have to do with the fact that RCX are generated generic codes (very inefficient). (...) (24 years ago, 4-Oct-00, to lugnet.robotics)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    
Active threads in Robotics

 
Verified and Trusted Team of Hackers
4 hours ago
Custom Search

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