|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkaos.core.util.MethodCallRequestHandler
kaos.robots.core.KAoSRobot
public abstract class KAoSRobot
Nested Class Summary | |
---|---|
class |
KAoSRobot.RequestHandlerThread
|
Field Summary | |
---|---|
protected java.lang.String |
_actorID
|
protected javax.swing.JTextField |
_address
|
protected KAoSAgentDescription |
_agentDescription
|
protected java.util.Vector |
_classificationListeners
|
protected javax.swing.JButton |
_connectBtn
|
protected boolean |
_connected
|
javax.swing.JComboBox |
_connectToCmb
|
java.util.Vector |
_currentActions
|
protected java.util.HashMap |
_enablingClasses
|
protected RobotEnforcer |
_enforcer
|
boolean |
_gpsIsAvailable
|
GPSPosition |
_gpsOrigin
|
protected java.util.HashMap |
_learnedTasks
|
protected java.util.HashMap |
_learnedTaskVariables
|
protected boolean |
_learning
|
protected java.util.HashMap |
_listeners
|
protected Logger |
_logger
|
protected MessageReceiver |
_messageReceiver
|
protected Locator |
_myLocator
|
protected java.lang.String |
_nickName
|
protected PolicyChecking |
_policyService
|
protected javax.swing.JTextField |
_port
|
protected boolean |
_registeredWithKAoS
|
protected Registration |
_registration
|
ActionStatusCallback |
_reniaCallback
|
protected MessageSender |
_sender
|
protected java.util.Vector |
_subtasks
|
protected java.lang.String |
_taskName
|
protected java.lang.String |
_transportName
|
Fields inherited from class kaos.core.util.MethodCallRequestHandler |
---|
_helper, _mts, DEFAULT_NICKNAME, myLocator, myMessageReceiver, myMessageSender |
Constructor Summary | |
---|---|
KAoSRobot()
|
Method Summary | |
---|---|
void |
assertNotLocatable(boolean exp,
java.lang.String msg)
|
ActionInstanceDescription |
buildAID(java.lang.String action,
java.util.HashMap properties)
buildAID Utility for turning string-hashmaps into ActionInstanceDeescriptions |
javax.swing.JPanel |
buildConnectPanel()
|
void |
checkObligations(ActionInstanceDescription aid)
|
protected void |
checkPermissionForAction(ActionInstanceDescription aid)
|
abstract boolean |
connect()
This function is used to connect to robot |
void |
deregisterObserver(KAoSObserver observer,
java.lang.String updateType,
java.io.Serializable updateCondition,
KAoSEntityDescription observableDesc)
Deregister the given KAoSObserver from the registry of observers asoociated with the KAoSObservable, whose KAoSEntityDescription is given. |
void |
deregisterObserver(KAoSObserver observer,
java.lang.String updateType,
java.io.Serializable updateCondition,
java.lang.String observableGUID)
Deregister the given KAoSObserver from the registry of observers associated with the KAoSObservable, whose GUID is given. |
void |
deregisterObserver(java.lang.String updateType,
java.lang.Object updateCondition,
KAoSObserver observer)
Deregister the given KAoSObserver for the given update type from the registry of observers associated with this KAoSObservable. |
abstract void |
disconnect()
This function is used to disconnect from robot |
java.lang.Object |
executeLearnedAction(ActionInstanceDescription aid)
|
void |
ExtendTimeout(java.util.HashMap properties)
|
protected java.util.Vector |
getActions()
getActions retrieves all implemented interfaces. |
java.lang.String |
getActorID()
|
KAoSAgentDescription |
getAgentDescription()
Creates a new AgentDescription for this KAoSRobot. |
KAoSAgentDescription |
getAgentDescriptionFromName(java.lang.String name)
|
java.util.List |
getAllAgents()
Return all agent ids stored in the KAoS directory. |
java.util.Vector |
getCurrentActions()
|
DetectedObjectObservableImpl |
getDetectedObjectObservable()
|
int |
getGPSCommPort()
|
Locator |
getLocator()
|
MessageTransportService |
getMTS()
|
java.util.HashMap |
getPropertiesFromAID(ActionInstanceDescription aid)
|
int |
getTimeoutPeriod()
|
boolean |
gpsIsAvailable()
|
void |
init(java.lang.String[] args)
|
boolean |
isRegisteredWithKAoS()
|
java.lang.Object |
makeActionAllowable(ActionInstanceDescription aid)
|
void |
modifySpatialProperties(Location3D location,
Orientation3D orientation,
Block3D block)
|
void |
notify(java.lang.String updateType,
java.lang.Object updateCondition,
java.lang.Object update)
Notify observers interested in the given updateType wiht the given update object. |
void |
onAborted(java.util.Calendar time,
java.lang.Object reason,
java.lang.String actionID,
java.lang.String robotID)
This method is invoked when the requested action is aborted. |
void |
onAccepted(java.util.Calendar time,
java.lang.Object acceptInfo,
java.lang.String actionID,
java.lang.String robotID)
This method is invoked when the request is accepted by the robot. |
void |
onCompleted(java.util.Calendar time,
java.lang.Object result,
java.lang.String actionID,
java.lang.String robotID)
This method is invoked upon completion of the request byt the requested robot. |
void |
onRefused(java.util.Calendar time,
java.lang.Object reason,
java.lang.String actionID,
java.lang.String robotID)
This method is invoked when the request is refused by the robot. |
void |
onStarted(java.util.Calendar time,
java.lang.Object startedInfo,
java.lang.String actionID,
java.lang.String robotID)
This method is invoked when the robot starts the requested action. |
protected void |
printDebugString(java.lang.String msg,
int loggerDisplayLevel)
|
java.lang.Object |
processHashMapRequest(java.lang.String actionName)
This method accepts a request described by the given String containing action name. |
void |
processHashMapRequest(java.lang.String actionName,
ActionStatusCallback statusCallback)
This method accepts a request described by the given String containing the action name. |
java.lang.Object |
processHashMapRequest(java.lang.String actionName,
java.util.HashMap properties)
This method accepts a request described by the given String and HashMap of properties. |
void |
processHashMapRequest(java.lang.String actionName,
java.util.HashMap properties,
ActionStatusCallback statusCallback)
This method accepts a request described by the given String and HashMap of properties. |
void |
receiveKAoSStatus(java.lang.String statusMsg,
java.lang.String actionID,
java.lang.String robotID)
Receive a status message describing the execution of the requested action. |
void |
registerObserver(KAoSObserver observer,
java.lang.String updateType,
java.io.Serializable updateCondition,
KAoSEntityDescription observableDesc)
Register the given KAoSObserver with the KAoSObservable, whose KAoSEntityDescription is given, for updates described by the updateType and updateConstraints. |
void |
registerObserver(KAoSObserver observer,
java.lang.String updateType,
java.io.Serializable updateCondition,
java.lang.String observableGUID)
Register the given KAoSObserver with the KAoSObservable, whose GUID is given for updates described by the updateType and updateConditions. |
void |
registerObserver(KAoSObserver observer,
java.lang.String updateType,
java.io.Serializable updateCondition,
java.lang.String observableGUID,
java.lang.String brokerGUID)
Register the given KAoSObserver with the KAoSObservable, whose GUID is given for updates described by the updateType and updateConditions. |
void |
registerObserver(java.lang.String updateType,
java.lang.Object updateCondition,
KAoSObserver observer)
Register the given KAoSObserver with this KAoSObservable for updates described by the updateType and updateConstraints. |
void |
registerWithKAoS()
|
void |
registerWithSpatialProperties(Location3D location,
Orientation3D orientation,
Block3D block)
|
java.lang.String |
requestAction(java.lang.String action,
java.util.HashMap properties,
KAoSEntityDescription receiverDesc)
Request a given action/information with the described properties from a robot whose KAoS agent description is given. |
void |
sendMessage(java.lang.String GUID,
java.io.Serializable content)
|
void |
sendRequestToKaa(java.lang.String action,
java.util.HashMap properties)
|
protected void |
setRegisteredWithKAoS(boolean registered)
|
void |
startLearning(java.util.HashMap properties)
|
void |
stopLearning()
|
int |
updateTimeout()
|
Methods inherited from class kaos.core.util.MethodCallRequestHandler |
---|
bindToTransport, handleMsgContent, handleObjContent, initialize, receiveMessage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface kaos.core.csi.observe.ObserverManager |
---|
registerKAoSExtensionComponentObserver |
Field Detail |
---|
protected Logger _logger
protected java.lang.String _actorID
protected MessageReceiver _messageReceiver
protected MessageSender _sender
protected java.lang.String _nickName
protected Locator _myLocator
protected KAoSAgentDescription _agentDescription
protected java.util.Vector _classificationListeners
protected RobotEnforcer _enforcer
protected boolean _registeredWithKAoS
public javax.swing.JComboBox _connectToCmb
protected javax.swing.JTextField _address
protected javax.swing.JTextField _port
protected boolean _connected
protected javax.swing.JButton _connectBtn
protected java.util.HashMap _enablingClasses
public java.util.Vector _currentActions
protected java.util.HashMap _listeners
public ActionStatusCallback _reniaCallback
public GPSPosition _gpsOrigin
public boolean _gpsIsAvailable
protected java.lang.String _transportName
protected Registration _registration
protected boolean _learning
protected java.util.Vector _subtasks
protected java.lang.String _taskName
protected java.util.HashMap _learnedTasks
protected java.util.HashMap _learnedTaskVariables
protected PolicyChecking _policyService
Constructor Detail |
---|
public KAoSRobot()
Method Detail |
---|
public abstract boolean connect()
public abstract void disconnect()
public void init(java.lang.String[] args)
public java.util.Vector getCurrentActions()
public void processHashMapRequest(java.lang.String actionName, java.util.HashMap properties, ActionStatusCallback statusCallback) throws ActionFailureException
processHashMapRequest
in interface HashMapRequestReceiver
actionName
- is a String representing the name of the action as defined in
the associated ontology.properties
- is an HashMap of ontological Strings representing
the desired properties of the action and the
associated values.statusCallback
- ActionStatusCallback to be called to pass back to the
action requestor information about progression of the action execution
and the final result.
ActionFailureException
- containing the reason for failure.
See ontology to determine specific reasons available for
a given actionpublic void processHashMapRequest(java.lang.String actionName, ActionStatusCallback statusCallback) throws ActionFailureException
processHashMapRequest
in interface HashMapRequestReceiver
actionName
- is a String representing the name of the action as defined in
the associated ontology.statusCallback
- ActionStatusCallback to be called to pass back to the
action requestor information about progression of the action execution
and the final result.
ActionFailureException
- containing the reason for failure.
See ontology to determine specific reasons available for
a given actionpublic java.lang.Object processHashMapRequest(java.lang.String actionName, java.util.HashMap properties) throws ActionFailureException
processHashMapRequest
in interface HashMapRequestReceiver
actionName
- is a String representing the name of the action as defined in
the associated ontology.properties
- is an HashMap of ontological Strings representing
the desired properties of the action and the
associated values.
ActionFailureException
- containing the reason for failure.
See ontology to determine specific reasons available for
a given actionpublic java.lang.Object processHashMapRequest(java.lang.String actionName) throws ActionFailureException
processHashMapRequest
in interface HashMapRequestReceiver
actionName
- is a String representing the name of the action as defined in
the associated ontology.
ActionFailureException
- containing the reason for failure.
See ontology to determine specific reasons available for
a given actionpublic ActionInstanceDescription buildAID(java.lang.String action, java.util.HashMap properties)
public void startLearning(java.util.HashMap properties)
public void stopLearning()
public java.lang.Object makeActionAllowable(ActionInstanceDescription aid) throws java.lang.Exception
java.lang.Exception
public void checkObligations(ActionInstanceDescription aid) throws java.lang.Exception
java.lang.Exception
public KAoSAgentDescription getAgentDescription()
public boolean isRegisteredWithKAoS()
protected void setRegisteredWithKAoS(boolean registered)
public void registerWithKAoS()
protected java.util.Vector getActions()
public java.util.HashMap getPropertiesFromAID(ActionInstanceDescription aid)
public java.lang.Object executeLearnedAction(ActionInstanceDescription aid) throws java.lang.Exception
java.lang.Exception
public javax.swing.JPanel buildConnectPanel()
public MessageTransportService getMTS()
public Locator getLocator()
public java.lang.String getActorID()
public java.util.List getAllAgents() throws SearchException, DirectoryFailure
SearchException
- if an exception is thrown during the search.
DirectoryFailure
- if the directory cannot be found/is not available.public KAoSAgentDescription getAgentDescriptionFromName(java.lang.String name) throws SearchException, DirectoryFailure
SearchException
DirectoryFailure
public int getGPSCommPort()
public int getTimeoutPeriod()
public int updateTimeout()
public void ExtendTimeout(java.util.HashMap properties)
public boolean gpsIsAvailable()
public DetectedObjectObservableImpl getDetectedObjectObservable()
public void registerObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, java.lang.String observableGUID) throws NotLocatableException, TransportFailure
ObserverManager
registerObserver
in interface ObserverManager
observer
- KAoSObserver requesting registration for updates.updateType
- String indicating type of update the KAoSObserver is interested in.updateCondition
- Serializable describing the conditions under which to send the update.observableGUID
- String containing the GUID of the KAoSObservable to register with.
NotLocatableException
- when the KAoSObservable cannot be located.
TransportFailure
- when transport services fails.public void registerObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, KAoSEntityDescription observableDesc) throws NotLocatableException, TransportFailure
ObserverManager
registerObserver
in interface ObserverManager
observer
- KAoSObserver registering with for updates.updateType
- String indicating type of update the KAoSObserver is interested in.updateCondition
- Object describing the conditions under which to send the update.observableDesc
- KAoSEntityDescription describing the observable.
NotLocatableException
- when the KAoSObservable cannot be located.
TransportFailure
- when transport services fail.public void registerObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, java.lang.String observableGUID, java.lang.String brokerGUID) throws NotLocatableException, TransportFailure
ObserverManager
registerObserver
in interface ObserverManager
observer
- KAoSObserver requesting registration for updates.updateType
- String indicating type of update the KAoSObserver is interested in.updateCondition
- Serializable describing the conditions under which to send the update.observableGUID
- String containing the GUID of the KAoSObservable to register with.brokerGUID
- String containing the GUID of the broker, through which to reach the observable.
NotLocatableException
- when the KAoSObservable or broker cannot be located.
TransportFailure
- when transport services fail.
the rgistration will be processed.public void deregisterObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, java.lang.String observableGUID) throws NotLocatableException, TransportFailure
ObserverManager
deregisterObserver
in interface ObserverManager
observer
- KAoSObserver deregistering.updateType
- String indicating type of update the KAoSObserver is no longer interested in.updateCondition
- Serializable containing the condition the KAoSObserver is no longer interested in.observableGUID
- String specifying the GUID of the observable, from which to deregister
for the given update type.
NotLocatableException
- when the KAoSObservable cannot be located.
TransportFailure
- when transport services fail.public void deregisterObserver(KAoSObserver observer, java.lang.String updateType, java.io.Serializable updateCondition, KAoSEntityDescription observableDesc) throws NotLocatableException, TransportFailure
ObserverManager
deregisterObserver
in interface ObserverManager
observer
- KAoSObserver deregistering.updateType
- String indicating type of update the KAoSObserver is no longer interested in.updateCondition
- Serializable containing the condition the KAoSObserver is no longer interested in.observableDesc
- KAoSEntityDescription of the observable, from which to deregister
for the given update type.
NotLocatableException
- when the KAoSObservable cannot be located.
TransportFailure
- when transport services fail.public void registerObserver(java.lang.String updateType, java.lang.Object updateCondition, KAoSObserver observer)
registerObserver
in interface KAoSObservable
updateType
- String indicating type of update the KAoSObserver is interested in.updateCondition
- Object describing the conditions under which to send the update.observer
- KAoSObserver registering with for updates.public void deregisterObserver(java.lang.String updateType, java.lang.Object updateCondition, KAoSObserver observer)
deregisterObserver
in interface KAoSObservable
updateType
- String indicating type of update the KAoSObserver is no longer interested in.observer
- KAoSObserver deregistering.public void notify(java.lang.String updateType, java.lang.Object updateCondition, java.lang.Object update)
notify
in interface KAoSObservable
updateType
- String describing the type of update to perform.update
- Object containing the update.public java.lang.String requestAction(java.lang.String action, java.util.HashMap properties, KAoSEntityDescription receiverDesc) throws NotLocatableException, TransportFailure
action
- String containing the name of the requested action.
*** Important: the name has to be defined in the ontology describing robot's
actions.properties
- HashMap containing the properties of the requested action.
*** Important: the names of properties have to be defined in the ontology describing robot's
actions.receiverDesc
- KAoSEntityDescription of the robot to send the request to.
NotLocatableException
TransportFailure
public void sendMessage(java.lang.String GUID, java.io.Serializable content) throws NotLocatableException, TransportFailure, SearchException, DirectoryFailure
NotLocatableException
TransportFailure
SearchException
DirectoryFailure
public void assertNotLocatable(boolean exp, java.lang.String msg) throws NotLocatableException
NotLocatableException
- if exp is true.public void sendRequestToKaa(java.lang.String action, java.util.HashMap properties) throws java.lang.Exception
java.lang.Exception
public void onAccepted(java.util.Calendar time, java.lang.Object acceptInfo, java.lang.String actionID, java.lang.String robotID)
onAccepted
in interface FeedbackReceiver
time
- Calendar time of acceptance.acceptInfo
- Object containing additional (optional) info about the acceptance.actionID
- String containing the id of the requested action/information.robotID
- String containing the name of the robot performing the action.public void onRefused(java.util.Calendar time, java.lang.Object reason, java.lang.String actionID, java.lang.String robotID)
onRefused
in interface FeedbackReceiver
time
- Calendar time of refusal.reason
- Object containing the reason for refusing the request.actionID
- String containing the id of the requested action/information.robotID
- String containing the name of the robot performing the action.public void onCompleted(java.util.Calendar time, java.lang.Object result, java.lang.String actionID, java.lang.String robotID)
onCompleted
in interface FeedbackReceiver
time
- Calendar time of information/action completion.result
- Object containing the result of the requested action.actionID
- String containing the id of the requested action/information.robotID
- String containing the name of the robot performing the action.public void onStarted(java.util.Calendar time, java.lang.Object startedInfo, java.lang.String actionID, java.lang.String robotID)
onStarted
in interface FeedbackReceiver
time
- Calendar time of starting an action.startedInfo
- Object containing additional (optional) info about the start of the action.actionID
- String containing the id of the requested action/information.robotID
- String containing the name of the robot performing the action.public void onAborted(java.util.Calendar time, java.lang.Object reason, java.lang.String actionID, java.lang.String robotID)
onAborted
in interface FeedbackReceiver
time
- Calendar time of aborting an action.reason
- Object containing the reason for aborting an action.actionID
- String containing the id of the requested action/information.robotID
- String containing the name of the robot performing the action.public void receiveKAoSStatus(java.lang.String statusMsg, java.lang.String actionID, java.lang.String robotID)
receiveKAoSStatus
in interface FeedbackReceiver
statusMsg
- Object containing the result of the requested action/information.actionID
- String containing the id of the requested action/information.robotID
- String containing the name of the robot performing the action.public void registerWithSpatialProperties(Location3D location, Orientation3D orientation, Block3D block)
public void modifySpatialProperties(Location3D location, Orientation3D orientation, Block3D block)
protected void checkPermissionForAction(ActionInstanceDescription aid) throws ActionFailureException
ActionFailureException
protected void printDebugString(java.lang.String msg, int loggerDisplayLevel)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |