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 / 12673
12672  |  12674
Subject: 
Re: NQC versus Lego RCX Code Speed
Newsgroups: 
lugnet.robotics
Date: 
Wed, 4 Oct 2000 19:15:49 GMT
Viewed: 
1629 times
  
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).

In lugnet.robotics, "Wilcox, Doug" <Doug.Wilcox@iMcKesson.com> writes:
> 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 is in Reply To:
  NQC versus Lego RCX Code Speed
 
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 (...) (26 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
    

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