RCF Tutorial 2


This tutorial introduces the concept of a transfer layer. At its core, a transfer layer is simply a means to exchange data with external applications.

This example is composed of the components listed below, all contained in the .zip file you downloaded in tutorial 1.

  • sysController.xml
  • externalCommLibrary/
  • transferLayers/
  • tut2_printMessages/

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.

NOTE: The variable ${ACTIN_HOME} points to the Actin installation directory.

In the controller configuration file sysController.xml, the transfer layer is defined by the <externalCommTransferLayer> block. This block specifies receiveCallbackId and sendCallbackId attributes, which are the names used to invoke receive and send actions, respectively, in the _UR5IK thread. This block also specifies data store locations for extra information to to be retrieved and sent by the transfer layer (currently the transfer layer doesn't receive any commands, that will be included in the next tutorial).

In C++, the transfer layer is defined by the transferLayers project. The ExternalCommTransferLayer class derives from EcBaseDataTransferLayer, which provides most of the details for plumbing into the RCF framework. This class then customizes behavior by overriding a few functions.

  • registerComponents() - As with all actin Xml object types, this function is used to specify xml attributes and children
  • initializeImpl() - called during initialization phase of controller startup. At this phase all rcf objects should create data store elements for information the object plans to publish
  • configureImpl() - called during configuration phase of controller startup. At this phase rcf objects can subscribe to data store elements published by other objects
  • shutdown() - Called when the transfer layer is asked to shutdown (typically right as the controller is shutting down)
  • send() - Called whenever the sendCallbackId is invoked
  • receive() - Called whenever the receiveCallbackId is invoked

This example transfer layer uses a custom ExternalCommLibrary class (define in the externalCommLibrary project) to send/receive messages. This class is unrelated to the concepts being discussed so isn't described here. Although actin does provide a few specialized transfer layers, e.g. across shared memory or talking to UR robots, user transfer layers will typically use custom communication libraries specific to the application.

To run the controller from an Actin package generated by the build system, start up two termial windows (WINDOWS: cmd.exe windows), enter the following command in a terminal window:

  1. Copy UR5_sce.xml to your $ACTIN_HOME/bin directory (you already did this in tutorial 1)

  2. [console 1] Start the tutorial2 controller (same as in tutorial1, but using the system controller in tutorial2) cd $ACTIN_HOME/bin

    ./rtSystemController $ACTIN_HOME/examples/controllerTutorials/tutorial2/controller/sysController.xml
  3. [console 2] Run

    ${ACTIN_HOME}/examples/bin/tut2_printMessages -a
  4. [console 2] You'll see joint position and velocity messages coming from the controller, indicating the current robot state.