mc_rtc  2.14.0
mc_rbdyn::Robots Struct Reference

#include <mc_rbdyn/Robots.h>

Inheritance diagram for mc_rbdyn::Robots:
Collaboration diagram for mc_rbdyn::Robots:

Classes

struct  NewRobotsToken
 

Public Types

using value_type = mc_rbdyn::Robot
 
- Public Types inherited from mc_rtc::shared< Robots >
using ActualBase = typename std::conditional< std::is_same< void, void >::value, std::enable_shared_from_this< Robots >, void >::type
 

Public Member Functions

const std::vector< mc_rbdyn::RobotModule > & robotModules () const
 
std::vector< rbd::MultiBody > & mbs ()
 
const std::vector< rbd::MultiBody > & mbs () const
 
std::vector< rbd::MultiBodyConfig > & mbcs ()
 
const std::vector< rbd::MultiBodyConfig > & mbcs () const
 
bool hasRobot (const std::string &name) const
 
mc_rbdyn::Robotsrobots () noexcept
 
const mc_rbdyn::Robotsrobots () const noexcept
 
unsigned int robotIndex () const
 
unsigned int envIndex () const
 
unsigned int robotIndex (const std::string &name) const
 
const RobotModulerobotModule (size_t idx) const
 
Robotrobot ()
 
const Robotrobot () const
 
Robotenv ()
 
const Robotenv () const
 
Robotrobot (size_t idx)
 
const Robotrobot (size_t idx) const
 
Robotrobot (const std::string &name)
 
const Robotrobot (const std::string &name) const
 
size_type size () const noexcept
 
void reserve (size_type new_cap)
 
mc_rbdyn::Robotoperator[] (size_t idx)
 
const mc_rbdyn::Robotoperator[] (size_t idx) const
 
mc_rbdyn::Robotat (size_t idx)
 
const mc_rbdyn::Robotat (size_t idx) const
 
void copy (mc_rbdyn::Robots &out) const
 
 Robots (NewRobotsToken)
 
Robot(s) loading/unloading functions

These functions allow to load or unload robot(s) from the Robots class

Robotload (const std::string &name, const RobotModule &module, const LoadRobotParameters &params={})
 
Robotload (const RobotModule &module, const LoadRobotParameters &params={})
 
void load (const std::vector< std::shared_ptr< RobotModule >> &modules)
 
void rename (const std::string &oldName, const std::string &newName)
 
RobotloadFromUrdf (const std::string &name, const std::string &urdf, const rbd::parsers::ParserParameters &parser_params={}, const LoadRobotParameters &load_params={})
 
void robotCopy (const Robot &robot, const std::string &copyName)
 
void removeRobot (const std::string &name)
 
void removeRobot (unsigned int idx)
 
- Public Member Functions inherited from mc_rtc::shared< Robots >
 operator std::shared_ptr< Robots > ()
 
 operator std::shared_ptr< const Robots > () const
 

Static Public Member Functions

static RobotsPtr make () noexcept
 
template<class Deleter >
static RobotsPtr make (Deleter deleter) noexcept
 

Protected Member Functions

 Robots (const Robots &rhs)=delete
 
Robotsoperator= (const Robots &rhs)=delete
 
 Robots (Robots &&robots)=delete
 
Robotsoperator= (Robots &&robots)=delete
 
void updateIndexes ()
 

Protected Attributes

RobotModuleVector robot_modules_
 
std::vector< RobotPtrrobots_
 
std::vector< rbd::MultiBody > mbs_
 
std::vector< rbd::MultiBodyConfig > mbcs_
 
std::vector< rbd::MultiBodyGraph > mbgs_
 
unsigned int robotIndex_
 
unsigned int envIndex_
 
std::unordered_map< std::string, unsigned int > robotNameToIndex_
 Correspondance between robot name and index. More...
 
onRobotAddedSigT onRobotAdded_
 
onRobotRemovedSigT onRobotRemoved_
 

Friends

struct Robot
 

Iterators

These functions provide an iterator interface to Robots

using iterator = mc_rtc::SharedPtrVectorIterator< Robot >
 
using const_iterator = mc_rtc::SharedPtrVectorConstIterator< Robot >
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using size_type = std::vector< RobotPtr >::size_type
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 
reverse_iterator rbegin () noexcept
 
const_reverse_iterator rbegin () const noexcept
 
const_reverse_iterator crbegin () const noexcept
 
reverse_iterator rend () noexcept
 
const_reverse_iterator rend () const noexcept
 
const_reverse_iterator crend () const noexcept
 

Signals

These functions provide signals to events related to robot adding/removing

using onRobotAddedSigT = mc_rtc::Signal< std::string >
 
using onRobotAddedSlotT = onRobotAddedSigT::SlotT
 
using onRobotRemovedSigT = mc_rtc::Signal< std::string >
 
using onRobotRemovedSlotT = onRobotRemovedSigT::SlotT
 
onRobotAddedSigT::Proxy onRobotAdded () const noexcept
 
onRobotRemovedSigT::Proxy onRobotRemoved () const noexcept
 

Member Typedef Documentation

◆ const_iterator

◆ const_reverse_iterator

◆ iterator

◆ onRobotAddedSigT

This signal is emitted after a robot is added

The payload has the name of the newly added robot.

It is emitted after the robot has been added, i.e. robots(payload) has the newly added robot

◆ onRobotAddedSlotT

This signal is emitted after a robot is added

The payload has the name of the newly added robot.

It is emitted after the robot has been added, i.e. robots(payload) has the newly added robot

◆ onRobotRemovedSigT

This signal is emitted after a robot is added

The payload has the name of the newly added robot.

It is emitted after the robot has been added, i.e. robots(payload) has the newly added robot

◆ onRobotRemovedSlotT

This signal is emitted after a robot is added

The payload has the name of the newly added robot.

It is emitted after the robot has been added, i.e. robots(payload) has the newly added robot

◆ reverse_iterator

using mc_rbdyn::Robots::reverse_iterator = std::reverse_iterator<iterator>

◆ size_type

◆ value_type

Constructor & Destructor Documentation

◆ Robots() [1/3]

mc_rbdyn::Robots::Robots ( NewRobotsToken  )

◆ Robots() [2/3]

mc_rbdyn::Robots::Robots ( const Robots rhs)
protecteddelete

◆ Robots() [3/3]

mc_rbdyn::Robots::Robots ( Robots &&  robots)
protecteddelete

Member Function Documentation

◆ at() [1/2]

mc_rbdyn::Robot& mc_rbdyn::Robots::at ( size_t  idx)
inline

Access the robot at provided index

Provided for backward compatibility

◆ at() [2/2]

const mc_rbdyn::Robot& mc_rbdyn::Robots::at ( size_t  idx) const
inline

Access the robot at provided index (const)

Provided for backward compatibility

◆ begin() [1/2]

const_iterator mc_rbdyn::Robots::begin ( ) const
noexcept

◆ begin() [2/2]

iterator mc_rbdyn::Robots::begin ( )
noexcept

◆ cbegin()

const_iterator mc_rbdyn::Robots::cbegin ( ) const
noexcept

◆ cend()

const_iterator mc_rbdyn::Robots::cend ( ) const
noexcept

◆ copy()

void mc_rbdyn::Robots::copy ( mc_rbdyn::Robots out) const

Copy this instance into another instance

out will be cleared and robots loaded in this instance will be copied into out

◆ crbegin()

const_reverse_iterator mc_rbdyn::Robots::crbegin ( ) const
noexcept

◆ crend()

const_reverse_iterator mc_rbdyn::Robots::crend ( ) const
noexcept

◆ end() [1/2]

const_iterator mc_rbdyn::Robots::end ( ) const
noexcept

◆ end() [2/2]

iterator mc_rbdyn::Robots::end ( )
noexcept

◆ env() [1/2]

Robot& mc_rbdyn::Robots::env ( )

◆ env() [2/2]

const Robot& mc_rbdyn::Robots::env ( ) const

◆ envIndex()

unsigned int mc_rbdyn::Robots::envIndex ( ) const

Index of the first non-actuated robot (or the last actuated robot if no unactuated robot are loaded)

◆ hasRobot()

bool mc_rbdyn::Robots::hasRobot ( const std::string &  name) const

True if the given robot is part of this intance

◆ load() [1/3]

Robot& mc_rbdyn::Robots::load ( const RobotModule module,
const LoadRobotParameters params = {} 
)
inline

Load a single robot from a RobotModule

Use the name in the module to load the robot

◆ load() [2/3]

Robot& mc_rbdyn::Robots::load ( const std::string &  name,
const RobotModule module,
const LoadRobotParameters params = {} 
)

Load a single robot from a RobotModule with the provided parameters

Parameters
nameName of the new robot. Must be unique.
moduleThe RobotModule to fetch data from for this robot
params
See also
LoadRobotParameters for a description of the parameters
Exceptions
Ifa robot named <name> already exists

◆ load() [3/3]

void mc_rbdyn::Robots::load ( const std::vector< std::shared_ptr< RobotModule >> &  modules)

Load multiple robots from as many RobotModule instances

Parameters
modulesList of RobotModule to load the robots from

◆ loadFromUrdf()

Robot& mc_rbdyn::Robots::loadFromUrdf ( const std::string &  name,
const std::string &  urdf,
const rbd::parsers::ParserParameters &  parser_params = {},
const LoadRobotParameters load_params = {} 
)

Load a robot directly from URDF content with the given parameters

Parameters
nameName of the robot
urdfURDF content to be parsed
parser_paramsParameters used to parse the URDF
load_paramsParameters used to load the robot

◆ make() [1/2]

static RobotsPtr mc_rbdyn::Robots::make ( )
inlinestaticnoexcept

Create a new Robots instance

◆ make() [2/2]

template<class Deleter >
static RobotsPtr mc_rbdyn::Robots::make ( Deleter  deleter)
inlinestaticnoexcept

Create a new Robots instance with a custom deleter

◆ mbcs() [1/2]

std::vector<rbd::MultiBodyConfig>& mc_rbdyn::Robots::mbcs ( )

Give access to the underlying list of rbd::MultiBodyConfig objects

◆ mbcs() [2/2]

const std::vector<rbd::MultiBodyConfig>& mc_rbdyn::Robots::mbcs ( ) const

Give access to the underlying list of rbd::MultiBodyConfig objects (const)

◆ mbs() [1/2]

std::vector<rbd::MultiBody>& mc_rbdyn::Robots::mbs ( )

Give access to the underlying list of rbd::MultiBody objects

◆ mbs() [2/2]

const std::vector<rbd::MultiBody>& mc_rbdyn::Robots::mbs ( ) const

Give access to the underlying list of rbd::MultiBody objects (const)

◆ onRobotAdded()

onRobotAddedSigT::Proxy mc_rbdyn::Robots::onRobotAdded ( ) const
inlinenoexcept

This signal is emitted after a robot is added

The payload has the name of the newly added robot.

It is emitted after the robot has been added, i.e. robots(payload) has the newly added robot

◆ onRobotRemoved()

onRobotRemovedSigT::Proxy mc_rbdyn::Robots::onRobotRemoved ( ) const
inlinenoexcept

This signal is emitted when a robot is about to be removed

The payload is the name of the robot that is about to be removed

It is emitted before the robot is effectively removed, i.e. robots(payload) still has the robot about to be removed

◆ operator=() [1/2]

Robots& mc_rbdyn::Robots::operator= ( const Robots rhs)
protecteddelete

◆ operator=() [2/2]

Robots& mc_rbdyn::Robots::operator= ( Robots &&  robots)
protecteddelete

◆ operator[]() [1/2]

mc_rbdyn::Robot& mc_rbdyn::Robots::operator[] ( size_t  idx)
inline

Access via operator[]

Provided for backward compatibility

◆ operator[]() [2/2]

const mc_rbdyn::Robot& mc_rbdyn::Robots::operator[] ( size_t  idx) const
inline

Access via operator[] (const)

Provided for backward compatibility

◆ rbegin() [1/2]

const_reverse_iterator mc_rbdyn::Robots::rbegin ( ) const
noexcept

◆ rbegin() [2/2]

reverse_iterator mc_rbdyn::Robots::rbegin ( )
noexcept

◆ removeRobot() [1/2]

void mc_rbdyn::Robots::removeRobot ( const std::string &  name)

Load a single robot from a RobotModule with the provided parameters

Parameters
nameName of the new robot. Must be unique.
moduleThe RobotModule to fetch data from for this robot
params
See also
LoadRobotParameters for a description of the parameters
Exceptions
Ifa robot named <name> already exists

◆ removeRobot() [2/2]

void mc_rbdyn::Robots::removeRobot ( unsigned int  idx)

Load a single robot from a RobotModule with the provided parameters

Parameters
nameName of the new robot. Must be unique.
moduleThe RobotModule to fetch data from for this robot
params
See also
LoadRobotParameters for a description of the parameters
Exceptions
Ifa robot named <name> already exists

◆ rename()

void mc_rbdyn::Robots::rename ( const std::string &  oldName,
const std::string &  newName 
)

Rename an existing robot

Note
This is generally unsafe to do late into the controller's life

◆ rend() [1/2]

const_reverse_iterator mc_rbdyn::Robots::rend ( ) const
noexcept

◆ rend() [2/2]

reverse_iterator mc_rbdyn::Robots::rend ( )
noexcept

◆ reserve()

void mc_rbdyn::Robots::reserve ( size_type  new_cap)

Reserves space for a total number of new_cap Robots

Parameters
new_capReserve size

Has no effect if size > new_cap

◆ robot() [1/6]

Robot& mc_rbdyn::Robots::robot ( )

◆ robot() [2/6]

const Robot& mc_rbdyn::Robots::robot ( ) const

◆ robot() [3/6]

Robot& mc_rbdyn::Robots::robot ( const std::string &  name)

◆ robot() [4/6]

const Robot& mc_rbdyn::Robots::robot ( const std::string &  name) const

◆ robot() [5/6]

Robot& mc_rbdyn::Robots::robot ( size_t  idx)

◆ robot() [6/6]

const Robot& mc_rbdyn::Robots::robot ( size_t  idx) const

◆ robotCopy()

void mc_rbdyn::Robots::robotCopy ( const Robot robot,
const std::string &  copyName 
)

Load a single robot from a RobotModule with the provided parameters

Parameters
nameName of the new robot. Must be unique.
moduleThe RobotModule to fetch data from for this robot
params
See also
LoadRobotParameters for a description of the parameters
Exceptions
Ifa robot named <name> already exists

◆ robotIndex() [1/2]

unsigned int mc_rbdyn::Robots::robotIndex ( ) const

Index of the main robot

◆ robotIndex() [2/2]

unsigned int mc_rbdyn::Robots::robotIndex ( const std::string &  name) const

Index of a robot by name, throws if the robot does not exist

◆ robotModule()

const RobotModule& mc_rbdyn::Robots::robotModule ( size_t  idx) const

◆ robotModules()

const std::vector<mc_rbdyn::RobotModule>& mc_rbdyn::Robots::robotModules ( ) const

Give access to the underlying list of RobotModule objects

◆ robots() [1/2]

const mc_rbdyn::Robots& mc_rbdyn::Robots::robots ( ) const
inlinenoexcept

Give access to self for backward compatibility (const)

◆ robots() [2/2]

mc_rbdyn::Robots& mc_rbdyn::Robots::robots ( )
inlinenoexcept

Give access to self for backward compatibility

◆ size()

size_type mc_rbdyn::Robots::size ( ) const
noexcept

Number of robots

Returns
The number of robots

◆ updateIndexes()

void mc_rbdyn::Robots::updateIndexes ( )
protected

Friends And Related Function Documentation

◆ Robot

friend struct Robot
friend

Member Data Documentation

◆ envIndex_

unsigned int mc_rbdyn::Robots::envIndex_
protected

◆ mbcs_

std::vector<rbd::MultiBodyConfig> mc_rbdyn::Robots::mbcs_
protected

◆ mbgs_

std::vector<rbd::MultiBodyGraph> mc_rbdyn::Robots::mbgs_
protected

◆ mbs_

std::vector<rbd::MultiBody> mc_rbdyn::Robots::mbs_
protected

◆ onRobotAdded_

onRobotAddedSigT mc_rbdyn::Robots::onRobotAdded_
mutableprotected

◆ onRobotRemoved_

onRobotRemovedSigT mc_rbdyn::Robots::onRobotRemoved_
mutableprotected

◆ robot_modules_

RobotModuleVector mc_rbdyn::Robots::robot_modules_
protected

◆ robotIndex_

unsigned int mc_rbdyn::Robots::robotIndex_
protected

◆ robotNameToIndex_

std::unordered_map<std::string, unsigned int> mc_rbdyn::Robots::robotNameToIndex_
protected

Correspondance between robot name and index.

◆ robots_

std::vector<RobotPtr> mc_rbdyn::Robots::robots_
protected

The documentation for this struct was generated from the following file: