Packageorg.MARS.robot.control
Classpublic class BrainTwo
InheritanceBrainTwo Inheritance BrainOne Inheritance AbstractElectronicDevice
ImplementsIController

The Brain Two is a basic analogue controller device. It has an electrical circuit which reverses the directions of the both connected motors for a small period of time, whenever any connected sensors is triggered.

IO Port configuration:
0 and 1 - inputs from sensors (0 - left, 1 - right)
2 through 5 - outputs (must be connected directly to the locomotion)

See also

IOPort
Robot
ILocomotion
BarinOne


Public Properties
 PropertyDefined by
 InheritednumberOfPorts : Number
Get the number of IO ports in the device.
AbstractElectronicDevice
Protected Properties
 PropertyDefined by
 InheritedleftDelay : Number
BrainOne
 InheritedleftPort : IOPort
BrainOne
 InheritedleftTimer : Number = 0
BrainOne
 Inherited_ports : Array
AbstractElectronicDevice
 InheritedrightDelay : Number
BrainOne
 InheritedrightPort : IOPort
BrainOne
 InheritedrightTimer : Number = 0
BrainOne
Public Methods
 MethodDefined by
  
BrainTwo(ld:Number, rd:Number)
Creates a Brain Two with the timers connected to the left and right motors set to the number of seconds provided.
BrainTwo
 Inherited
getPort(portNumber:Number):IOPort
Get a certain IO port by its number
AbstractElectronicDevice
 Inherited
setTimers(ld:Number, rd:Number):void
Set the values of the Brain's timers to the provided ones
BrainOne
  
step():void
A function that is called on every step of the physics engine.
BrainTwo
Protected Methods
 MethodDefined by
 Inherited
BrainOne
 Inherited
BrainOne
 Inherited
BrainOne
 Inherited
BrainOne
Public Constants
 ConstantDefined by
 InheritedLEFT_SENSOR_PORT : Number = 0
[static]
BrainOne
 InheritedRIGHT_SENSOR_PORT : Number = 1
[static]
BrainOne
Constructor detail
BrainTwo()constructor
public function BrainTwo(ld:Number, rd:Number)

Creates a Brain Two with the timers connected to the left and right motors set to the number of seconds provided.

NOTE: using timers of slightly different values will help the robot to avoid getting stuck in on place whenever it's movement is perpendicular to the edge of the surface.

Parameters
ld:Number — - left timer (in seconds)
 
rd:Number — - right timer (in seconds)
Method detail
step()method
public override function step():void

A function that is called on every step of the physics engine. It advances the timers and reverses the motors whenever needed.