Helpers to obtain robot index/name from configuration

The intent of these functions is: More...

Functions

const MC_RBDYN_DLLAPI mc_rbdyn::Robotmc_rbdyn::robotFromConfig (const mc_rtc::Configuration &config, const mc_rbdyn::Robots &robots, const std::string &prefix, bool required=false, const std::string &robotIndexKey="robotIndex", const std::string &robotNameKey="robot", const std::string &defaultRobotName="")
 Obtains a reference to a loaded robot from configuration (using robotName or robotIndex) More...
 
std::string MC_RBDYN_DLLAPI mc_rbdyn::robotNameFromConfig (const mc_rtc::Configuration &config, const mc_rbdyn::Robots &robots, const std::string &prefix="", bool required=false, const std::string &robotIndexKey="robotIndex", const std::string &robotNameKey="robot", const std::string &defaultRobotName="")
 Helper to obtain the robot name from configuration. More...
 
unsigned int MC_RBDYN_DLLAPI mc_rbdyn::robotIndexFromConfig (const mc_rtc::Configuration &config, const mc_rbdyn::Robots &robots, const std::string &prefix="", bool required=false, const std::string &robotIndexKey="robotIndex", const std::string &robotNameKey="robot", const std::string &defaultRobotName="")
 Helper to obtain the robot index from configuration. More...
 

Detailed Description

The intent of these functions is:

Function Documentation

◆ robotFromConfig()

const MC_RBDYN_DLLAPI mc_rbdyn::Robot& mc_rbdyn::robotFromConfig ( const mc_rtc::Configuration config,
const mc_rbdyn::Robots robots,
const std::string &  prefix,
bool  required = false,
const std::string &  robotIndexKey = "robotIndex",
const std::string &  robotNameKey = "robot",
const std::string &  defaultRobotName = "" 
)

Obtains a reference to a loaded robot from configuration (using robotName or robotIndex)

  • If robotName is present, it is used to find the robot
  • Otherwise, it'll attempt to use robotIndex and inform the user that its use is deprecated in favor of robotName
Parameters
configConfiguration from which to look for robotName/robotIndex
robotsLoaded robots
prefixPrefix used for printint outputs to the user (deprecation warning, non-existing robot, etc).
required
  • When true, throws if the robotName/robotIndex is invalid or missing.
  • When false, returns the main robot if the robotName/robotIndex is invalid or missing.
robotIndexKeyConfiguration key for robotIndex
robotNameKeyConfiguration key for robotName
defaultRobotNameWhen empty, return the main robot name, otherwise use the specified name
Returns
Robot as configured by the robotName or robotIndex configuration entry.

◆ robotIndexFromConfig()

unsigned int MC_RBDYN_DLLAPI mc_rbdyn::robotIndexFromConfig ( const mc_rtc::Configuration config,
const mc_rbdyn::Robots robots,
const std::string &  prefix = "",
bool  required = false,
const std::string &  robotIndexKey = "robotIndex",
const std::string &  robotNameKey = "robot",
const std::string &  defaultRobotName = "" 
)

Helper to obtain the robot index from configuration.

Note
This function will be removed when transitioning to TVM. To facilitate the transition from index-based to named-based robots, this function can be deprecated to help with the transition.
See also
const mc_rbdyn::Robot & robotFromConfig(const mc_rtc::Configuration & config, const mc_rbdyn::Robots & robots, const std::string & prefix, bool required);

◆ robotNameFromConfig()

std::string MC_RBDYN_DLLAPI mc_rbdyn::robotNameFromConfig ( const mc_rtc::Configuration config,
const mc_rbdyn::Robots robots,
const std::string &  prefix = "",
bool  required = false,
const std::string &  robotIndexKey = "robotIndex",
const std::string &  robotNameKey = "robot",
const std::string &  defaultRobotName = "" 
)

Helper to obtain the robot name from configuration.

See also
const mc_rbdyn::Robot & robotFromConfig(const mc_rtc::Configuration & config, const mc_rbdyn::Robots & robots, const std::string & prefix, bool required);