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 / 15431
15430  |  15432
Subject: 
SoftBricks Class And Object Model
Newsgroups: 
lugnet.robotics
Date: 
Sat, 12 May 2001 23:21:23 GMT
Viewed: 
599 times
  
SoftBricks is a collection of ActiveX objects designed to make programming
the LegoMindstorms robots simply, powerful, fast, and fun. This post is part
of an ongoing series designed to introduce SoftBricks to the MindStorms
community. SoftBricks can be downloaded for free at
http://www.geocities.com/dave_leeper/Robots/SoftBricks.htm

SoftBricks consists of an object structure that mirrors the RCX robot that
comes with Mindstorms. SoftBricks has motor, sensor, timer, and IR Port
classes, just as the RCX does. This means that there is no new design to be
learned when using SoftBricks. If the developer knows the design of the RCX,
he already knows the design of SoftBricks.

SoftBricks classes encapsulate much of the complexity of coding the Lego
RCX. This means SoftBricks code is often much more readable than equivalent
code that uses just Lego’s Spirit control. For example, SoftBricks replaces
many of the confusing If and While statements that appear in pure Spirit
code with functions that performs equivalent operations with code that is
short and very readable.

As an ActiveX component, SoftBricks can be used in any programming
environment that supports ActiveX. Such environments include Microsoft’s
Visual C++, J++, and Visual Basic, Borland’s C++ Builder, and PowerSoft’s
PowerBuilder, to name a few. Also, any application that supports Visual
Basic For Applications, such as Microsoft’s Word and Excel, can use
SoftBricks. Web pages can also access SoftBricks functionality using the
OBJECT tag.

Being an ActiveX component also means that SoftBricks functionality can be
combined with other ActiveX controls, such as graphing and database
controls. This means that SoftBricks presents one of the most powerful and
flexible programming environments available for Mindstorms.

=== SoftBricks Class Structure: Interfaces And Implementations ===

SoftBricks conforms to the ActiveX design model. This means that interfaces
play a key role in the design of SoftBricks classes. Each interface in an
ActiveX component provides a signature that specifies the services the
ActiveX component provides. This signature is a collection of function
names, along with the associated parameter types and return types. Classes
implement an interface. A class that implements a given interface guarantees
that it provides the methods of an interface exactly as described in that
interface.

The chart below shows the interfaces that make up SoftBricks, and the
classes that implement each interface. Programmers can also write their own
classes that implement any or all of the SoftBricks interfaces and use those
classes in their code.

IBrain
  BrainAvoid
  BrainCruise
  BrainCruiseAndAvoid

ICalibrate
  CalibrateGrayCard
  CalibrateInside
  CalibrateOutside

IDatalog
  Datalog

IIdentity
  Identity

IIRPort
  IRPort

IMap
  Map5TurnMap9Turn
IMotor
  Motor

IProgram
  RCXProgram

IRandom
  RandomNumber

IRoboCall
  RoboCall

ISensor
  SensorLight
  SensorRotation
  SensorTouch

IServices
  Services5x1x6

ISound
  Sound

ISub
  SubMap5Replay
  SubMap5ReplayBackwards
  SubMap5TurnLeft
  SubMap5TurnRight
  SubMap9Replay
  SubMap9ReplayBackwards
  SubMap9TurnLeft
  SubMap9TurnRight

ITask
  TaskCruiseAndAvoid

ITimer
  RCXTimer
IVar
  Var

IWatch
  Watch

RCX
  RCX

=== SoftBricks Object Structure ===

A diagram of the SoftBricks object model can be found at
http://www.geocities.com/dave_leeper/Robots/ObjectModel.gif

The main object in SoftBricks is the RCX object. It represents the Lego RCX
robot. The RCX object has numerous other objects as members. From the
diagram you can see that the RCX object has 5 program objects, 10 task
objects, 8 subroutine objects, 32 variable objects, 1 IR Port object, 3
motor objects, 3 sensor objects, 1 datalog object, 4 timer objects, 1 random
number generator object, 1 sound generator object, 1 watch object, and a
Downloader object.The main RCX object can be obtained by calling the
GetRCX() function. This is a global function, available for use anywhere in
the code, and it always returns the same RCX object.

Once the programmer has access to the RCX object, all the remaining
functionality of the RCX is encapsulated in its member objects.



Message has 1 Reply:
  Writing And Running A SoftBricks Program
 
This post is part of an ongoing series designed to introduce SoftBricks to the MindStorms community. SoftBricks can be downloaded for free at (URL) installment shows how to use SoftBricks from any application that supports Visual Basic for (...) (23 years ago, 24-May-01, 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

 
Contact Recovery Nerd for Speedy USDT / BTC Recovery
17 hours ago
Custom Search

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