RtActivities that wait (optionally for a given time)
In some situations it might be necessary to halt the program/device for a certain amount of time, before further processing is feasible.
Example: A Gripper of a robot is linked to a compressor and it needs to open.
1. We create a first Activity that sends a signal via digital output to the
compressor. Pressure is sent to the Gripper and the Gripper starts to open.
2. We cannot just take the pressure away with the next Activity because the Gripper
won’t open much this way. So we use an Activity that does nothing for 50
milliseconds.
3. After that, the Gripper opened up enough. Using another RtActivity, we stop the
pressure.
The RoboticsAPI supplies the class SleepRtActivity to realize such a behavior.
SleepRtActivities can be described as a ”‘placeholder”’: They do not take control of any devices, nor do they execute any actions. It can however be parameterized in such a way that canceling is possible, allowing a subsequent Activity to take over the SleepActivity and continue the execution of the program. For example: Specifiying 0 as Timeout creates an infinite wait (as long as it isn’t canceled). Also, an alternative parameterization lets the Activity terminate after a previoulsy appointed amount of time.
How to create | Summary |
SleepRtActivity (RoboticsRuntime, double) | constructs a SleepActivity with a given name and a given SleepTime |
Alternative: Invoke RtActivities.sleep(RoboticsRuntime, double) | Returns an instantly created and anonymous SleepRtActivity |
Below is an example which uses the SleepRtActivity to pause the two Robot Arms of a LWR-Unit between two parallel movements for 3 seconds.