I've been taking a look at the Lego Cybermaster product and playing around to see what is possible in terms of controlling it via the Spirit OCX. There does not seem to be a lot of information around on the Web about this device so I thought I would share what I know with anyone else out there.
OK so what do you get well the basic kit comes with a large block (theC2) 3 touch sensors and a single additional Lego motor, you also get lots of Lego Technics components a CD-Rom and a tower to provide communications with the models. The kit is designed to allow you build several vehicles and control them either by very simple programming or by direct manual control. I'm not really interested in using the thing as it comes out of the box so won't bother to give details of the standard environment.
Most of you will be familiar with the Lego Mindstorms product, this is closely related to the Cybermaster so what I'm going to do is detail what is different about the Cybermaster and what things I've discovered about the Spirit that I've not seen documented elsewhere. For a good description of using the Mindstorms RCX brick via Spirit seeProgramming with Lego Brick Control OCX this provides lots of details about the RCX and Spirit OCX.
The main brick in the Cybmaster seems to be a special version of the RCX brick. It seems to use virtually the same set of commands as used by Mindstorms. However is has several unique points.
- The brick has a two way radio link for communications rather than Infra Red.
- The brick has two built in motors positioned on each side (obviously designed for producing vehicles).
- The brick has only a single motor output (Mindstorms has three two of these are used by the built in motors on Cybermaster).
- The Cybermaster appears to have only a single programming slot (I'm not sure how big this is any know how to find out?).
- The Cybermaster has no LCD display.
- The brick has three sensor inputs (the same as Mindstorms).
- The kit contains three sensors. These have a built in resistor to allow the standard software to work out which sensor is plugged into which connection.
- The built in motors each have an associated tachometer this allows very precise measurements of distance moved etc.
- The brick does not require the downloading of a firmware file before use. I'm not sure what exactly the firmware for Mindstorms provides maybe it relates to the program slots in some way.
So clearly Mindstorms and Cybermaster have been designed with a common base but different aims. Seems to me that Mindstorms is intended to be more general purpose and to be used mainly for autonomous operation. Cybermaster is aimed specifically at creating vehicles and is intended to be operated using the host system (It can be programmed to operate autonomously but the lack of slots seems to imply more central use). My major interest is using a mixture of control techniques downloading basic control functions to the device and using the power of the PC to perform 'higher level' decision-making. This mode of operation is clearly intended by the designers. In auto pilot mode various routines (I have reversed engineered them but probably can't post them because of copyright etc.) are downloaded to the brick for basic motor control. These are then given instructions from the PC via the radio link. The PC also polls the device to obtained status information (including distance traveled etc.).
I've been driving the Cybermaster from C++ via the Spirit interface so the examples I'm going to give below are from that code. I'm sure you can work out how to use it from your own preferred language.
Cybermaster initialization is similar to that for Mindstorms….
m_Spirit.SetComPortNo(4); // Select the port that the Cybermaster tower is connected to.
m_Spirit.SetLinkType(2); // Set link type to radio Mindostorms uses 0 - Infra red
m_Spirit.SetPBrick(0); // Select RCX brick - same as Mindstorms
m_Spirit.InitComm(); // Initialize basic comms
m_Spirit.PBAliveOrNot(); // Check to see if the thing is working/turned on
m_Spirit.UnlockFirmware("Do you byte, when I knock?"); // Get ready to run.
The only special steps are the type of link to use and the need to unlock the firmware. I'm not sure what happens with Mindstorms if you use the above sequence (except for the link type), without downloading the Mindostorms firmware. Maybe you end up with a cybermaster?
In playing around with Cybermaster I came across a few items that do not seem to be documented on other pages. I'm not sure if they work on the Minstorms RCX but my guess would be that some of them will.
Location [5, 0] and [5,1] allow the current values of the tachometers associated with the built in motors to be read.
ClearTachoCounter(MotorList) Clears the tachometer value associated with motors 0 or 1.
Drive(Number0, Number1) Set Motor 0 to power Number0 (-7 .. +7) and Motor 1 to power Number1 (-7 .. +7). Used when controlling Cybermaster manually.
OnWait(MotorList, Number, Time) Set the motors mentioned in MotorList all to power Number and wait for Time before continuing.
OnWaitDifferent(MotorList, Number0, Number1, Number2, Time) Set the motors in MotorList to power Number0 (for motor 0) Number1 (for 1) and Number2 (for 2) and then wait for Time before continuing.