Simox  2.3.49
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

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

Constructor

Parameters
robotThe associated robot.
nameA name, which identifies this object.
VirtualRobot::RobotConfig::RobotConfig ( RobotWeakPtr  robot,
const std::string &  name,
const std::map< RobotNodePtr, float > &  configs 
)
VirtualRobot::RobotConfig::RobotConfig ( RobotWeakPtr  robot,
const std::string &  name,
const std::vector< Configuration > &  configs 
)
VirtualRobot::RobotConfig::RobotConfig ( RobotWeakPtr  robot,
const std::string &  name,
const std::vector< std::string > &  robotNodes,
const std::vector< float > &  values 
)
VirtualRobot::RobotConfig::RobotConfig ( RobotWeakPtr  robot,
const std::string &  name,
const std::vector< RobotNodePtr > &  robotNodes,
const std::vector< float > &  values 
)

Member Function Documentation

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.
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
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.

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

Returns name of this RobotConfig.

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

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

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

The robot.

Returns
A shared_ptr instance of the internally stored weak pointer.
std::map< std::string, float > VirtualRobot::RobotConfig::getRobotNodeJointValueMap ( )

Returns map of RobotNodeNames with corresponding joint values.

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

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

bool VirtualRobot::RobotConfig::hasTCP ( ) const
void VirtualRobot::RobotConfig::print ( ) const
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).
bool VirtualRobot::RobotConfig::setConfig ( RobotNodePtr  node,
float  value 
)
bool VirtualRobot::RobotConfig::setConfig ( const std::string &  node,
float  value 
)
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).
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.

bool VirtualRobot::RobotConfig::setTCP ( const std::string &  tcpName)
bool VirtualRobot::RobotConfig::setTCP ( RobotNodePtr  tcp)
std::string VirtualRobot::RobotConfig::toXML ( int  tabs = 0)

Create an XML string that defines this object.

Field Documentation

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