control.xml

Keep the parameter values of your application in control.xml, and values that must survive a restart in persistence.bin.

The control folder keeps the values of your application’s parameters, so a tuned gain or a set limit is still there after a restart. It holds two files, each for a different kind of parameter:

/etc/motorcortex/config/
└── control
    ├── control.xml
    └── persistence.bin
File Holds Written
control.xml The values of all parameters of type parameter When you save the parameter tree
persistence.bin The values of all parameters of type parameter_persistent All the time, while the application runs

The parameter typeEvery parameter in the tree has a type that says who may change it and whether its value is kept: an input is written by a link or a client, an output by the module itself, a parameter is a setting you tune and save, and a parameter_persistent is kept automatically. See the user parameters page for the full list. decides which file keeps a value. The paths of both files come from the Path block of config.json: Control and Persistence.

Parameter values in control.xml

control.xml lists parameter values, one per line, by their path in the parameter tree. This is the start of the file of the standard robot application:

<?xml version="1.0"?>
<ParamList>
  <Param Path="root/AlarmDevices/Beeper/Sequencer01/channel_01">0 0 0 0 0</Param>
  <Param Path="root/AlarmDevices/Beeper/Sequencer01/channel_02">0 0 0 0 0</Param>
  …
</ParamList>

An array takes its elements separated by spaces. A path that does not exist in the tree is reported in the log as Failed to find parameter, with the line number.

  • At start-up the application loads control.xml after it has set up the parameter tree and applied the link files.
  • To save the current values, click Save parameter tree to server (Ctrl+S) in the parameter tree of Motorcortex Desk. The application writes every parameter value to control.xml, in the same folder. You need to have control of the application to save.

Change values in Motorcortex Desk and save them, rather than editing control.xml by hand: Desk shows each parameter’s current value and writes the file in the right format. A saved control.xml stays in the active package folder on the controller; fetch the configuration back into your project to keep it, see Config Package.

Persistent values in persistence.bin

persistence.bin keeps the values of parameter_persistent parameters across a restart, without a save. Use it for values that change while the machine runs and must never be lost, such as a counter of running hours, or the position of an axis with an incremental encoder, so it does not need homing again after a restart.

  • At start-up the application creates the file when it is missing and loads the stored values.
  • While it runs the application copies the values into the file every cycle of Logic_task. The application forces a write to disk when it stops, and also every root/Persistence/sync_interval_sec seconds when you set that parameter. At the default -1 only the stop forces a write; set an interval when the values must survive a power cut.

persistence.bin is a binary file: do not edit it, and do not copy it to another application.