|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.roboticsAPI.motionModel.AbstractMotionContainer
public abstract class AbstractMotionContainer
Represents the state of a motion execution.
Not thread-safe for callers (and not intended to be). That means, this container should only be used by one thread.
| Constructor Summary | |
|---|---|
protected |
AbstractMotionContainer(MotionInstruction motionInstruction,
boolean isSynchronous,
ExecutorService eventWorker,
ExecutorService cleanupWorker)
Creates an instance of the class. |
| Method Summary | |
|---|---|
void |
addContainerListener(IContainerStateListener listener)
Adds the given listener to this container. |
void |
addTriggerConditionObserver(ConditionObserver obs,
IMotion motion)
Adds a condition observer for a trigger to the motion container. |
void |
append(IMotion motion)
Appends a motion to the executing motions. |
void |
await()
Blocks the calling thread until the container has finished it's execution. |
void |
await(long timeout,
TimeUnit unit)
Blocks the calling thread until the container has finished it's execution. |
void |
cancel()
Cancels all motions in this container. |
void |
cleanTriggerObservers()
Stops all eventually running trigger handler. |
protected abstract ICommandContainer |
createExecutionContainerInternal(IMotion motion,
boolean isSynchronous)
Inheriting classes should create the specific execution container here. |
protected abstract void |
executeAppendedMotion(ICommandContainer container)
Implementing classes should send the appended motion container to execution. |
protected MotionBatch |
getBatch()
Gets the motion batch if this container is created for a batch. |
protected com.kuka.common.params.IParameterSet |
getBatchParams()
Gets the batch parameters if this container is created for a batch. |
MotionInstruction |
getCommand()
Gets the command which was executed within this container. |
Collection<ICommandContainer> |
getCommandContainers()
Debugging/test helper method: Returns the remaining execution containers. |
IMotion |
getCurrentMotion()
Returns the motion command that is being currently executed. |
String |
getErrorMessage()
Gets the error message for the container. |
protected ExecutorService |
getEventWorker()
Gets the worker for container events. |
IFiredConditionInfo |
getFiredBreakConditionInfo()
Gets the user condition that has fired and caused the stopping of this motion container. |
ICommandContainer |
getFirstCommandContainer()
Debugging/test helper method: Returns the execution container for the first motion. |
IMotion |
getLastExecutedMotion()
Returns the last executed motion command, if the container is already finished. |
ICommandRuntimeData |
getRuntimeData()
Gets the custom runtime data associated with this container. |
ExecutionState |
getState()
Gets the current ExecutionState of the container. |
boolean |
hasError()
Checks if this container is in an error state. |
boolean |
hasFired(ICondition condition)
Tests whether the given condition has fired for this container. this is equivalent to {@code getFiredConditionInfo() ! |
boolean |
isFinished()
Checks if the container has finished it's execution either with a successful execution or with an error. |
boolean |
isSynchron()
Checks if the motion in a container has been commanded synchronously. |
protected abstract void |
onContainerFinishedInternal(ICommandContainer cont,
CountDownLatch handlerFinished)
Called when the specified motion container is finished. |
void |
onStateChanged(IExecutionContainer cont,
ExecutionState state)
Called when the state of the container changed it's state. |
void |
removeContainerListener(IContainerStateListener listener)
Removes the given container from this container. |
protected void |
silentCancel()
Cancels the container and ignores errors. |
String |
toString()
|
void |
validate()
Validates this container and throws an exception if the container is invalid or was canceled. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractMotionContainer(MotionInstruction motionInstruction,
boolean isSynchronous,
ExecutorService eventWorker,
ExecutorService cleanupWorker)
motionInstruction - motion instruction for which the container is created.isSynchronous - true if container should be executed
synchronously.eventWorker - worker for container events.cleanupWorker - worker for cleanup actions.| Method Detail |
|---|
public final String toString()
toString in class Objectprotected ExecutorService getEventWorker()
public boolean hasFired(ICondition condition)
getFiredConditionInfo() != null && getFiredConditionInfo().getFiredCondition() == condition
hasFired in interface IExecutionContainercondition - the condition to test if it has fired.
true if the condition has fired, false
otherwise.
protected abstract ICommandContainer createExecutionContainerInternal(IMotion motion,
boolean isSynchronous)
motion - motion for which container should be created.isSynchronous - true if container should be executed
synchronously.
public void await()
await in interface com.kuka.common.concurrent.IWaitTokenawait in interface IExecutionContainercom.kuka.common.ThreadInterruptedException - if the thread was interrupted while waiting
public void await(long timeout,
TimeUnit unit)
throws TimeoutException
await in interface com.kuka.common.concurrent.IWaitTokenawait in interface IExecutionContainertimeout - The timeout.unit - The unit of the timeout.
com.kuka.common.ThreadInterruptedException - if the thread was interrupted while waiting
TimeoutException - the wait timed outpublic void validate()
This method will block if error handler
IErrorHandler.handleError(com.kuka.roboticsAPI.deviceModel.Device, IMotionContainer, List) is called
until it is finished.
validate in interface IExecutionContainerCancelledException - if container command was canceled.
CommandInvalidException - if container command goes into invalid state (controller
error).
ExternalStopException - if command was stopped because of some external signal.public boolean isFinished()
isFinished in interface com.kuka.common.concurrent.IWaitTokenisFinished in interface IExecutionContainerpublic boolean hasError()
hasError in interface IExecutionContainerpublic String getErrorMessage()
getErrorMessage in interface IExecutionContainerpublic IFiredConditionInfo getFiredBreakConditionInfo()
null if no user defined condition
has fired.
HINT regarding motion batches: if the motion contained in this container
is a motion batch, only the fired condition of the batch itself
shows up in the info. The stop conditions that may have fired on the
motions within the batch don't stop the batch. That's why in this
case the fired condition info will be null.
getFiredBreakConditionInfo in interface IExecutionContainernull.public void cancel()
cancel in interface IExecutionContainercancel in interface IMotionContainerprotected void silentCancel()
public IMotion getCurrentMotion()
If the motion consists of segments (for example spline command), the currently executed segment of the spline will be returned.
getCurrentMotion in interface IMotionContainernull.public IMotion getLastExecutedMotion()
If not, the motion that is currently being executed will be returned.
This is the part of the robot trajectory where the robot is currently
moving.
If the motion consists of segments (for example spline command), the
currently executed segment of the spline will be returned.
getLastExecutedMotion in interface IMotionContainernull.public void append(IMotion motion)
append in interface IMotionContainermotion - the motion to be appendedprotected abstract void executeAppendedMotion(ICommandContainer container)
container - appended container to executepublic ICommandContainer getFirstCommandContainer()
public Collection<ICommandContainer> getCommandContainers()
public void onStateChanged(IExecutionContainer cont,
ExecutionState state)
onStateChanged in interface IContainerStateListenercont - The container which changed it's state.state - The actual state of the container.public void cleanTriggerObservers()
protected abstract void onContainerFinishedInternal(ICommandContainer cont,
CountDownLatch handlerFinished)
Used by inheriting classes to report that container is finished to its executor.
cont - finished container.handlerFinished - latch that will be count down when executer is finished with
the container.public void addContainerListener(IContainerStateListener listener)
listener - a listenerpublic void removeContainerListener(IContainerStateListener listener)
listener - a listenerpublic ICommandRuntimeData getRuntimeData()
getRuntimeData in interface IExecutionContainernull.public MotionInstruction getCommand()
ICommandContainer
getCommand in interface ICommandContainerpublic ExecutionState getState()
ICommandContainerExecutionState of the container.
getState in interface ICommandContainerprotected com.kuka.common.params.IParameterSet getBatchParams()
protected MotionBatch getBatch()
null if no batch.public boolean isSynchron()
true if container should be executed synchronously.
public void addTriggerConditionObserver(ConditionObserver obs,
IMotion motion)
obs - the condition observer to addmotion - the motion where the trigger was added.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||