Configuring mc_rtc and its components

Regardless of the interface you use, general options for mc_rtc are provided through the configuration files present on your system. Morever, some interfaces will let you specify another configuration file (often on the command line).

This section covers both the different location where it might be loaded from as well as the main options that can be used in the file.

Possible locations for mc_rtc configuration

The following two files will be systematically read by mc_rtc (if they exist):

  1. $INSTALL_PREFIX/etc/mc_rtc.yaml
    • Linux/MacOS: $HOME/.config/mc_rtc/mc_rtc.yaml
    • Windows: %APPDATA%/mc_rtc/mc_rtc.yaml

The interface might load additional configuration file(s). Please refer to the interface documentation to find out about that.

Configuration entries

Entry Description Example/Default
Main entries
These entries cover most needs you might have
MainRobot This entry dictates the main robot used by all controllers. Most interface cannot infer the correct module to use based on the simulation environment so this is the user's responsibility to make sure the two match.
MainRobot: JVRC1

or

# Support renaming the robot
MainRobot:
  name: MyRobot
  module: JVRC1
Enabled Provides a list of enabled controllers. See the list of all available sample controllers.
Enabled: [Posture, EndEffector, CoM]
Default Select which of the enabled controllers will be started first. Note that if the default controller is not enabled or if no default entry is provided then the first enabled controller in the list is chosen as a default controller.
Default: Posture
Timestep The controller's timestep.
Timestep: 0.005
Log Dictate whether or not controllers will log their output.
Log: true
InitAttitudeFromSensor Intialize the robot's attitude from sensor or the robot module
InitAttitudeFromSensor: false
InitAttitudeSensor Name of the BodySensor used for initialization of the robot's attitude. An empty name uses the default body sensor. Only used when
InitAttitudeFromSensor=true
InitAttitudeSensor: ""
Logging options
The following options affect the way mc_rtc deals with controller activity logging. They have no effect if logging is disabled.
LogDirectory This option dictates where the log files will be stored, defaults to a system temporary directory
LogDirectory: "/tmp"
LogTemplate This option dictates the prefix of the log. The log file will then have the name:
[LogTemplate]-[ControllerName]-[date].log
LogTemplate: "mc-control"
LogPolicy This option dictates whether logging-related disk operations happen in a separate thread ("threaded") or in the same thread as the run() loop ("non-threaded"). This defaults to the non-threaded policy. On real-time systems, the threaded policy is strongly advised.
LogPolicy: "non-threaded"
Module loading options
The following options control the way mc_rtc loads additional modules from libraries (controllers, robot modules, observers, plugins).
ControllerModulePaths This option allow you to specify additional directories where mc_rtc will look for controller modules.
ControllerModulePaths: ["/one/path/to/controller/", "/another/path/"]
RobotModulePaths This option allow you to specify additional directories where mc_rtc will look for robot modules.
RobotModulePaths: ["/one/path/to/robot/", "/another/path/"]
ObserverModulePaths This option allow you to specify additional directories where mc_rtc will look for state observation modules.
ObserverModulePaths: ["/one/path/to/observer/", "/another/path/"]
GlobalPluginPaths This option allow you to specify additional directories where mc_rtc will look for global plugins.
GlobalPluginPaths: ["/one/path/to/global/plugin/", "/another/path/"]

ROS plugin configuration

Possible locations

The following two files will be systematically read by mc_rtc (if they exist):

  1. ${MC_PLUGINS_RUNTIME_INSTALL_PREFIX}/etc/ROS.yaml
    • Linux/MacOS: $HOME/.config/mc_rtc/plugins/ROS.yaml
    • Windows: %APPDATA%/mc_rtc/plugins/ROS.yaml

Configuration entries

The following table describes each possible sections in the ROS plugin configuration and their possible entries.

Entry Description Example/Default
publish entries
The following options only affect the publication of the robot's state in ROS.
control Publish the robot's control state (mc_rtc controller output).
control: true
env Publish other robots control state (mc_rtc controller output for the non-main robot).
env: true
real Publish the robot's observed state (i.e. the robot's state obtained from the observer pipeline).
real: true
timestep Control the publication rate of the robot's controlled and real state.
timestep: 0.01

Sample configuration

# Control which data we publish and publishing rate
publish:
  # Publish the state of the controlled robot (ROS)
  control: true
  # Publish the state of the other robots (ROS)
  env: true
  # Publish the state of the real robot (ROS)
  real: true
  # Timestep of publication (ROS)
  timestep: 0.01

Controller configuration

For a given controller NAME, the following configuration files are loaded:

  1. ${NAME_RUNTIME_LOCATION}/etc/${NAME}.yaml
    • Linux/MacOS: ${HOME}/.config/mc_rtc/controllers/${NAME}.yaml
    • Windows: %APPDATA%/mc_rtc/controllers/%NAME%.yaml

The configuration loaded from those files is available in the configuration parameter of the controller constructor. You can check the mc_rtc::Configuration general purpose configuration tutorial for more information on the configuration object.

Controller's robot specific configuration

Controller can also access a robot's specific configuration — for example to set specific gains.

For a given controller NAME and a given robot's module named ROBOT, the following configuration files are loaded:

  1. ${NAME_RUNTIME_LOCATION}/${NAME}/${ROBOT}.yaml
    • Linux/MacOS: ${HOME}/.config/mc_rtc/controllers/${NAME}/${ROBOT}.yaml
    • Windows: %APPDATA%/mc_rtc/controllers/%NAME%/%ROBOT%.yaml

By default, these configuration files are automatically loaded into the

robots
section of the controller's configuration, under each robot's module name. This behavior can be disabled or modified through mc_control::ControllerParameters that are given to the controller constructor.

These configurations can also be accessed via the mc_control::MCController::robot_config(const mc_rbdyn::Robot & robot) method and its overload mc_control::MCController::robot_config(const std::string & name) .