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. More...
 
const std::vector< std::string > & getControlModes () const
 
JointControllergetJointController (const std::string &mode)
 
const JointControllergetJointController (const std::string &mode) const
 
JointControllergetJointController (std::size_t i)
 
const JointControllergetJointController (std::size_t i) const
 
std::vector< const JointController * > getJointControllers () const
 
std::map< std::string, std::string > getJointControllerToTargetTypeNameMap () const
 
JointControllergetJointEmergencyStopController ()
 
JointControllergetJointStopMovementController ()
 
RobotUnitModule::DevicesgetOwner () const
 
bool hasJointController (const std::string &mode) const
 
JointControllerrtGetActiveJointController ()
 
const std::vector< JointController * > & rtGetJointControllers ()
 
JointControllerrtGetJointEmergencyStopController ()
 
JointControllerrtGetJointStopMovementController ()
 
void rtRun (const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration)
 runs the active Joint Controller and write the target values into the control device More...
 
virtual void rtSetActiveJointController (JointController *jointCtrl)
 Activates the given JointController for this device. More...
 
virtual void rtWriteTargetValues (const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration)
 This is a hook for implementations to write the setpoints to a bus. More...
 
- Public Member Functions inherited from DeviceBase
 DeviceBase (const std::string &name)
 Create a Device with the given name. More...
 
const std::string & getDeviceName () const
 
const std::set< std::string > & getTags () const
 
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. More...
 

Protected Member Functions

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

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.

Definition at line 63 of file ControlDevice.h.

Constructor & Destructor Documentation

◆ ControlDevice()

ControlDevice ( const std::string &  name)
inline

Create a ControlDevice with the given name.

Definition at line 70 of file ControlDevice.h.

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

Definition at line 93 of file ControlDevice.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getControlModes()

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

Definition at line 217 of file ControlDevice.h.

◆ getControlTargetAccessToken()

ControlTargetBase::ControlDeviceAccessToken getControlTargetAccessToken ( ) const
inlineprotected

Definition at line 133 of file ControlDevice.h.

◆ 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)

Definition at line 187 of file ControlDevice.h.

◆ getJointController() [2/4]

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

Definition at line 193 of file ControlDevice.h.

◆ getJointController() [3/4]

JointController * getJointController ( std::size_t  i)
inline

Definition at line 199 of file ControlDevice.h.

◆ getJointController() [4/4]

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

Definition at line 205 of file ControlDevice.h.

◆ getJointControllers()

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

Definition at line 181 of file ControlDevice.h.

◆ getJointControllerToTargetTypeNameMap()

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

Definition at line 157 of file ControlDevice.cpp.

◆ getJointEmergencyStopController()

JointController * getJointEmergencyStopController ( )
Returns
the jointEmergencyStopController of this ControlDevice

Definition at line 32 of file ControlDevice.cpp.

+ Here is the call graph for this function:

◆ getJointStopMovementController()

JointController * getJointStopMovementController ( )
Returns
the jointStopMovementController of this ControlDevice

Definition at line 44 of file ControlDevice.cpp.

+ Here is the call graph for this function:

◆ getOwner()

RobotUnitModule::Devices * getOwner ( ) const

Definition at line 151 of file ControlDevice.cpp.

◆ hasJointController()

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

Definition at line 211 of file ControlDevice.h.

◆ rtGetActiveJointController()

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

Definition at line 169 of file ControlDevice.h.

+ Here is the caller graph for this function:

◆ rtGetJointControllers()

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

Definition at line 175 of file ControlDevice.h.

+ Here is the caller graph for this function:

◆ rtGetJointEmergencyStopController()

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

Definition at line 157 of file ControlDevice.h.

+ Here is the caller graph for this function:

◆ rtGetJointStopMovementController()

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

Definition at line 163 of file ControlDevice.h.

+ Here is the caller graph for this function:

◆ 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

Definition at line 83 of file ControlDevice.cpp.

+ Here is the call graph for this function:

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

Definition at line 56 of file ControlDevice.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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

Definition at line 115 of file ControlDevice.h.

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ RobotUnitModule::Devices

friend class RobotUnitModule::Devices
friend

Definition at line 139 of file ControlDevice.h.

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.

Definition at line 67 of file ControlDevice.h.


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