Robot Hardware Interface and Resource Manager.
This class provides a standardized interface to a set of robot hardware interfaces to the controller manager. It performs resource conflict checking for a given set of controllers and maintains a map of hardware interfaces. It is meant to be used as a base class for abstracting custom robot hardware.
The hardware interface map (interfaces_) is a 1-to-1 map between the names of interface types derived from HardwareInterface and instances of those interface types.
A class derived from this base interface represents a robot and stores the state of the robot's hardware resources (joints, sensors, actuators) and outgoing commands in its data member arrays. The names of these members should provide semantic meaning (e.g. pos, vel, eff, cmd). Commands from controllers are populated by the controller's update method, (controller_interface::ControllerBase::update()). For each resource a JointStateHandle (for read only joints), JointHandle (for read and write joints) or custom handle can be used which is registered (hardware_interface::ResourceManager::registerHandle) with one of the robot's interface types. Note that JointStateHandle should be preferred in case only reading from the joint is required because it doesn't create conflicts between controllers. For read-only joints it is possible to use JointStateInterface and for joints that accept commands and provide feedback (read and write) JointCommandInterface can be used or one of its derived interfaces (e.g. PositionJointInterface). Another option is to define and use custom ones. The interfaces themselfes are then registered (registerInterface) with the derived robot class. The registration (registerInterface) of interfaces can be done either in the constructor or init of a custom robot hardware class.
Definition at line 78 of file robot_hw.h.
Read data from the robot hardware.
The read method is part of the control loop cycle (read, update, write) and is used to populate the robot state from the robot's hardware resources (joints, sensors, actuators). This method should be called before controller_manager::ControllerManager::update() and write.
- The name read refers to reading state from the hardware. This complements write, which refers to writing commands to the hardware.
Querying WallTime inside read is not realtime safe. The parameters time and period make it possible to inject time from a realtime source.
|time||The current time |
|period||The time passed since the last call to read |
Definition at line 206 of file robot_hw.h.
Write commands to the robot hardware.
The write method is part of the control loop cycle (read, update, write) and is used to send out commands to the robot's hardware resources (joints, actuators). This method should be called after read and controller_manager::ControllerManager::update.
- The name write refers to writing commands to the hardware. This complements read, which refers to reading state from the hardware.
Querying WallTime inside write is not realtime safe. The parameters time and period make it possible to inject time from a realtime source.
|time||The current time |
|period||The time passed since the last call to write |
Definition at line 224 of file robot_hw.h.