RCF Tutorial 4


This tutorial introduces a few new XML techniques.

This example is composed of the components listed below:

  • connected_fsm.xml
  • controller_task.xml
  • data_store.xml
  • sysController.xml
  • top_fsm.xml

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.


Controller definitions across multiple files via <xi:include> tags. When the XML parser sees this it will load the referenced file and the text of the new file is effectively inserted into the original file in place of the <xi:include> element.

Multiple threads can be defined, each with different priority, cpu affinity, period, etc. In this case we moved HMI comm off to a separate thread since it can sometimes be blocked waiting on the tcp stack for reading/writing. Note that in C++ all elements of the data store are accessed data store information via accessors. Because of this the same data can still be safely used by both threads.

State machines can be nested by having the parent state machine invoke children state machines. In this example, the IK thread only directly invokes top_fsm. If top_fsm is in the Connected state it will then invoke connected_fsm, which drives the motion scripts. If top_fsm is not is the Connected state, connected_fsm will not be run.

Synchronization of joint values to match sensor feedback can be done in a few different ways. This tutorial gives one example of syncing right before enabling the drives ("Syncing" state of top_fsm). The sync itself is done via motion script and the set_position_state command.

Run the 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 tutorial4 controller (same as in tutorial1, but using tutorial4/controller/sysController.xml). After startup you'll see top_fsm is in the Disconnected state.

  3. [console 2] Run

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

  5. [console 1] You should first see top_fsm transition to Syncing then to Connected. Because top_fsm is in Connected, it's also running connected_fsm so you'll see it switch between MS1 and MS2 states, same as before.

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

  7. [console 1] You'll see top_fsm transition to the Disconnected stated. In this state connected_fsm is no longer running so there are no more transitions between MS1 and MS2.