public abstract class AbstractMotorModule extends AbstractPerceptualModule implements IMotorModule
MotorManager
(which handles all the logic
of communicating with common reality, as well as the movement lifecylce), the
DefaultCommandTranslator
to route ChunkPattern
movement
requests to specific ICommandTranslatorDelegate
s, and uses
IMotorTimeEquation
to determine how long preparation and processing
phases last. ICommandTranslatorDelegate
s map ChunkPattern
s and Strings
to specific muscles, as defined by IEfferentObject
s, as well as
translating the ChunkPattern
s into precise IEfferentCommand
s
which will be passed to common reality by the MotorManager
. There
should be a unique ICommandTranslatorDelegate
for each and every
movement chunktype defined. ICommandTranslatorDelegate
set the
MovementCommand.MOVEMENT_RATE
property of the
IEfferentCommand
. Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COMPOUND_MOTOR_COMMAND_CHUNK_TYPE |
static java.lang.String |
ENABLE_PARALLEL_MUSCLES_PARAM |
protected static org.apache.commons.logging.Log |
LOGGER
Logger definition
|
ABORT_CHUNK_TYPE, ABORTING_CHUNK, MOVEMENT_CHUNK_TYPE, MUSCLE_SLOT
GREATER_THAN_CURRENT_CHUNK, HIGHEST_CHUNK, LESS_THAN_CURRENT_CHUNK, LOWEST_CHUNK
STRICT_SYNCHRONIZATION_PARAM
Constructor and Description |
---|
AbstractMotorModule(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.Future<IMovement> |
abort(IMovement movement,
double requestTime) |
void |
addListener(IMotorModuleListener listener,
java.util.concurrent.Executor executor) |
java.util.concurrent.Future<IMovement> |
adjust(IMovement movement,
ChunkTypeRequest request,
double requestTime) |
boolean |
canAbort(ChunkTypeRequest request) |
boolean |
canAbort(IMovement movement) |
boolean |
canAdjust(ChunkTypeRequest request) |
boolean |
canAdjust(IMovement movement) |
boolean |
canExecute(ChunkTypeRequest request) |
boolean |
canPrepare(ChunkTypeRequest request)
return true if we could prepare this motor command
|
protected void |
connectToCommonReality()
called immediately after common reality connection has been established.
|
protected void |
disconnectFromCommonReality()
called on model termination to give modules a chance to remove their
listeners
|
void |
dispatch(MotorModuleEvent event) |
java.util.concurrent.Future<IMovement> |
execute(IMovement movement,
double requestTime)
execute a motor movement.
|
IChunkType |
getAbortChunkType() |
IChunk |
getAbortingChunk() |
MotorCommandManager |
getCommandManager() |
ICommandTranslator |
getCommandTranslator()
responsible code snippet that translates
ChunkPattern s into
IEfferentCommand s |
IChunkType |
getCompoundCommandChunkType() |
IMovement |
getLastMovement(IIdentifier muscle)
returns the most recently prepared movement for the given muscle
|
IChunkType |
getMovementChunkType()
the root movement type chunk
|
MuscleStateManager |
getMuscleManager()
tracker and manager of muscle info
|
java.lang.String |
getParameter(java.lang.String key)
return parameter value - null if not defined.
|
IMotorTimeEquation |
getPreparationTimeEquation()
the
IMotorTimeEquation that determines how long the preparation
of a motor movement lasts |
IMotorTimeEquation |
getProcessingTimeEquation()
the
IMotorTimeEquation that determines how much time is spent
processing the movement. |
java.util.Collection<java.lang.String> |
getSetableParameters()
Return list of all parameters that can be set.
|
boolean |
hasListeners() |
void |
initialize()
this will be called after all the modules have been installed permitting
the module to attach listeners to other modules.
|
protected boolean |
isClassName(java.lang.String key) |
boolean |
isMuscleParallelismEnabled() |
java.util.concurrent.Future<IMovement> |
prepare(ChunkTypeRequest pattern,
double requestTime,
boolean prepareOnly)
prepare a motor movement.
|
void |
removeListener(IMotorModuleListener listener) |
void |
reset()
reset the motor system.
|
void |
reset(boolean stopActiveMovements)
reset all the muscles that are in error and optionally stop all active
movements too.
|
void |
reset(java.lang.String muscleName)
reset the state of a single muscle
|
void |
setCommandTranslator(ICommandTranslator translator) |
void |
setMuscleParallelismEnabled(boolean enable) |
void |
setParameter(java.lang.String key,
java.lang.String value)
Set the named parameter
|
void |
setPreparationTimeEquation(IMotorTimeEquation equation) |
void |
setProcessingTimeEquation(IMotorTimeEquation equation) |
dispose, getBusyChunk, getCommonRealityExecutor, getErrorChunk, getExecutor, getFreeChunk, getNamedChunk, getNamedChunkType, getRequestedChunk, getSymbolGrounder, getUnrequestedChunk, setSymbolGrounder
getPossibleParameters, isStrictSynchronizationEnabled, setStrictSynchronizationEnabled, synchronizedTimedEvent
createBuffers, delayedFuture, delayedFuture, getModel, getName, getSafeName, immediateFuture, immediateReturn, install, setExecutor, uninstall
addAdapterFactory, getAdapter, removeAdapterFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBuffer
getCommonRealityExecutor, getSymbolGrounder, setSymbolGrounder
getExecutor, isStrictSynchronizationEnabled, setStrictSynchronizationEnabled, synchronizedTimedEvent
uninstall
getAdapter
getPossibleParameters
protected static final transient org.apache.commons.logging.Log LOGGER
public static final java.lang.String ENABLE_PARALLEL_MUSCLES_PARAM
public static final java.lang.String COMPOUND_MOTOR_COMMAND_CHUNK_TYPE
public void setCommandTranslator(ICommandTranslator translator)
public ICommandTranslator getCommandTranslator()
IMotorModule
ChunkPattern
s into
IEfferentCommand
sgetCommandTranslator
in interface IMotorModule
public void setProcessingTimeEquation(IMotorTimeEquation equation)
public IMotorTimeEquation getProcessingTimeEquation()
IMotorModule
IMotorTimeEquation
that determines how much time is spent
processing the movement. Actual equation times are determined by
individual IEfferentCommandTranslator
s.getProcessingTimeEquation
in interface IMotorModule
public void setPreparationTimeEquation(IMotorTimeEquation equation)
public IMotorTimeEquation getPreparationTimeEquation()
IMotorModule
IMotorTimeEquation
that determines how long the preparation
of a motor movement lastsgetPreparationTimeEquation
in interface IMotorModule
public IChunkType getMovementChunkType()
IMotorModule
getMovementChunkType
in interface IMotorModule
public IChunkType getAbortChunkType()
getAbortChunkType
in interface IMotorModule
public IChunk getAbortingChunk()
public IChunkType getCompoundCommandChunkType()
public void initialize()
IModule
initialize
in interface IModule
initialize
in interface IInitializable
initialize
in class AbstractPerceptualModule
public boolean isMuscleParallelismEnabled()
public void setMuscleParallelismEnabled(boolean enable)
protected void connectToCommonReality()
AbstractPerceptualModule
IAgent
so that the
model can be aware of different IAfferentObject
and
IEfferentObject
sconnectToCommonReality
in class AbstractPerceptualModule
protected void disconnectFromCommonReality()
AbstractPerceptualModule
disconnectFromCommonReality
in class AbstractPerceptualModule
public boolean canPrepare(ChunkTypeRequest request)
IMotorModule
canPrepare
in interface IMotorModule
public java.util.concurrent.Future<IMovement> prepare(ChunkTypeRequest pattern, double requestTime, boolean prepareOnly)
IMotorModule
IEfferentCommand
with common realityprepare
in interface IMotorModule
public boolean canExecute(ChunkTypeRequest request)
canExecute
in interface IMotorModule
public java.util.concurrent.Future<IMovement> execute(IMovement movement, double requestTime)
IMotorModule
execute
in interface IMotorModule
public boolean canAdjust(ChunkTypeRequest request)
canAdjust
in interface IMotorModule
public boolean canAdjust(IMovement movement)
canAdjust
in interface IMotorModule
public java.util.concurrent.Future<IMovement> adjust(IMovement movement, ChunkTypeRequest request, double requestTime)
adjust
in interface IMotorModule
public boolean canAbort(ChunkTypeRequest request)
canAbort
in interface IMotorModule
public boolean canAbort(IMovement movement)
canAbort
in interface IMotorModule
public java.util.concurrent.Future<IMovement> abort(IMovement movement, double requestTime)
abort
in interface IMotorModule
public void reset()
IMotorModule
reset
in interface IModule
reset
in interface IMotorModule
public void reset(boolean stopActiveMovements)
IMotorModule
reset
in interface IMotorModule
public void reset(java.lang.String muscleName)
IMotorModule
reset
in interface IMotorModule
public IMovement getLastMovement(IIdentifier muscle)
IMotorModule
getLastMovement
in interface IMotorModule
muscle
- if null, return the last movement regardless of the musclepublic MotorCommandManager getCommandManager()
getCommandManager
in interface IMotorModule
public MuscleStateManager getMuscleManager()
IMotorModule
getMuscleManager
in interface IMotorModule
public java.util.Collection<java.lang.String> getSetableParameters()
IParameterized
getSetableParameters
in interface IParameterized
getSetableParameters
in class AbstractAsynchronousModule
public void setParameter(java.lang.String key, java.lang.String value)
IParameterized
setParameter
in interface IParameterized
setParameter
in class AbstractAsynchronousModule
public java.lang.String getParameter(java.lang.String key)
IParameterized
getParameter
in interface IParameterized
getParameter
in class AbstractAsynchronousModule
key
- Description of the Parameterprotected boolean isClassName(java.lang.String key)
public void addListener(IMotorModuleListener listener, java.util.concurrent.Executor executor)
addListener
in interface IMotorModule
public boolean hasListeners()
hasListeners
in interface IMotorModule
public void removeListener(IMotorModuleListener listener)
removeListener
in interface IMotorModule
public void dispatch(MotorModuleEvent event)
dispatch
in interface IMotorModule