jarol
Class JarolCore

java.lang.Object
  extended by jarol.JarolCore
All Implemented Interfaces:
JarolCoreInterface
Direct Known Subclasses:
JarolCoreWithLink

public abstract class JarolCore
extends java.lang.Object
implements JarolCoreInterface

Abstract class for controlling a vehicle that is connected to a vehicle and a control terminal (terminal unit + navigation unit). It provides three synchronization points in form of signals. One to activate the controller, when the sensor has finished its execution. One to activate the terminal interface, when the controller has finished passing the display data to the terminal. The last one to activate the actuator interface, when the controller has finished computing the actuation data forwarded it to the actuator interface.
It should be noted that the controller doesn't wait for navigation data from the terminal. An additional Signal is needed for this kind of behavior, whereas the method awaitNavigation() is provided in the interface and called in the controlLoop(). Hence an additional Signal and the implementation of awaitNavigation() would make the controller wait for the navigation data.

Version:
0.1
Author:
Bernhard Kast

Field Summary
protected  boolean condition
          The condition that indicates if the controlLoop() should be looping.
protected  Port portControllerActuator
          The port is used to transfer the sensor data from the controller interface (Jarol Core) to the acutator interface.
protected  Port portControllerTerminal
          The port is used to transfer the sensor data from the controller interface (Jarol Core) to the terminal interface.
protected  Port portNavigatorController
          The port is used to transfer the navigation data from the navigation interface to the controller interface (Jarol Core).
protected  Port portSensorController
          The port is used to transfer the sensor data from the sensor interface to the controller interface (Jarol Core).
protected  Signal signalControllerActuator
          The signal that signals the actuator interface.
protected  Signal signalControllerTerminal
          The signal that signals the terminal interface.
protected  Signal signalSensorController
          The signal that awaits on the sensor interface.
 
Constructor Summary
JarolCore()
           
 
Method Summary
abstract  void awaitNavigation()
          Waits for a signal from the navigation interface that indicates that the control flow can continue.
 void awaitSensor()
          Awaits a signal on the signalSensorController to continue in the controlLoop().
abstract  MessageInterface[] computeActuationData(MessageInterface[] sensorData, MessageInterface[] navigationData)
          Calculates the information (e.g., motor signals, thruster, fin positions, ...) and returns an array of messages containing this information.
 void controlLoop()
          Loops while the condition is true and calls all methods needed for the control in a appropriate order.
abstract  void forwardToActuator(MessageInterface[] actuatorData)
          Fordwards the actuation data to the actuator interface.
abstract  void forwardToNavigation(MessageInterface[] sensorData)
          Forwards sensorData to the navigation interface.
abstract  void forwardToTerminal(MessageInterface[] dataBundle)
          Forwarding a dataBundle to the terminal, e.g.
abstract  MessageInterface[] readFromNavigation()
          Reads navigation data from the navigation interface.
abstract  MessageInterface[] readFromSensor()
          Reads data from the sensor interface.
 void signalActuator()
          Sends a signal to the signalControllerActuator to initiate the continuation of the actuator interface.
abstract  void signalNavigation()
          Signals the navigation interface.
 void signalTerminal()
          Sends a signal to the signalControllerTerminal to initiate the continuation of the terminal interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

signalSensorController

protected Signal signalSensorController
The signal that awaits on the sensor interface.


signalControllerActuator

protected Signal signalControllerActuator
The signal that signals the actuator interface.


signalControllerTerminal

protected Signal signalControllerTerminal
The signal that signals the terminal interface.


portSensorController

protected Port portSensorController
The port is used to transfer the sensor data from the sensor interface to the controller interface (Jarol Core).


portControllerTerminal

protected Port portControllerTerminal
The port is used to transfer the sensor data from the controller interface (Jarol Core) to the terminal interface.


portNavigatorController

protected Port portNavigatorController
The port is used to transfer the navigation data from the navigation interface to the controller interface (Jarol Core).


portControllerActuator

protected Port portControllerActuator
The port is used to transfer the sensor data from the controller interface (Jarol Core) to the acutator interface.


condition

protected boolean condition
The condition that indicates if the controlLoop() should be looping.

Constructor Detail

JarolCore

public JarolCore()
Method Detail

controlLoop

public void controlLoop()
Loops while the condition is true and calls all methods needed for the control in a appropriate order.

Specified by:
controlLoop in interface JarolCoreInterface

awaitNavigation

public abstract void awaitNavigation()
Description copied from interface: JarolCoreInterface
Waits for a signal from the navigation interface that indicates that the control flow can continue.

Specified by:
awaitNavigation in interface JarolCoreInterface

computeActuationData

public abstract MessageInterface[] computeActuationData(MessageInterface[] sensorData,
                                                        MessageInterface[] navigationData)
Description copied from interface: JarolCoreInterface
Calculates the information (e.g., motor signals, thruster, fin positions, ...) and returns an array of messages containing this information.

Specified by:
computeActuationData in interface JarolCoreInterface
Parameters:
sensorData - data provided by the sensor interface
navigationData - data provided by the navigation interface
Returns:
computed actuation data - acutationData

forwardToActuator

public abstract void forwardToActuator(MessageInterface[] actuatorData)
Description copied from interface: JarolCoreInterface
Fordwards the actuation data to the actuator interface.

Specified by:
forwardToActuator in interface JarolCoreInterface
Parameters:
actuatorData - actuation data

forwardToNavigation

public abstract void forwardToNavigation(MessageInterface[] sensorData)
Description copied from interface: JarolCoreInterface
Forwards sensorData to the navigation interface. NOTE: The sensorData may be null if the navigation unit is non-autonomous, e.g., steering with a joystick.

Specified by:
forwardToNavigation in interface JarolCoreInterface

forwardToTerminal

public abstract void forwardToTerminal(MessageInterface[] dataBundle)
Description copied from interface: JarolCoreInterface
Forwarding a dataBundle to the terminal, e.g. sensorData, actuatorData, etc. depending on the architecture and the information that should be displayed/used at the terminal.

Specified by:
forwardToTerminal in interface JarolCoreInterface

readFromNavigation

public abstract MessageInterface[] readFromNavigation()
Description copied from interface: JarolCoreInterface
Reads navigation data from the navigation interface.

Specified by:
readFromNavigation in interface JarolCoreInterface
Returns:
navigationData

readFromSensor

public abstract MessageInterface[] readFromSensor()
Description copied from interface: JarolCoreInterface
Reads data from the sensor interface.

Specified by:
readFromSensor in interface JarolCoreInterface
Returns:
sensor data

signalNavigation

public abstract void signalNavigation()
Description copied from interface: JarolCoreInterface
Signals the navigation interface.

Specified by:
signalNavigation in interface JarolCoreInterface

awaitSensor

public void awaitSensor()
Awaits a signal on the signalSensorController to continue in the controlLoop().

Specified by:
awaitSensor in interface JarolCoreInterface

signalActuator

public void signalActuator()
Sends a signal to the signalControllerActuator to initiate the continuation of the actuator interface.

Specified by:
signalActuator in interface JarolCoreInterface

signalTerminal

public void signalTerminal()
Sends a signal to the signalControllerTerminal to initiate the continuation of the terminal interface.

Specified by:
signalTerminal in interface JarolCoreInterface