com.kuka.roboticsAPI.controllerModel.sunrise
Class SunriseController

java.lang.Object
  extended by com.kuka.roboticsAPI.controllerModel.Controller
      extended by com.kuka.roboticsAPI.controllerModel.sunrise.AbstractSunriseController
          extended by com.kuka.roboticsAPI.controllerModel.sunrise.SunriseController
All Implemented Interfaces:
IMessageHandler, IControllerWithOverride

public class SunriseController
extends AbstractSunriseController
implements IMessageHandler, IControllerWithOverride

Controller class for Sunrise. It manages a connection to Sunrise and provides the necessary services to access Sunrise.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

Constructor Summary
SunriseController(RoboticsAPIContext context, String name)
          Creates a new sunrise controller instance.
 
Method Summary
 void acknowledgeError()
          Sends an acknowledge message to Sunrise.
 void addOverrideListener(IApplicationOverrideListener listener)
          Adds a listener for the changes of the application override.
protected  void afterDispose()
          Called after the controller was disposed.
 boolean afterInitialize()
          Called when the controller was initialized.
 void cancelSPR(SPR spr)
           
 Collection<com.kuka.roboticsAPI.controllerModel.StatePortData> collectStatePortData()
          Gets the states of all state ports of sunrise.
 void connectionLost()
          Called to indicate that the connection was lost.
protected  ConditionService createConditionServiceInstance()
          Create a condition service instance.
protected  ExecutionService createExecutionServiceInstance()
          Should return an uninitialized instance of the ExecutionService for this controller.
protected  RecordingService createRecordingServiceInstance()
          Create a recording service instance.
protected  RequestService createRequestServiceInstance()
          Should return an uninitialized instance of the RequestService for this controller.
 ICommandContainer executeSPR(SPR spr)
           
protected  void fireConnectionLost()
           
protected  void fireDeviceSafetyStateChanged(Device device, SunriseSafetyState newSafetyState)
          Informs all listeners about a change of the safety state of the controller.
 ApplicationStateModule getApplicationStateModule()
          Get application state module.
 SPR getApplicationStateSPR()
          Get application state SPR.
protected  ControllerInformation getControllerInformationInstance()
          Should return an initialized instance of the controller information for this controller.
 SunriseExecutionService getExecutionService()
          Gets the service from the controller dealing with execution of commands.
 NameserverProxy getNameserver()
          Returns the nameserver instance used for the controller.
 double getProcessorLoad()
          Gets the load of the sunrise system.
 SunriseRequestService getRequestService()
          Gets the service from the controller dealing with requests.
protected  Map<String,com.kuka.roboticsAPI.controllerModel.StatePortData> getStatePortCache()
          Gets the complete map of all StatePort cache.
 com.kuka.roboticsAPI.controllerModel.StatePortData getStatePortData(String statePortName)
          Gets the data of the specified StatePort from the cache by name.
 SunriseConnection getSunriseConnection()
          Gets the connection wrapper to Sunrise.
 ControllerBootInfo getSystemState()
          Gets the state of the system.
 void handleMessage(Message message)
          Handles the given message.
 boolean isPausable()
          Is this Controller pausable?
 void killAllSPRsOnRealtimeSystems()
          Kills VERY All SPRs !!!
protected  void mapApplicationStateSPR()
          In order to get access to the mapped ApplicationStateSPR before it is actually executed, first the SPR is mapped...
 void onInitialize()
          Called when the controller get's initialized.
 void onInitializeFailed()
          Called when the controller initialization failed.
protected  void onSetParameters(com.kuka.common.ParameterSet attributeMap)
          Sets the attributes for this controller.
 void removeOverrideListener(IApplicationOverrideListener listener)
          Remove an application override listener.
 void sendAsynchronousSSR(SSR ssr)
           
 Message sendSynchronousSSR(SSR ssr)
           
 Message sendSynchronousSSR(SSR ssr, int timeout, TimeUnit timeUnit)
           
 void setAlwaysResetOnMotion(boolean alwaysReset)
          Ensures that every executed motion sets the reset flag for the interpolator to true.
 void startTrace(double hz)
          Starts a controller trace.
 void stopTrace()
          Stops a formerly started trace.
 
Methods inherited from class com.kuka.roboticsAPI.controllerModel.Controller
addControllerListener, areServicesInitialized, callAsyncEvent, callSyncEvent, clipProgramOverride, deinitialize, dispose, fireControllerShutdown, fireFieldBusDeviceConfigurationChangedEvent, fireFieldBusDeviceIdentificationEvent, fireStatePortChanged, getBehavior, getConditionService, getContext, getControllerInformation, getDevice, getDevice, getDeviceMap, getDevices, getInvalidDevices, getName, getParameters, getProgramOverride, getRecordingService, initialize, isInitialized, onDispose, onServicesInitialized, removeControllerListener, resetRecordingService, setParameters, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SunriseController

public SunriseController(RoboticsAPIContext context,
                         String name)
Creates a new sunrise controller instance.

Parameters:
context - The context for this controller. null is not allowed.
name - The name of the controller. null is not allowed.
Method Detail

getNameserver

public NameserverProxy getNameserver()
Returns the nameserver instance used for the controller.

Returns:
The nameserver instance used for the controller.

getControllerInformationInstance

protected ControllerInformation getControllerInformationInstance()
Description copied from class: Controller
Should return an initialized instance of the controller information for this controller. The default implementation returns a default information instance.

Overrides:
getControllerInformationInstance in class Controller
Returns:
An initialized instance of the controller information for this controller.

createRequestServiceInstance

protected RequestService createRequestServiceInstance()
Description copied from class: Controller
Should return an uninitialized instance of the RequestService for this controller.

Specified by:
createRequestServiceInstance in class Controller
Returns:
An uninitialized instance of the RequestService for this controller.

createExecutionServiceInstance

protected ExecutionService createExecutionServiceInstance()
Description copied from class: Controller
Should return an uninitialized instance of the ExecutionService for this controller.

Specified by:
createExecutionServiceInstance in class Controller
Returns:
An uninitialized instance of the ExecutionService for this controller.

createConditionServiceInstance

protected ConditionService createConditionServiceInstance()
Description copied from class: Controller
Create a condition service instance.

Overrides:
createConditionServiceInstance in class Controller
Returns:
Condition service instance.

createRecordingServiceInstance

protected RecordingService createRecordingServiceInstance()
Description copied from class: Controller
Create a recording service instance.

Overrides:
createRecordingServiceInstance in class Controller
Returns:
Recording service instance.

onInitialize

public void onInitialize()
Called when the controller get's initialized. Use this method to do controller specific initialization stuff.

The method is called before any other initialization of the controller occurred. The controller will return false for the isInitialized method and no service will be available.

Overrides:
onInitialize in class Controller
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

onInitializeFailed

public void onInitializeFailed()
Called when the controller initialization failed.

Overrides:
onInitializeFailed in class Controller
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

onSetParameters

protected void onSetParameters(com.kuka.common.ParameterSet attributeMap)
Description copied from class: Controller
Sets the attributes for this controller. Used when the configuration of the controllers is loaded.

Overrides:
onSetParameters in class Controller
Parameters:
attributeMap - The attributes defined for this controller.

afterDispose

protected void afterDispose()
Description copied from class: Controller
Called after the controller was disposed.

This method is the last method called during the disposal process.

Overrides:
afterDispose in class Controller

getSystemState

public ControllerBootInfo getSystemState()
Gets the state of the system.

Overrides:
getSystemState in class Controller
Returns:
the state of the system as controller boot information.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

afterInitialize

public boolean afterInitialize()
Called when the controller was initialized. Use this method to initialize more controller specific stuff. All devices and services are available.

Note that this method instead of the onInitialize method is called after the controller was initialized. The isInitialized method will return true and each service should be available.

Overrides:
afterInitialize in class Controller
Returns:
true if initialization was ok and the controller is ready afterwards. false if the controller can be used but the boot state should be ReadyWithWarnings.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

fireDeviceSafetyStateChanged

protected void fireDeviceSafetyStateChanged(Device device,
                                            SunriseSafetyState newSafetyState)
Informs all listeners about a change of the safety state of the controller.

Parameters:
device - The device that changed its state.
newSafetyState - The new state of the safety signals.

handleMessage

public final void handleMessage(Message message)
Handles the given message.

Specified by:
handleMessage in interface IMessageHandler
Parameters:
message - The message to be handled. Will never be null.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

connectionLost

public final void connectionLost()
Called to indicate that the connection was lost.

Specified by:
connectionLost in interface IMessageHandler
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

fireConnectionLost

protected void fireConnectionLost()

getSunriseConnection

public final SunriseConnection getSunriseConnection()
Gets the connection wrapper to Sunrise.

Returns:
The connection wrapper to Sunrise.

getExecutionService

public final SunriseExecutionService getExecutionService()
Gets the service from the controller dealing with execution of commands.

Fails if the controller is not initialized.

Overrides:
getExecutionService in class Controller
Returns:
The execution service
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getRequestService

public SunriseRequestService getRequestService()
Gets the service from the controller dealing with requests.

Fails if the controller is not initialized.

Overrides:
getRequestService in class Controller
Returns:
The request service.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

sendSynchronousSSR

public final Message sendSynchronousSSR(SSR ssr)
Parameters:
ssr - The SSR which should be sent.
Returns:
The response message of the SSR.
See Also:
SunriseRequestService.sendSynchronousSSR(com.kuka.roboticsAPI.controllerModel.sunrise.api.SSR)
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

sendSynchronousSSR

public final Message sendSynchronousSSR(SSR ssr,
                                        int timeout,
                                        TimeUnit timeUnit)
Parameters:
ssr - The SSR which should be sent.
timeout - the timeout to wait for the response.
timeUnit - the timeout unit for the timeout
Returns:
The response message of the SSR.
See Also:
SunriseRequestService.sendSynchronousSSR(com.kuka.roboticsAPI.controllerModel.sunrise.api.SSR)

sendAsynchronousSSR

public final void sendAsynchronousSSR(SSR ssr)
Parameters:
ssr - The SSR which should be sent.
See Also:
SunriseRequestService.sendAsynchronousSSR(com.kuka.roboticsAPI.controllerModel.sunrise.api.SSR)

executeSPR

public final ICommandContainer executeSPR(SPR spr)
Parameters:
spr - The SPR which should be executed.
Returns:
The container to which the SPR is assigned.
See Also:
SunriseExecutionService.executeSPR(com.kuka.roboticsAPI.controllerModel.sunrise.api.SPR)

cancelSPR

public final void cancelSPR(SPR spr)
Parameters:
spr - The SPR which should be cancelled.
See Also:
SPRRuntime.cancel()

startTrace

public void startTrace(double hz)
Starts a controller trace.

Parameters:
hz - The hertz values in which trace values will get collected.

stopTrace

public void stopTrace()
Stops a formerly started trace.


acknowledgeError

public void acknowledgeError()
Sends an acknowledge message to Sunrise.


killAllSPRsOnRealtimeSystems

public void killAllSPRsOnRealtimeSystems()
Kills VERY All SPRs !!! Including (Especially) those, not belonging to this very API This is meant as a "Tabula Rasa" (Latin for: Clean Table) Command.


getProcessorLoad

public double getProcessorLoad()
Gets the load of the sunrise system.

Note that the return values is only an approximation.

Returns:
The load percentage as a value between 0 and 1.

collectStatePortData

public Collection<com.kuka.roboticsAPI.controllerModel.StatePortData> collectStatePortData()
Gets the states of all state ports of sunrise.

Returns:
the states of all state ports of sunrise.

getStatePortData

public com.kuka.roboticsAPI.controllerModel.StatePortData getStatePortData(String statePortName)
Gets the data of the specified StatePort from the cache by name.

Parameters:
statePortName - name of the StatePort
Returns:
Cached StatePort or null if not present

getStatePortCache

protected Map<String,com.kuka.roboticsAPI.controllerModel.StatePortData> getStatePortCache()
Gets the complete map of all StatePort cache.

Returns:
Cached StatePorts

getApplicationStateSPR

public SPR getApplicationStateSPR()
Get application state SPR.

Specified by:
getApplicationStateSPR in class AbstractSunriseController
Returns:
Application state SPR

getApplicationStateModule

public ApplicationStateModule getApplicationStateModule()
Get application state module.

Returns:
Application state module

mapApplicationStateSPR

protected void mapApplicationStateSPR()
In order to get access to the mapped ApplicationStateSPR before it is actually executed, first the SPR is mapped...


setAlwaysResetOnMotion

public void setAlwaysResetOnMotion(boolean alwaysReset)
Ensures that every executed motion sets the reset flag for the interpolator to true. This is used e.g. for jogging.

Parameters:
alwaysReset - when true, the reset flag is always set to true for every motion.

isPausable

public boolean isPausable()
Is this Controller pausable? Normally, all controllers are pausable except the StationControllers. Pausable means, they can handle PauseRequests

Returns:
true, if pausable

addOverrideListener

public void addOverrideListener(IApplicationOverrideListener listener)
Description copied from interface: IControllerWithOverride
Adds a listener for the changes of the application override.

Specified by:
addOverrideListener in interface IControllerWithOverride
Parameters:
listener - the listener

removeOverrideListener

public void removeOverrideListener(IApplicationOverrideListener listener)
Description copied from interface: IControllerWithOverride
Remove an application override listener.

Specified by:
removeOverrideListener in interface IControllerWithOverride
Parameters:
listener - the listener


Copyright © 2019. All rights reserved.