mns
Class MNS

java.lang.Object
  extended by java.lang.Thread
      extended by biocell.BioThread
          extended by mns.MNS
All Implemented Interfaces:
BioDeviceListener, ParserListener, java.lang.Runnable, BioSensorListener

public class MNS
extends BioThread
implements ParserListener, BioSensorListener

This part of the code is the master controller of actions and of their execution in time and in the problem space it self. It is the unique point o access to most motoric functions similalrly to th cerebelum but in this case this processes all possible commands from any other robotic or mental module

Author:
martin lukac

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
MNS()
          Default Constructor this assusres now a order of different devices.
MNS(MNScommandQueue cQueue)
          Default Constructor this assusres now a order of different devices.
 
Method Summary
 void addbioCommand(java.lang.String robotpart, java.lang.String biocommand)
          adds a single command to a bioPart according to Class command specifications
 void addbioDevice(java.lang.String robotpart, int[] indexs)
           
 void addbioDevice(java.lang.String robotpart, java.lang.String indexs)
           
 void addbioPart(java.lang.String name)
          Constructors of the robot from file not constructors in the proper term - just create the robot from a descriptor file THESE ARE NOT THREAD PROOF AND ARE USED ONLY DURRING THE ROBOT NON ACTIVITY add a object to the robot: this can be anything but if your goal is to make it work add only parts such as Servos, BioDevice or other related shit
 void addCNSListener(MNSListener listener)
           
 void addMonitor(MNSRobotPanel monitor)
           
 void bioEvent(BioDeviceEvent bdE)
           
 java.util.Vector getCnsRobotParts()
           
 java.util.Vector getComData()
           
 int[] getComState()
           
 java.util.Vector getDevices()
           
 int[] getMotState()
           
 MNSRobotPart getRobotPart(java.lang.String name)
           
 boolean isExecSignal()
           
 void load(ParserEvent pE)
           
 void run()
           
 void sensorCRLPercieved(BioSensorEvent event)
           
 void sensorPercieved(BioSensorEvent event)
           
 void setExecSignal(boolean execSignal)
           
 void setiD(java.lang.String iD)
           
 void setMotState(int[] indexes)
           
 void setPartMax(java.lang.String part, java.lang.String max)
           
 void setPartMin(java.lang.String part, java.lang.String min)
           
 void setPartParam(java.lang.String part, java.lang.String param, java.lang.String data)
           
 
Methods inherited from class biocell.BioThread
getCurrentmood, getMoodParam, getstate, setMood, stepEnergy
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MNS

public MNS()
Default Constructor this assusres now a order of different devices. This has to be imporved in order to allow a bigger freedom of commands


MNS

public MNS(MNScommandQueue cQueue)
Default Constructor this assusres now a order of different devices. This has to be imporved in order to allow a bigger freedom of commands

Method Detail

bioEvent

public void bioEvent(BioDeviceEvent bdE)
Specified by:
bioEvent in interface BioDeviceListener

sensorCRLPercieved

public void sensorCRLPercieved(BioSensorEvent event)
Specified by:
sensorCRLPercieved in interface BioSensorListener
Parameters:
event - - must be overriden to allow CRL parsed commands

sensorPercieved

public void sensorPercieved(BioSensorEvent event)
Specified by:
sensorPercieved in interface BioSensorListener
Parameters:
event - - must be overriden to provide command access

isExecSignal

public boolean isExecSignal()
Returns:
Returns the execSignal. This signal is used for the network communication

setExecSignal

public void setExecSignal(boolean execSignal)
Parameters:
execSignal - The execSignal to set.

addbioPart

public void addbioPart(java.lang.String name)
Constructors of the robot from file not constructors in the proper term - just create the robot from a descriptor file THESE ARE NOT THREAD PROOF AND ARE USED ONLY DURRING THE ROBOT NON ACTIVITY add a object to the robot: this can be anything but if your goal is to make it work add only parts such as Servos, BioDevice or other related shit

Parameters:
name - - name of the CNSRobotPart to be added

addbioDevice

public void addbioDevice(java.lang.String robotpart,
                         int[] indexs)
Parameters:
robotpart -
indexs -

addbioDevice

public void addbioDevice(java.lang.String robotpart,
                         java.lang.String indexs)
Parameters:
robotpart -
indexs -

addbioCommand

public void addbioCommand(java.lang.String robotpart,
                          java.lang.String biocommand)
adds a single command to a bioPart according to Class command specifications

Parameters:
robotpart - - the destination
biocommand - - the command to be created Very unhandy but works perfectly

setPartParam

public void setPartParam(java.lang.String part,
                         java.lang.String param,
                         java.lang.String data)
Parameters:
part -
max -

setPartMax

public void setPartMax(java.lang.String part,
                       java.lang.String max)
Parameters:
part -
max -

setPartMin

public void setPartMin(java.lang.String part,
                       java.lang.String min)
Parameters:
part -
min -

load

public void load(ParserEvent pE)
Specified by:
load in interface ParserListener
Parameters:
pE - - the caught parser event process the give parserEvent The CNS process either only XML dfiles either command strings. This method is used by any type of command system able to generate parser event in the MNS format of command - Mainly used by the NNS control and reflex system

getComData

public java.util.Vector getComData()
Returns:
- the complete array of commands following one after another as loaded in the MNSRobotPart

setMotState

public void setMotState(int[] indexes)
Parameters:
indexes - - sets a commands for the whole robot in a single step as a set of reflexes -- overrides the whole command queue

getMotState

public int[] getMotState()
Returns:
- the complete vector of the body positions represented in an array of integer positions of every servo motor

getComState

public int[] getComState()
Returns:
- the complete vector (including the jaw) of the body positions represented in an array of integer positions of every servo motor

addMonitor

public void addMonitor(MNSRobotPanel monitor)
Parameters:
monitor - - add the monitoring device to this part

addCNSListener

public void addCNSListener(MNSListener listener)
Parameters:
listener - - add a CNSListener

getRobotPart

public MNSRobotPart getRobotPart(java.lang.String name)
Parameters:
name - - name of the device to look for
Returns:
- null or BioDevice

getDevices

public java.util.Vector getDevices()
Returns:
Returns the devices

getCnsRobotParts

public java.util.Vector getCnsRobotParts()
Returns:
Returns the cnsRobotParts.

setiD

public void setiD(java.lang.String iD)
Parameters:
iD -

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread