#include <WholeBodySingleton.h>
This class handles and contains configuration and devices used by all the blocks allocated by a running model. It is possible obtaining a singleton of this class by calling WholeBodySingleton::sharedInstance.
- See also
- wbt::RobotInterface
-
wbt::Configuration
-
wbt::yarpDevices
◆ WholeBodySingleton() [1/2]
WholeBodySingleton::WholeBodySingleton |
( |
| ) |
|
|
default |
◆ ~WholeBodySingleton()
WholeBodySingleton::~WholeBodySingleton |
( |
| ) |
|
|
default |
◆ WholeBodySingleton() [2/2]
◆ createRobotInterface()
Stores in the singleton the new configuration into a RobotInterface object
If the config is valid and hasn't been already stored, it creates a new entry in WholeBodySingleton::m_interfaces. If a configuration with matching confKey is found, if the Configuration object is the same it does nothing, otherwise it overrides it.
- Note
- Since confKey is the name of the block, the overriding can happen only after subsequent compilation in Simulink, when the block's parameters have been changed.
- Parameters
-
config | The wbt::Configuration object parsed from Simulink's parameters |
- Returns
- Returns a shared pointer to the RobotInterface object created from the Configuration object.
- See also
- WholeBodySingleton::isKeyValid
◆ eraseConfiguration()
void WholeBodySingleton::eraseConfiguration |
( |
const std::string & |
confKey | ) |
|
Delete the wbt::RobotInterface referred by confKey. No-op if it doesn't exist.
- Parameters
-
confKey | The key describing the configuration (name of the Simulink block) |
◆ getConfiguration()
const Configuration & WholeBodySingleton::getConfiguration |
( |
const std::string & |
confKey | ) |
const |
◆ getKinDynComputations()
const std::shared_ptr< iDynTree::KinDynComputations > WholeBodySingleton::getKinDynComputations |
( |
const std::string & |
confKey | ) |
const |
Returns a shared_ptr
to the KinDynComputations object used to perform calculation on the provided model
- Parameters
-
confKey | The key describing the configuration (name of the Simulink block) |
- Returns
- A
shared_ptr
to the iDynTree::KinDynComputations of the requested configuration
◆ getRobotInterface()
const std::shared_ptr< RobotInterface > WholeBodySingleton::getRobotInterface |
( |
const std::string & |
confKey | ) |
const |
Returns a shared_ptr
to the RobotInterface object containing the configuration labelled by confKey and all the objects used to gather and set robot data
- Parameters
-
confKey | The key describing the configuration (name of the Simulink block) |
- Returns
- A
shared_ptr
to the RobotInterface of the requested configuration
◆ isKeyValid()
bool WholeBodySingleton::isKeyValid |
( |
const std::string & |
confKey | ) |
const |
Check if a Configuration labelled by confKey exists and is a valid object.
- Parameters
-
confKey | The key describing the configuration (name of the Simulink block) |
- Returns
- True if the configuration is valid
◆ numberOfDoFs()
int WholeBodySingleton::numberOfDoFs |
( |
const std::string & |
confKey | ) |
const |
Returns the DoFs associated with the configuration labelled by confKey
- Parameters
-
confKey | The key describing the configuration (name of the Simulink block) |
- Returns
- The number of degrees of freedom. It returns -1 when failing.
◆ operator=()
◆ sharedInstance()
Returns the singleton instance to this object.
- Note
- The singleton stays in memory until the entire matlab is closed. The WBToolbox is designed in such a way that assures to reach a clean state when all blocks have been terminated.
- Returns
- the singleton instance
◆ storeConfiguration()
std::shared_ptr< RobotInterface > WholeBodySingleton::storeConfiguration |
( |
const blockfactory::core::Parameters & |
parameters | ) |
|
◆ m_interfaces
Object that stores all the configurations labelled by the name of the Simulink Block's name.
- See also
- wbt::RobotInterface
The documentation for this class was generated from the following files: