Translate

domingo, 29 de março de 2020

CyberMaster (Parte I) - Programação avançada para o LEGO TECHNIC CyberMaster





Lançado unicamente na Europa em 1998 (conjunto 8482), no ano em foi lançado o RCX, este robot da gama LEGO® Technic , tinha a particularidade de ser controlado por rádio frequência. A torre de emissão possuía duas antenas bem como o tijolo programável (ver imagem abaixo onde se vê as antenas aparafusadas - imagem/desenho original do CD-ROM). Outra particularidade é a que possui internamente dois motores independentes. Na parte superior possui 3 ligações de imput para sensores (a amarelo) e uma de output (a preto). Dado o conteúdo de um artigo antigo, mas apropriado para a divulgação deste robot, copio na íntegra o mesmo mais abaixo. Podem encontrar o original no link do texto que o antecede. Noutro post apresentarei o meu CyberMaster e como o podemos hoje em dia ainda o programar, uma vez que é algo díficil com a desatualização de software e de hardware utilizado à data.

Launched only in Europe in 1998 (set 8482), the year the RCX was launched, this robot from the LEGO® Technic  range, had the peculiarity of being controlled by radio frequency. The emission tower had two antennas as well as the programmable brick (see image below where you can see the screwed antennas - original image / drawing on the CD-ROM). Another feature is that it has two independent motors internally. At the top it has 3 imput connections for sensors (yellow) and one output (black). Given the content of an old article, but suitable for the dissemination of this robot, I copy it in full below. You can find the original in the text link that precedes it. In another post I will present my CyberMaster and how we can still program it today, since it is somewhat difficult with the outdated software and hardware used to date.


(atualização de informação - o site original já não está disponível - 15/12/2023)

(The text that follows is a copy of a good article written by MANU in the Terravista space, because it is a good replica)

Hardware


O CyberMaster baseia-se no processador Hitachi H8/3294 e tem 1.5K de memória RAM. Faz uso de uma torre emissora/receptora de rádio ligada a uma porta série para comunicar com o computador, e o seu alcance é de aproximadamente 15 metros.
O CyberMaster vem equipado com 3 portas de entrada e 1 de saída. A porta de saída é de uso geral e é compatível com os dispositivos LEGO® e tem capacidade selecção de tensão de saída com 7 níveis, em ambos os sentidos, permitindo portanto alterar a direcção e velocidade de um motor. As portas de entrada estão equipadas com um conversor analógico/digital de 10 bits e são de uso geral, mas não estão preparadas para fornecer energia a sensores activos, ao contrário do RCX.
Os 3 sensores de pressão com que o CyberMaster vem equipado trazem diferentes resistências, desta forma o CyberMaster consegue distinguir entre os diferentes sensores. O CyberMaster tem também capacidade de atestar a qualidade das comunicações com a torre e de verificar o consumo de energia do motor externo quando em funcionamento.
Os dois motores internos do CyberMaster são de alto-torque, embora tenham características diferentes do externo. Trazem integrados tacómetros de alta-precisão que permitem atestar o número de rotações com uma resolução de 1/50 de revolução, além de indicarem a velocidade instantânea a que os motores estão a rodar.
O conjunto 8482 LEGO TECHNIC CyberMaster além de vir com centenas de peças LEGO TECHNIC, rodas, lagartas, rodas dentadas, transmissões, etc., vem também equipado com 3 sensores de pressão e um motor de alto torque e de alta eficiência, além de 6 cabos de variadas dimensões para ligação aos motores/sensores.


Software (clique aqui para fazer download)

O CyberMaster tem 2 formas distintas de funcionamento: autónomo e directo. O modo de funcionamento autónomo consiste num programa que é carregado para a unidade e que fica em memória sendo executado em qualquer altura sem se recorrer ao computador. No modo directo, o computador dá instruções explícitas á unidade que são executadas no momento, muito semelhante a um carro telecomandado. Curiosamente, estes dois processos podem ser conduzidos em simultâneo.

O CyberMaster faz uso de um interpretador de instruções que lida directamente com o hardware, apelidado de firmware, e que ao contrário do RCX não reside em RAM.
Os programas são desenhados dando instruções a este interpretador que por sua vez se encarrega de executar as tarefas.
O CyberMaster vem equipado com 1.5K de memória RAM, mas apenas tem aproximadamente 400 bytes de espaço disponivel para um unico programa. Aparentemente pode não parecer muito, mas não esqueçamos que apenas nos limitamos a dar ordens ao interpretador para executar tarefas, gastando entre 1 a 5 bytes por cada instrução, instruções essas que chegam a ser tão complexas como pôr os 3 motores em marcha simultâneamente com velocidades e direcções também diferentes.
O único programa que o CyberMaster suporta pode conter até 4 tarefas (tasks), um máximo de 4 sub-rotinas e até 32 variáveis de 16 bits.
O software do CyberMaster não é de grande utilidade para quem queira entrar no mundo da robótica, estando mais vocacionado para brincar ou jogar do que programar, embora esteja muito bem desenhado e permitir ensinar os principais truques e potencialidades do produto além de ensinar a construir modelos muito bem conseguidos.



Programação Avançada


O MindStorms (RCX) e o CyberMaster são produtos internamente bastante idênticos, inclusive partilhando o mesmo processador. As diferenças sobressaem apenas no que toca à memória disponível, limite do número de programas, tarefas e sub-rotinas e algumas rotinas que se encontram ausentes quer num, quer noutro.

Software de desenvolvimento aconselhado pelo autor desta página:

Programação em modo Autónomo

O NQCC ou Not Quite C Compiler está a ser desenvolvido por Dave Baum com o intuito de expandir a flexibilidade de programação do dos tijolos programáveis da LEGO® . Trata-se da implementação de uma variação da linguagem C (daí o nome) e não é mais do que um compilador de instruções para o interpretador do RCX/CyberMaster. Este compilador shareware foi desenvolvido sem qualquer suporte da LEGO®  e através de muito trabalho de reverse engineer do RCX e do CyberMaster.

Tive a oportunidade trabalhar durante o último mês com Dave Baum, o autor do NQCC, para melhorar o suporte ao CyberMaster.

As novas modificações foram incorporadas no NQCC 1.0 Beta 4 que pode ser encontrado neste endereço:

www.enteract.com/~dbaum/lego/nqc/

(Nota atual: este link parece que atualmente está inoperacional, contudo pode o encontrar aqui)


Programação em modo Directo

Distribuído quer no CD do MindStorms quer no CyberMaster existe um componente de software com o nome de SPIRIT.OCX e que é usado pelo próprio software do RCX/CyberMaster (Spirit foi o nome de código de desenvolvimento do CyberMaster).
Este componente dá acesso a todas as funções do CyberMaster e permite comanda-lo em modo autónomo ou directo, além de ter muitas outras funcionalidades tais como permitir ver o estado corrente das variáveis/sensores do CyberMaster, o que é óptimo se quisermos criar um programa complexo que não se adapte as capacidades de processamento do CyberMaster.
Para os entendidos de programação em Windows 95/98/NT, suponho que nada mais será necessário acrescentar a esta descrição, para os restantes sigam estes links para exemplos de uso do SPIRIT.OCX, ou os links que disponibilizo na minha página de links.

Microsoft Visual C++:
www.geocities.com/SiliconValley/Hills/8306/Lego/mindprog.html

Microsoft Visual Basic: home.concepts.nl/~bvandam/

O manual do SPIRIT.OCX fornecido pela própria LEGO está neste endereço:
www.legomindstorms.com/sdk/


(Nota atual: estes links parecem que atualmente estão inoperacionais contudo deixo aqui um link válido para o download do mindstorms SDK 2.5)


Hardware

CyberMaster is based on the Hitachi H8 / 3294 processor and has 1.5K of RAM. It uses a radio transmitter / receiver tower connected to a serial port to communicate with the computer, and its range is approximately 15 meters.
CyberMaster comes equipped with 3 input and 1 output ports. The exit door is for general use and is compatible with LEGO® devices and has the ability to select an output voltage with 7 levels, in both directions, thus allowing to change the direction and speed of an engine. The input ports are equipped with a 10-bit analog / digital converter and are for general use, but are not prepared to supply energy to active sensors, unlike the RCX.
The 3 pressure sensors that CyberMaster comes equipped with come with different resistances, so CyberMaster can distinguish between different sensors. CyberMaster also has the ability to certify the quality of communications with the tower and to check the power consumption of the external motor when in operation.
The two internal engines of the CyberMaster are high-torque, although they have different characteristics from the external. They have integrated high-precision tachometers that allow you to attest the number of revolutions with a resolution of 1/50 revolution, in addition to indicating the instantaneous speed at which the engines are running.
The set 8482 LEGO TECHNIC CyberMaster, in addition to having hundreds of LEGO TECHNIC parts, wheels, tracks, sprockets, transmissions, etc., also comes equipped with 3 pressure sensors and a high torque and high efficiency motor, in addition to 6 cables of various dimensions for connection to motors / sensors.
CyberMaster is not compatible with the Macintosh because it requires 2 lines of hand-shake on the serial port when the Macintosh only supports one.

Software

CyberMaster has 2 different ways of functioning: autonomous and direct. The autonomous mode of operation consists of a program that is loaded into the unit and that remains in memory running at any time without using the computer. In direct mode, the computer gives explicit instructions to the unit that are executed at the moment, very similar to a remote controlled car. Interestingly, these two processes can be conducted simultaneously.
CyberMaster makes use of an instruction interpreter that deals directly with the hardware, called firmware, and that unlike the RCX does not reside in RAM.
The programs are designed giving instructions to this interpreter, who in turn is in charge of performing the tasks.
CyberMaster comes equipped with 1.5K of RAM, but it only has approximately 400 bytes of space available for a single program. Apparently it may not seem like much, but let us not forget that we only limit ourselves to giving orders to the interpreter to perform tasks, spending between 1 to 5 bytes for each instruction, instructions that are as complex as starting the 3 engines simultaneously with speeds and also different directions.
The only program that CyberMaster supports can contain up to 4 tasks, a maximum of 4 subroutines and up to 32 16-bit variables.

The CyberMaster software is not very useful for those who want to enter the world of robotics, being more apt to play or play than to program, although it is very well designed and allows to teach the main tricks and potential of the product in addition to teaching how to build models very well accomplished.

Advanced Programming

MindStorms (RCX) and CyberMaster are internally identical products, even sharing the same processor. The differences stand out only with regard to the available memory, limit on the number of programs, tasks and subroutines and some routines that are absent in either one or the other.
Development software advised by the author of this page:
Programming in Autonomous Mode
The NQCC or Not Quite C Compiler is being developed by Dave Baum in order to expand the programming flexibility of LEGO®  programmable bricks. It is the implementation of a variation of the C language (hence the name) and is nothing more than a compiler of instructions for the RCX / CyberMaster interpreter. This shareware compiler was developed without any support from LEGO®  and through a lot of reverse engineer work from RCX and CyberMaster.
I had the opportunity to work over the past month with Dave Baum, the author of the NQCC, to improve support for CyberMaster.

The new changes have been incorporated into NQCC 1.0 Beta 4 which can be found at this address:
www.enteract.com/~dbaum/lego/nqc/
(Current note: this link appears to be currently inoperative, however you can find it here)

Live mode programming

Distributed on both the MindStorms CD and the CyberMaster there is a software component with the name of SPIRIT.OCX and that is used by the RCX / CyberMaster software itself (Spirit was the code name for CyberMaster development).
This component gives access to all CyberMaster functions and allows you to control it in autonomous or direct mode, in addition to many other features such as allowing you to see the current status of CyberMaster variables / sensors, which is great if you want to create a program complex that does not adapt to CyberMaster's processing capabilities.

For Windows 95/98 / NT programming experts, I suppose that nothing else will need to be added to this description, for the rest, follow these links for examples of using SPIRIT.OCX, or the links that I provide on my links page.

Microsoft Visual C++:
www.geocities.com/SiliconValley/Hills/8306/Lego/mindprog.html

Microsoft Visual Basic: home.concepts.nl/~bvandam/


The SPIRIT.OCX manual provided by LEGO itself is at this address:


www.legomindstorms.com/sdk/

(Current note: these links seem to be currently inoperative however I leave here a valid link to download do mindstorms SDK 2.5)

Sem comentários:

Enviar um comentário