To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1411
1410  |  1412
Subject: 
Re: c++ classes
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Fri, 8 Sep 2000 15:55:46 GMT
Viewed: 
1310 times
  
Hey, everybody. I'm going to try to patch and build this this weekend.
(ADSL line goes in today, so it becomes suddenly more feasible to build
and test with gcc 2.95.) However, if anyone else has already done that,
and can test these (particularly the makefile changes) that would be
great.
Luis

On Fri, 8 Sep 2000, Pat Welch wrote:

Date: Fri, 8 Sep 2000 14:52:15 GMT
From: Pat Welch <legOS@mousebrains.com>
To: lugnet.robotics.rcx.legos@lugnet.com
Subject: c++ classes

Dear legOSers,

I have written a set of c++ classes for manipulating sensors and motors
within legOS.  The classes include:

A) Sensor, a base class for accessing sensors
B) LightSensor, derived from Sensor, but uses the LIGHT function to get values
C) RotationSensor, derived from Sensor, with additional methods for turning
   on/off rotation sensing, and setting the current absolute position
D) TouchSensor, which is equivalent to Sensor, but is defined for symmetry to
   Sensor
E) Battery, is analogous to Sensor, and is defined for symmetry to Sensor
F) Motor, a class for manipulating motors
G) MotorPair, a class for manipulating two motors in a rover configuration

A tar file with the above classes is available at

http://kayak.physics.orst.edu/legOS/c++.tar.gz

which contains all the above classes in include/c++ and associated demos in
demo/c++.

I have tested everything, except for the RotationSensor, which I don't have
yet.

On a design note, I am not using virtual classes, since this increases the
memory footprint by ~600-1000 bytes per class instance.  Instead, I have used
concrete derived classes, which increase the memory footprint by ~200-300 bytes
for the first instance, and ~50 bytes for each additional instance.

I also have a set of patches against the 5-Sep-00 legOS cvs source tree.  The
patches include:

a) Use $@, $<, and $+ in many of the Makefiles instead of $*.o, $*.c, ...
b) Added support for c++ source file suffix of .C
   (Note, my standard convention is for c++ files to have a suffix of .C and
    c++ header files to have a suffix of .H, but if you all feel this not
    desirable, let me know, and I will adopt the .cpp and .h convention
    currently used within legOS.)
c) Added the function, __pure_virtual(), in lib/c++/stub.c to support pure
   virtual classes.

The patches are available at

http://kayak.physics.orst.edu/legOS/patches.gz

which is a cvs diff output.

Both files are relative to the legOS root directory.

Please let me know any comments you have on this work, and if you feel it would
be worthwhile to include as part of legOS.

Pat
legOS@mousebrains.com

P.S. This code all compiles cleanly under gcc 2.95.2, I don't think I'm doing
anything that will break under egcs, but I have not tested that.



-----------------------------------------------------------------------

    "Summertime... and the living is easy...
    fish are jumping and the cotton is high...
    So hush, little baby, baby don't you cry."
-Ella

-----------------------------------------------------------------------



Message is in Reply To:
  c++ classes
 
Dear legOSers, I have written a set of c++ classes for manipulating sensors and motors within legOS. The classes include: A) Sensor, a base class for accessing sensors B) LightSensor, derived from Sensor, but uses the LIGHT function to get values C) (...) (24 years ago, 8-Sep-00, to lugnet.robotics.rcx.legos)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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