Class GBNN2
java.lang.Object
|
+--java.lang.Thread
|
+--interfaces.Controller
|
+--GBNN2
- All Implemented Interfaces:
- java.lang.Runnable
- public class GBNN2
- extends Controller
this class implements a neural net with a 3-1 topology plus bias.
the three inputs are light sensors 0->2.
output of <0.4 corresponds to turn left, 0.40.6 turn right.
This was the first neural net that was written, and it was generated using real world
values (similar to GBN2b). The training regime was a bit lax though - the threshhold was set to 0.1,
so it would not be surprising if this net performs a little unexpectedly in some conditions.
- Author:
- Graeme Bell
- See Also:
GBN2b
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary |
GBNN2()
|
Method Summary |
AbstractRobot |
getRobot()
Returns the AbstractRobot associated with this controller |
int[] |
getSensors()
Returns an array of the sensors used by this controller, and the type
of sensor required. |
void |
halt()
Stops this controller's thread running, i.e. |
void |
initController(AbstractRobot r)
Initialises controller. |
void |
pause()
|
void |
run()
Starts this controller's thread running. |
void |
unpause()
|
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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 |
GBNN2
public GBNN2()
run
public void run()
- Description copied from class:
Controller
- Starts this controller's thread running. The 'real' controller
functionality should be started from here.
- Overrides:
run
in class Controller
initController
public void initController(AbstractRobot r)
- Description copied from class:
Controller
- Initialises controller. It should be noted that this method will only
ever be called once, whereas run() can be called many times, so any
variables or data structures etc. that are meant to persist in between
stops and starts of the controller's thread, or that should only be
initialised once should be set up from within this method, not in run().
- Overrides:
initController
in class Controller
- Following copied from class:
interfaces.Controller
- Parameters:
r
- the AbstractRobot associated with this controller
getSensors
public int[] getSensors()
- Description copied from class:
Controller
- Returns an array of the sensors used by this controller, and the type
of sensor required. This type must be one of the sensor type constants
declared above. The index of the array is used to establish which sensor
is being defined. e.g. if array[0] is SENSOR_TYPE_TOUCH then sensor 1
will be set to a touch sensor. The sensors array *must* be initialised
with the correct values from the outset, and must not be set in
initController(), or any other method. (see example Controllers for
working examples)
- Overrides:
getSensors
in class Controller
- Following copied from class:
interfaces.Controller
- Returns:
- the sensor array
halt
public void halt()
- Description copied from class:
Controller
- Stops this controller's thread running, i.e. must allow run() to return
as quickly as possible. However it is acceptable for this method to do
some housekeeping before stopping the controller, e.g. save some internal
data strcuture to a file.
- Overrides:
halt
in class Controller
getRobot
public AbstractRobot getRobot()
- Description copied from class:
Controller
- Returns the AbstractRobot associated with this controller
- Overrides:
getRobot
in class Controller
- Following copied from class:
interfaces.Controller
- Returns:
- the AbstractRobot
pause
public void pause()
- Overrides:
pause
in class Controller
unpause
public void unpause()
- Overrides:
unpause
in class Controller