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 / 117
     
   
Subject: 
NQC 2 Request
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Tue, 14 Sep 1999 10:33:12 GMT
Viewed: 
3110 times
  

Hi,

I just wondered whether it might be handy to add OnFwdFor(motors) and
OnRevFor(motors).

Regards

Dave


--
David Warnock
Sundayta Ltd

   
         
     
Subject: 
Re: NQC 2 Request
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Wed, 15 Sep 1999 06:13:52 GMT
Viewed: 
3111 times
  

Its a little too late to add to the NQC 2 API, but I can add it in a later
release if people really want it.  Anyone second the idea?

Dave Baum


In article <37DE2468.66B220C4@sundayta.co.uk>, David Warnock
<david@sundayta.co.uk> wrote:

Hi,

I just wondered whether it might be handy to add OnFwdFor(motors) and
OnRevFor(motors).

Regards

Dave

--
reply to: dbaum at enteract dot com

    
          
     
Subject: 
Re: NQC 2 Request
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Wed, 15 Sep 1999 15:27:20 GMT
Reply-To: 
DONC@CCCD.nospamEDU
Viewed: 
3202 times
  

Dave,

I like the finite coltrol of the motors myself but can understand the
request. It may encourage the "younger" programmers to use the
language.

Does adding the commands go against your move to get closer to the
API?

The user could always create a macro for the command.
---
    DonC
    donc@cccd.edu

    
          
     
Subject: 
Re: NQC 2 Request
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Wed, 15 Sep 1999 23:35:25 GMT
Viewed: 
3221 times
  

In article <ILrfN=1HsT26NaMerhMgfJ=YFnU8@4ax.com>, donc@cccd.edu wrote:

Dave,

I like the finite coltrol of the motors myself but can understand the
request. It may encourage the "younger" programmers to use the
language.

Does adding the commands go against your move to get closer to the
API?

No, that's not a big deal, I don't mind a "superset".  Most of the NQC 2.0
changes were to make terminology consistent between RCX Code and NQC, etc.

Dave

--
reply to: dbaum at enteract dot com

   
         
     
Subject: 
Re: NQC 2 Request
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Wed, 15 Sep 1999 14:45:22 GMT
Viewed: 
3887 times
  

Why not just use a macro instead of expanding the language?

At 06:13 AM 9/15/99 +0000, you wrote:
Its a little too late to add to the NQC 2 API, but I can add it in a later
release if people really want it.  Anyone second the idea?

Dave Baum


In article <37DE2468.66B220C4@sundayta.co.uk>, David Warnock
<david@sundayta.co.uk> wrote:

Hi,

I just wondered whether it might be handy to add OnFwdFor(motors) and
OnRevFor(motors).

Regards

Dave

--
reply to: dbaum at enteract dot com


Joel Shafer    joel@connect.net

    
          
     
Subject: 
Re: NQC 2 Request
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Wed, 15 Sep 1999 23:34:01 GMT
Viewed: 
3490 times
  

That's all that really happens when I add new calls anyway.  Anything that
even remotely looks like a function call is either an inline function of a
macro, and not part of the language itself.

I guess the real question is if its appropriate to extend the "official"
API in this way or not.  At the moment, the feature set for 2.0 is closed
since I'm just tyring to wrap up documentation and get the release final.

Dave

In article <4.2.0.58.19990915094448.00bdc930@mail.connect.net>, Joel
Shafer <joel@connect.net> wrote:

Why not just use a macro instead of expanding the language?

At 06:13 AM 9/15/99 +0000, you wrote:
Its a little too late to add to the NQC 2 API, but I can add it in a later
release if people really want it.  Anyone second the idea?

Dave Baum


In article <37DE2468.66B220C4@sundayta.co.uk>, David Warnock
<david@sundayta.co.uk> wrote:

Hi,

I just wondered whether it might be handy to add OnFwdFor(motors) and
OnRevFor(motors).

Regards

Dave

--
reply to: dbaum at enteract dot com


Joel Shafer    joel@connect.net

--
reply to: dbaum at enteract dot com

   
         
   
Subject: 
Re: NQC 2 Request
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Wed, 15 Sep 1999 23:38:35 GMT
Viewed: 
3472 times
  

In article <37DE2468.66B220C4@sundayta.co.uk>, David Warnock
<david@sundayta.co.uk> wrote:

I just wondered whether it might be handy to add OnFwdFor(motors) and
OnRevFor(motors).


If anyone wants to add these functions into their own code...

void OnFwdFor(const int m, const int &t) { Fwd(m); OnFor(m, t); }
void OnRevFor(const int m, const int &t) { Rev(m); OnFor(m, t); }

These should be efficient - everything will be inlined and no temporaries
will be created - unless a temporary is needed during the computation of
t...

int x, y;
OnFwdFor(x); // ok, no temporary
OnFwdFor(x+y);  // need temp to compute x+y

Dave

--
reply to: dbaum at enteract dot com

   
         
   
Subject: 
Re: NQC 2 Request
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Thu, 16 Sep 1999 12:19:36 GMT
Viewed: 
3415 times
  

Dave,

Thanks for all the comments in the thread. As I have not looked at the
API supplied by the firmware I did not realise that the NQC api was such
a close match.

Adding the functions as you have suggested is a very neat solution.

It is nice to have alternatives in coding so that we can either just use
the primitives (Fwd, On, OnFor) where we learn less functions but write
more code (sometimes) or where we can use more complex functions such as
OnFwd and OnFwdFor.

The API for NQC 2.0 does seem very clean and I will be using it for all
future projects.

I found NQC 1.x good with my older son (age 7) within the RCX Command
Centre, although my younger son (5) is much better with the Lego
interface (and lots of help).

Many thanks

Dave

--
David Warnock
Sundayta Ltd

 

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