|
int | getDeviceId () |
|
std::string | getDeviceNamespace () |
|
virtual std::vector< std::string > | getJoints ()=0 |
| This pure virtual method has to be redefined by derived classes to return the controlled joint names vector. More...
|
|
bool | init (ros::NodeHandle &root_nh, ros::NodeHandle &robot_hw_nh) override |
| The init function is called to initialize the RobotHW from a non-realtime thread. More...
|
|
| qbDeviceHW (qb_device_transmission_interface::TransmissionPtr transmission, const std::vector< std::string > &actuators, const std::vector< std::string > &joints) |
| Initialize HW resources and interfaces, and wait until it is initialized from the Communication Handler. More...
|
|
void | read (const ros::Time &time, const ros::Duration &period) override |
| Read actuator state from the hardware, propagate it to joint states and publish the whole device state to a namespaced "~state" topic (each instance of qbDeviceHW should publish on its own topic). More...
|
|
void | write (const ros::Time &time, const ros::Duration &period) override |
| Enforce joint limits for all registered joint limit interfaces, propagate joint commands to actuators, and send actuator commands to the hardware. More...
|
|
| ~qbDeviceHW () override |
| Deactivate motors and stop the async spinner. More...
|
|
virtual bool | checkForConflict (const std::list< ControllerInfo > &info) const |
|
virtual bool | checkForConflict (const std::list< ControllerInfo > &info) const |
|
virtual void | doSwitch (const std::list< ControllerInfo > &, const std::list< ControllerInfo > &) |
|
virtual void | doSwitch (const std::list< ControllerInfo > &, const std::list< ControllerInfo > &) |
|
virtual bool | prepareSwitch (const std::list< ControllerInfo > &start_list, const std::list< ControllerInfo > &stop_list) |
|
virtual bool | prepareSwitch (const std::list< ControllerInfo > &start_list, const std::list< ControllerInfo > &stop_list) |
|
| RobotHW () |
|
virtual | ~RobotHW () |
|
T * | get () |
|
std::vector< std::string > | getInterfaceResources (std::string iface_type) const |
|
std::vector< std::string > | getNames () const |
|
void | registerInterface (T *iface) |
|
void | registerInterfaceManager (InterfaceManager *iface_man) |
|
|
virtual int | activateMotors () |
| Call the service to activate the device motors and wait for the response. More...
|
|
virtual int | deactivateMotors () |
| Call the service to deactivate the device motors and wait for the response. More...
|
|
virtual std::string | getInfo () |
| Call the service to retrieve the printable configuration setup of the device and wait for the response. More...
|
|
virtual int | getMeasurements (std::vector< double > &positions, std::vector< double > ¤ts, ros::Time &stamp) |
| Call the service to retrieve device measurements (both positions and currents) and wait for the response. More...
|
|
virtual int | initializeDevice () |
| Call the service to initialize the device with parameters from the Communication Handler and wait for the response. More...
|
|
virtual int | setCommands (const std::vector< double > &commands) |
| Call the service to send reference commands to the device and wait for the response. More...
|
|
|
std::vector< std::string > | addNamespacePrefix (const std::vector< std::string > &vector) |
| Add the namespace prefix stored in the private namespace_ to all the elements of the given vector. More...
|
|
void | initializeServicesAndWait () |
| Subscribe to all the services advertised by the Communication Handler and wait until all the services are properly advertised. More...
|
|
void | publish () |
| Construct a qb_device_msgs::StateStamped message of the whole device state with the data retrieved during the read() and publish it to a namespaced "~state" topic. More...
|
|
void | resetServicesAndWait (const bool &reinitialize_device=true) |
| Re-subscribe to all the services advertised by the Communication Handler and wait until all the services are properly advertised. More...
|
|
void | waitForInitialization () |
| Wait until the device is initialized. More...
|
|
void | waitForServices () |
| Wait until all the services advertised by the Communication Handler are active, then reinitialize the device to avoid disconnection problems. More...
|
|
The qbrobotics Device HardWare interface extends the hardware_interface::RobotHW
by providing all the common structures to manage the communication with both the qbhand and qbmove devices.
The few differences among them are implemented in the two device-specific derived classes, qbHandHW
and qbMoveHW
. In detail, this class initialize all the ROS service clients needed to talk to the Communication Handler which is the intermediary for the serial communication with the physical devices. The core part is given by the two overridden function of the hardware_interface::RobotHW
base class, i.e. read() and write(), which are meant to be used in the control loop.
- See also
- qb_hand_hardware_interface::qbHandHW, qb_move_hardware_interface::qbMoveHW
Definition at line 64 of file qb_device_hardware_interface.h.
Initialize HW resources and interfaces, and wait until it is initialized from the Communication Handler.
If the Communication Handler is not running, wait forever. The three given parameters are strictly device-dependent, i.e. the qbhand specific transmission
differs from the qbmove one, and the actuator and joint names depend not only on the device type, but also on the whole robot_description
extracted from the URDF model. For example each qbmove of a given chain has its own namespace to avoid name clashes.
- Parameters
-
transmission | The shared pointer to the current transmission derived from transmission_interface::Transmission . |
actuators | The actuator names in the robot_description . |
joints | The joint names in the robot_description . |
- See also
- initializeInterfaces(), initializeResources(), waitForInitialization(), waitForServices()
Definition at line 32 of file qb_device_hardware_interface.cpp.
The init function is called to initialize the RobotHW from a non-realtime thread.
In particular it build the HW resources, retrieve the robot_description
from the Parameter Server, and initialize the hardware_interface
, the joint_limit_interface
, and the transmission_interface
. If everything goes as expected it also initialize the current device with the parameters retrieve from the Communication Handler.
- Parameters
-
root_nh | A NodeHandle in the root of the caller namespace. |
robot_hw_nh | A NodeHandle in the namespace from which the RobotHW should read its configuration. |
- Returns
true
on success.
Reimplemented from hardware_interface::RobotHW.
Definition at line 139 of file qb_device_hardware_interface.cpp.
int qbDeviceHW::initializeDevice |
( |
| ) |
|
|
protectedvirtual |
Call the service to initialize the device with parameters from the Communication Handler and wait for the response.
If the initializaation succeed, store the device parameters received, e.g. position_limits
. It can additionally activate motors during the initialization process, if specified in the Parameter Server.
- Returns
0
on success.
- See also
- waitForInitialization()
Definition at line 171 of file qb_device_hardware_interface.cpp.