Public Member Functions | Private Types | Private Attributes | List of all members
transmission_interface::TransmissionInterfaceLoader Class Reference

Class for loading transmissions from a URDF description into ros_control interfaces. More...

#include <transmission_interface_loader.h>

Public Member Functions

TransmissionLoaderDatagetData ()
 
bool load (const std::string &urdf)
 Load all transmissions in a URDF. More...
 
bool load (const std::vector< TransmissionInfo > &transmission_info_vec)
 Load all transmissions contained in a vector of TransmissionInfo instances. More...
 
bool load (const TransmissionInfo &transmission_info)
 Load a single transmission. More...
 
 TransmissionInterfaceLoader (hardware_interface::RobotHW *robot_hw, RobotTransmissions *robot_transmissions)
 

Private Types

typedef pluginlib::ClassLoader< RequisiteProviderRequisiteProviderClassLoader
 
typedef std::shared_ptr< RequisiteProviderClassLoaderRequisiteProviderClassLoaderPtr
 
typedef std::shared_ptr< RequisiteProviderRequisiteProviderPtr
 
typedef pluginlib::ClassLoader< TransmissionLoaderTransmissionClassLoader
 
typedef std::shared_ptr< TransmissionClassLoaderTransmissionClassLoaderPtr
 

Private Attributes

TransmissionLoaderData loader_data_
 
RequisiteProviderClassLoaderPtr req_provider_loader_
 
hardware_interface::RobotHWrobot_hw_ptr_
 
RobotTransmissionsrobot_transmissions_ptr_
 
TransmissionClassLoaderPtr transmission_class_loader_
 

Detailed Description

Class for loading transmissions from a URDF description into ros_control interfaces.

This is the entry point for automatic transmission parsing. An instance of this class is initialized with pointers to hardware and transmission abstraction interfaces, and calling the load() methods populates these interfaces.

The input information needed for automatically loading transmissions are:

The output after successful transmission loading is:

Important note: This class is stateful, and stores internally the raw data of the generated joint interfaces, so keep instances alive as long as these interfaces are used.

class FooRobot : public hardware_interface::RobotHW
{
public:
void read(ros::Time time, ros::Duration period);
void write(ros::Time time, ros::Duration period);
bool init()
{
// Populate robot_hw with actuator interfaces (e.g., EffortActuatorInterface)
// This is hardware-specific, and not detailed here
// ...
// Initialize transmission loader
try
{
transmission_loader_.reset(new TransmissionInterfaceLoader(this, &robot_transmissions));
}
catch(const std::invalid_argument& ex)
{
ROS_ERROR_STREAM("Failed to create transmission interface loader. " << ex.what());
return false;
}
{
ROS_ERROR_STREAM("Failed to create transmission interface loader. " << ex.what());
return false;
}
catch(...)
{
ROS_ERROR_STREAM("Failed to create transmission interface loader. ");
return false;
}
std::string robot_description;
// ...load URDF from parameter server or file
// Perform actual transmission loading
if (!transmission_loader_->load(robot_description)) {return false;}
// We can now query for any of the created interfaces, for example:
// robot_transmissions_.get<ActuatorToJointStateInterface>();
// this->get<JointStateInterface>();
return true;
}
private:
RobotTransmissions robot_transmissions_;
std::unique_ptr<TransmissionInterfaceLoader> transmission_loader_;
};

Definition at line 317 of file transmission_interface_loader.h.

Member Typedef Documentation

◆ RequisiteProviderClassLoader

Definition at line 362 of file transmission_interface_loader.h.

◆ RequisiteProviderClassLoaderPtr

Definition at line 363 of file transmission_interface_loader.h.

◆ RequisiteProviderPtr

Definition at line 365 of file transmission_interface_loader.h.

◆ TransmissionClassLoader

Definition at line 360 of file transmission_interface_loader.h.

◆ TransmissionClassLoaderPtr

Definition at line 361 of file transmission_interface_loader.h.

Constructor & Destructor Documentation

◆ TransmissionInterfaceLoader()

transmission_interface::TransmissionInterfaceLoader::TransmissionInterfaceLoader ( hardware_interface::RobotHW robot_hw,
RobotTransmissions robot_transmissions 
)
Parameters
robot_hwRobot hardware abstraction already populated with actuator interfaces.
robot_transmissionsRobot transmissions abstraction.

Definition at line 89 of file transmission_interface_loader.cpp.

Member Function Documentation

◆ getData()

TransmissionLoaderData* transmission_interface::TransmissionInterfaceLoader::getData ( )
inline

Definition at line 357 of file transmission_interface_loader.h.

◆ load() [1/3]

bool transmission_interface::TransmissionInterfaceLoader::load ( const std::string &  urdf)

Load all transmissions in a URDF.

This method adds new joint and transmission interfaces to the RobotHW and RobotTransmissions instances passed in the constructor, respectively.

Parameters
urdfRobot description containing a transmission specification.
Returns
True if successful.

Definition at line 110 of file transmission_interface_loader.cpp.

◆ load() [2/3]

bool transmission_interface::TransmissionInterfaceLoader::load ( const std::vector< TransmissionInfo > &  transmission_info_vec)

Load all transmissions contained in a vector of TransmissionInfo instances.

This method adds new joint and transmission interfaces to the RobotHW and RobotTransmissions instances passed in the constructor, respectively.

Parameters
transmission_info_vecVector of TransmissionInfo instances.
Returns
True if successful.

Definition at line 125 of file transmission_interface_loader.cpp.

◆ load() [3/3]

bool transmission_interface::TransmissionInterfaceLoader::load ( const TransmissionInfo transmission_info)

Load a single transmission.

This method adds new joint and transmission interfaces to the RobotHW and RobotTransmissions instances passed in the constructor, respectively.

Parameters
transmission_infoSpecification of a single transmission.
Returns
True if successful.

Definition at line 134 of file transmission_interface_loader.cpp.

Member Data Documentation

◆ loader_data_

TransmissionLoaderData transmission_interface::TransmissionInterfaceLoader::loader_data_
private

Definition at line 374 of file transmission_interface_loader.h.

◆ req_provider_loader_

RequisiteProviderClassLoaderPtr transmission_interface::TransmissionInterfaceLoader::req_provider_loader_
private

Definition at line 368 of file transmission_interface_loader.h.

◆ robot_hw_ptr_

hardware_interface::RobotHW* transmission_interface::TransmissionInterfaceLoader::robot_hw_ptr_
private

Definition at line 371 of file transmission_interface_loader.h.

◆ robot_transmissions_ptr_

RobotTransmissions* transmission_interface::TransmissionInterfaceLoader::robot_transmissions_ptr_
private

Definition at line 372 of file transmission_interface_loader.h.

◆ transmission_class_loader_

TransmissionClassLoaderPtr transmission_interface::TransmissionInterfaceLoader::transmission_class_loader_
private

Definition at line 367 of file transmission_interface_loader.h.


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


transmission_interface
Author(s): Adolfo Rodriguez Tsouroukdissian
autogenerated on Sun May 10 2020 03:14:56