RCF Tutorial 3


The new concepts introduced in this example are

  • creating custom tasks
  • invoking custom callbacks.

This example is composed of the components listed below:

  • sysController.xml
  • transferLayers/
  • tut3_sendCommand/

You must run the preparation steps for the tutorials before starting. Tutorial Prep

Remember to source SETUP.sh (Ubuntu) or runSETUP.bat (windows) before you start.


The DriveCommTask is the first example of a custom task. By deriving from EcBaseRtTask it automatically gets the updateCallbackId xml attribute registered, and this is automatically linked to DriveCommTask::update(). In sysController.xml when we create the task we need to add the library="tut3_tasks" attribute to tell the XML parser where to find the object. Without this we would receive startup errors saying '"driveComm" tag not registered./

Next is EnqueueDriveEnableTask. This task derives from EcBaseRtControlObject instead of EcBaseRtTask because it does not need an updateCallbackId. Instead, it registered two custom callbacks: enableAllCallbackId and disableAllCallbackId. In C++, these callbacks are just boost::function<EcU32()> objects that are stored in the data store. When invoked, the function objects are accessed and operator () is called on them. EnqueueDriveEnableTask::initializeImpl() takes care of creating the function objects, linking them to the appropriate member functions, and publishing the function objects to the data store.

Run Example

  1. Copy UR5_sce.xml to your build directory (it's located at: $ACTIN_HOME/share/data/data/toolkits/actin/ur/UR5_sce.xml)

  2. [console 1] Start the tutorial3 controller (same as in tutorial1, but using tutorial3/controller/sysController.xml). After startup you'll see the state machine is in the Disconnected state.

  3. [console 2] Run

    '${ACTIN_HOME}/examples/bin/tut3_sendCommand -a'
  4. [console 2] Enable the drives (e <Enter>).

  5. [console 1] You'll see the state machine transition to MS1. As part of this transition you'll see the Sending drive power ON command message.

  6. [console 1] State machine will continue transitioning between MS1 and MS2 (same as in previous tutorials)

  7. [console 2] Disable the drives (d <Enter>).

  8. [console 1] You'll see the state machine transition to Disconnected. As part of this transition you'll see the Sending drive power OFF command message.