ControlDevice Class Reference

The ControlDevice class represents a logical unit accepting commands via its JointControllers. More...

#include <RobotAPI/components/units/RobotUnit/Devices/ControlDevice.h>

+ Inheritance diagram for ControlDevice:

Public Member Functions

 ControlDevice (const std::string &name)
 Create a ControlDevice with the given name.
 
const std::vector< std::string > & getControlModes () const
 
JointController * getJointController (const std::string &mode)
 
const JointController * getJointController (const std::string &mode) const
 
JointController * getJointController (std::size_t i)
 
const JointController * getJointController (std::size_t i) const
 
std::vector< const JointController * > getJointControllers () const
 
std::map< std::string, std::string > getJointControllerToTargetTypeNameMap () const
 
JointController * getJointEmergencyStopController ()
 
JointController * getJointStopMovementController ()
 
RobotUnitModule::Devices * getOwner () const
 
bool hasJointController (const std::string &mode) const
 
JointController * rtGetActiveJointController ()
 
const std::vector< JointController * > & rtGetJointControllers ()
 
JointController * rtGetJointEmergencyStopController ()
 
JointController * rtGetJointStopMovementController ()
 
void rtRun (const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration)
 runs the active Joint Controller and write the target values into the control device
 
virtual void rtSetActiveJointController (JointController *jointCtrl)
 Activates the given JointController for this device.
 
virtual void rtWriteTargetValues (const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration)
 This is a hook for implementations to write the setpoints to a bus.
 
- Public Member Functions inherited from DeviceBase
 DeviceBase (const std::string &name)
 Create a Device with the given name.
 
const std::string & getDeviceName () const
 
const std::set< std::string > & getTags () const
 
virtual bool hasError ()
 
bool hasTag (const std::string &tag) const
 
const char * rtGetDeviceName () const
 
virtual ~DeviceBase ()=default
 

Static Public Attributes

static const ControlDevicePtr NullPtr {nullptr}
 A static const nullptr in case a const ref to a nullptr needs to be returned.
 

Protected Member Functions

void addJointController (JointController *jointCtrl)
 adds the Joint controller to this ControlDevice
 
ControlTargetBase::ControlDeviceAccessToken getControlTargetAccessToken () const
 
- Protected Member Functions inherited from DeviceBase
void addDeviceTag (const std::string &tag)
 adds the given tag to the Device
 

Friends

class RobotUnitModule::Devices
 

Detailed Description

The ControlDevice class represents a logical unit accepting commands via its JointControllers.

It holds a set of JointControllers with different Controll modes. It always has a JointController with mode ControlModes::EmergencyStop which is used in case of an error. It always has a JointController with mode ControlModes::StopMovement which is used when the controled device should stop any movement.

It holds a set of tags. These tags are used by different components to create default controllers, check for abilities or present output to the user.

Constructor & Destructor Documentation

◆ ControlDevice()

ControlDevice ( const std::string & name)
inline

Create a ControlDevice with the given name.

Member Function Documentation

◆ addJointController()

void addJointController ( JointController * jointCtrl)
protected

adds the Joint controller to this ControlDevice

Exceptions
std::logic_errorif the JointController was already added to a ControlDevice
std::invalid_argumentif a JointController with the same control mode was already added to this device

◆ getControlModes()

const std::vector< std::string > & getControlModes ( ) const
inline

◆ getControlTargetAccessToken()

ControlTargetBase::ControlDeviceAccessToken getControlTargetAccessToken ( ) const
inlineprotected

◆ getJointController() [1/4]

JointController * getJointController ( const std::string & mode)
inline
Returns
the JointController for the given mode of this ControlDevice (or nullptr if there is no controller for this mode)

◆ getJointController() [2/4]

const JointController * getJointController ( const std::string & mode) const
inline

◆ getJointController() [3/4]

JointController * getJointController ( std::size_t i)
inline

◆ getJointController() [4/4]

const JointController * getJointController ( std::size_t i) const
inline

◆ getJointControllers()

std::vector< const JointController * > getJointControllers ( ) const
inline

◆ getJointControllerToTargetTypeNameMap()

std::map< std::string, std::string > getJointControllerToTargetTypeNameMap ( ) const

◆ getJointEmergencyStopController()

JointController * getJointEmergencyStopController ( )
Returns
the jointEmergencyStopController of this ControlDevice

◆ getJointStopMovementController()

JointController * getJointStopMovementController ( )
Returns
the jointStopMovementController of this ControlDevice

◆ getOwner()

RobotUnitModule::Devices * getOwner ( ) const

◆ hasJointController()

bool hasJointController ( const std::string & mode) const
inline

◆ rtGetActiveJointController()

JointController * rtGetActiveJointController ( )
inline
Returns
the active JointController of this ControlDevice

◆ rtGetJointControllers()

const std::vector< JointController * > & rtGetJointControllers ( )
inline
Returns
all JointControllers of this ControlDevice

◆ rtGetJointEmergencyStopController()

JointController * rtGetJointEmergencyStopController ( )
inline
Returns
the jointEmergencyStopController of this ControlDevice

◆ rtGetJointStopMovementController()

JointController * rtGetJointStopMovementController ( )
inline
Returns
the jointStopMovementController of this ControlDevice

◆ rtRun()

void rtRun ( const IceUtil::Time & sensorValuesTimestamp,
const IceUtil::Time & timeSinceLastIteration )

runs the active Joint Controller and write the target values into the control device

Parameters
sensorValuesTimestamp
timeSinceLastIteration
See also
writeTargetValues

◆ rtSetActiveJointController()

void rtSetActiveJointController ( JointController * jointCtrl)
virtual

Activates the given JointController for this device.

Exceptions
std::logic_errorif the Joint controller does not belong to this ControlDevice

Reimplemented in JointSimulationDevice.

◆ rtWriteTargetValues()

virtual void rtWriteTargetValues ( const IceUtil::Time & sensorValuesTimestamp,
const IceUtil::Time & timeSinceLastIteration )
inlinevirtual

This is a hook for implementations to write the setpoints to a bus.

Parameters
sensorValuesTimestampThe timestamp of the current SensorValues
timeSinceLastIterationThe time delta between the last two updates of SensorValues

Friends And Related Symbol Documentation

◆ RobotUnitModule::Devices

friend class RobotUnitModule::Devices
friend

Member Data Documentation

◆ NullPtr

const ControlDevicePtr NullPtr {nullptr}
static

A static const nullptr in case a const ref to a nullptr needs to be returned.


The documentation for this class was generated from the following files: