Simox  2.3.74.0
VirtualRobot::RobotConfig Class Reference

Data Structures

struct  Configuration
 

Public Member Functions

 RobotConfig (RobotWeakPtr robot, const std::string &name)
 
 RobotConfig (RobotWeakPtr robot, const std::string &name, const std::map< RobotNodePtr, float > &configs)
 
 RobotConfig (RobotWeakPtr robot, const std::string &name, const std::vector< Configuration > &configs)
 
 RobotConfig (RobotWeakPtr robot, const std::string &name, const std::vector< std::string > &robotNodes, const std::vector< float > &values)
 
 RobotConfig (RobotWeakPtr robot, const std::string &name, const std::vector< RobotNodePtr > &robotNodes, const std::vector< float > &values)
 
RobotConfigPtr clone (RobotPtr newRobot=RobotPtr())
 
std::string getName () const
 
void print () const
 
RobotPtr getRobot ()
 
bool setConfig (const Configuration &c)
 
bool setConfig (RobotNodePtr node, float value)
 
bool setConfig (const std::string &node, float value)
 
bool setTCP (const std::string &tcpName)
 
bool setTCP (RobotNodePtr tcp)
 
bool hasTCP () const
 
RobotNodePtr getTCP ()
 
bool setJointValues ()
 
bool setJointValues (RobotPtr r)
 
bool hasConfig (const std::string &name) const
 
float getConfig (const std::string &name) const
 
std::vector< RobotNodePtrgetNodes () const
 
std::map< std::string, float > getRobotNodeJointValueMap ()
 
std::string toXML (int tabs=0)
 

Static Public Member Functions

static std::string createXMLString (const std::map< std::string, float > &config, const std::string &name, const std::string &tcpName=std::string(), int tabs=0)
 

Protected Attributes

std::string name
 
std::map< RobotNodePtr, float > configs
 
RobotWeakPtr robot
 
RobotNodePtr tcpNode
 

Detailed Description

A RobotConfig is a set of joint values, associated with a robot.

Constructor & Destructor Documentation

◆ RobotConfig() [1/5]

VirtualRobot::RobotConfig::RobotConfig ( RobotWeakPtr  robot,
const std::string &  name 
)

Constructor

Parameters
robotThe associated robot.
nameA name, which identifies this object.

◆ RobotConfig() [2/5]

VirtualRobot::RobotConfig::RobotConfig ( RobotWeakPtr  robot,
const std::string &  name,
const std::map< RobotNodePtr, float > &  configs 
)

◆ RobotConfig() [3/5]

VirtualRobot::RobotConfig::RobotConfig ( RobotWeakPtr  robot,
const std::string &  name,
const std::vector< Configuration > &  configs 
)

◆ RobotConfig() [4/5]

VirtualRobot::RobotConfig::RobotConfig ( RobotWeakPtr  robot,
const std::string &  name,
const std::vector< std::string > &  robotNodes,
const std::vector< float > &  values 
)

◆ RobotConfig() [5/5]

VirtualRobot::RobotConfig::RobotConfig ( RobotWeakPtr  robot,
const std::string &  name,
const std::vector< RobotNodePtr > &  robotNodes,
const std::vector< float > &  values 
)

Member Function Documentation

◆ clone()

RobotConfigPtr VirtualRobot::RobotConfig::clone ( RobotPtr  newRobot = RobotPtr())

Creates a copy of this object with the given robot

Parameters
newRobotIf not given, the current robot is used. otherwise the newRobot is used.

◆ createXMLString()

std::string VirtualRobot::RobotConfig::createXMLString ( const std::map< std::string, float > &  config,
const std::string &  name,
const std::string &  tcpName = std::string(),
int  tabs = 0 
)
static

◆ getConfig()

float VirtualRobot::RobotConfig::getConfig ( const std::string &  name) const

Return the corresponding stored value. If no RobotNode with name is stored, 0.0f is returned.

◆ getName()

std::string VirtualRobot::RobotConfig::getName ( ) const

Returns name of this RobotConfig.

◆ getNodes()

std::vector< RobotNodePtr > VirtualRobot::RobotConfig::getNodes ( ) const

Return vector of all nodes that are covered by this RobotConfig.

◆ getRobot()

VirtualRobot::RobotPtr VirtualRobot::RobotConfig::getRobot ( )

The robot.

Returns
A shared_ptr instance of the internally stored weak pointer.

◆ getRobotNodeJointValueMap()

std::map< std::string, float > VirtualRobot::RobotConfig::getRobotNodeJointValueMap ( )

Returns map of RobotNodeNames with corresponding joint values.

◆ getTCP()

RobotNodePtr VirtualRobot::RobotConfig::getTCP ( )

◆ hasConfig()

bool VirtualRobot::RobotConfig::hasConfig ( const std::string &  name) const

Check if a configuration for a RobotNode with name is stored.

◆ hasTCP()

bool VirtualRobot::RobotConfig::hasTCP ( ) const

◆ print()

void VirtualRobot::RobotConfig::print ( ) const

◆ setConfig() [1/3]

bool VirtualRobot::RobotConfig::setConfig ( const Configuration c)

Appends a configuration to this instance.

Returns
True on success. False if robot is not present any more (may happen due to the use of weak pointers).

◆ setConfig() [2/3]

bool VirtualRobot::RobotConfig::setConfig ( RobotNodePtr  node,
float  value 
)

◆ setConfig() [3/3]

bool VirtualRobot::RobotConfig::setConfig ( const std::string &  node,
float  value 
)

◆ setJointValues() [1/2]

bool VirtualRobot::RobotConfig::setJointValues ( )

Apply the stored configurations to the corresponding robot. RobotNodes that are not stored in this RobotConfig are not affected.

Returns
True on success. False if robot is not present any more (may happen due to the use of weak pointers).

◆ setJointValues() [2/2]

bool VirtualRobot::RobotConfig::setJointValues ( RobotPtr  r)

Usually setJointValues() is sufficient for applying the joint values. But in some cases one might want to apply the joint values to a cloned robot. Therefore this method can be used.

◆ setTCP() [1/2]

bool VirtualRobot::RobotConfig::setTCP ( const std::string &  tcpName)

◆ setTCP() [2/2]

bool VirtualRobot::RobotConfig::setTCP ( RobotNodePtr  tcp)

◆ toXML()

std::string VirtualRobot::RobotConfig::toXML ( int  tabs = 0)

Create an XML string that defines this object.

Field Documentation

◆ configs

std::map< RobotNodePtr, float > VirtualRobot::RobotConfig::configs
protected

◆ name

std::string VirtualRobot::RobotConfig::name
protected

◆ robot

RobotWeakPtr VirtualRobot::RobotConfig::robot
protected

◆ tcpNode

RobotNodePtr VirtualRobot::RobotConfig::tcpNode
protected