45 handle_data.
name = transmission_info.
name_;
52 if (!act_state_data_ok) {
return false;}
57 if (!act_cmd_data_ok) {
return false;}
67 if (!jnt_data_ok) {
return false;}
73 if (!jnt_state_data_ok) {
return false;}
78 if (!jnt_cmd_data_ok) {
return false;}
91 : robot_hw_ptr_(robot_hw),
92 robot_transmissions_ptr_(robot_transmissions)
96 "transmission_interface::TransmissionLoader"));
100 "transmission_interface::RequisiteProvider"));
103 if (!robot_hw) {
throw std::invalid_argument(
"Invalid robot hardware pointer.");}
104 if (!robot_transmissions) {
throw std::invalid_argument(
"Invalid robot transmissions pointer.");}
113 std::vector<TransmissionInfo> infos;
114 if (!parser.
parse(urdf, infos)) {
return false;}
127 for (
const auto& info : transmission_info_vec)
129 if (!
load(info)) {
return false;}
141 transmission = transmission_loader->load(transmission_info);
142 if (!transmission) {
return false;}
147 "'. Unsupported type '" << transmission_info.
type_ <<
"'.\n" << ex.what());
152 assert(!transmission_info.
joints_.empty() && !transmission_info.
joints_.front().hardware_interfaces_.empty());
153 const std::vector<std::string>& hw_ifaces_ref = transmission_info.
joints_.front().hardware_interfaces_;
154 for (
const auto& jnt_info : transmission_info.
joints_)
157 if (hw_ifaces_ref.size() != jnt_info.hardware_interfaces_.size() ||
158 !std::is_permutation(hw_ifaces_ref.begin(), hw_ifaces_ref.end(),
159 jnt_info.hardware_interfaces_.begin()))
162 "Failed to load transmission '" << transmission_info.
name_ <<
163 "'. It has joints with different hardware interfaces. This is currently unsupported.");
169 bool has_at_least_one_hw_iface =
false;
170 for (
const auto& hw_iface : hw_ifaces_ref)
176 if (!req_provider) {
continue;}
181 "' hardware interface for transmission '" << transmission_info.
name_ <<
182 "'.\n" << ex.what());
186 const bool load_ok = req_provider->loadTransmissionMaps(transmission_info,
loader_data_, transmission);
187 if (load_ok) {has_at_least_one_hw_iface =
true;}
191 if (!has_at_least_one_hw_iface)
194 "'. It contains no valid hardware interfaces.");
RobotTransmissions * robot_transmissions_ptr_
ActuatorData act_cmd_data
TransmissionSharedPtr transmission
RequisiteProviderClassLoaderPtr req_provider_loader_
static bool parse(const std::string &urdf_string, std::vector< TransmissionInfo > &transmissions)
Parses the transmission elements of a URDF.
JointInterfaces joint_interfaces
hardware_interface::RobotHW * robot_hw
Lifecycle is externally controlled (ie. hardware abstraction)
Parse all transmissions specified in a URDF.
#define ROS_ERROR_STREAM_NAMED(name, args)
hardware_interface::RobotHW * robot_hw_ptr_
TransmissionInterfaceLoader(hardware_interface::RobotHW *robot_hw, RobotTransmissions *robot_transmissions)
TransmissionClassLoaderPtr transmission_class_loader_
std::shared_ptr< TransmissionLoader > TransmissionLoaderSharedPtr
Contains semantic info about a given transmission loaded from XML (URDF)
Robot transmissions interface.
bool load(const std::string &urdf)
Load all transmissions in a URDF.
virtual bool updateJointInterfaces(const TransmissionInfo &transmission_info, hardware_interface::RobotHW *robot_hw, JointInterfaces &joint_interfaces, RawJointDataMap &raw_joint_data_map)=0
Update a robot's joint interfaces with joint information contained in a transmission.
virtual bool getActuatorCommandData(const TransmissionInfo &transmission_info, hardware_interface::RobotHW *robot_hw, ActuatorData &act_cmd_data)=0
virtual bool getActuatorStateData(const TransmissionInfo &transmission_info, hardware_interface::RobotHW *robot_hw, ActuatorData &act_state_data)=0
RawJointDataMap raw_joint_data_map
pluginlib::ClassLoader< TransmissionLoader > TransmissionClassLoader
pluginlib::ClassLoader< RequisiteProvider > RequisiteProviderClassLoader
virtual bool registerTransmission(TransmissionLoaderData &loader_data, TransmissionHandleData &handle_data)=0
std::shared_ptr< RequisiteProvider > RequisiteProviderPtr
TransmissionLoaderData loader_data_
RobotTransmissions * robot_transmissions
Lifecycle is externally controlled (ie. hardware abstraction)
std::shared_ptr< Transmission > TransmissionSharedPtr
virtual bool getJointStateData(const TransmissionInfo &transmission_info, const RawJointDataMap &raw_joint_data_map, JointData &jnt_state_data)=0
bool loadTransmissionMaps(const TransmissionInfo &transmission_info, TransmissionLoaderData &loader_data, TransmissionSharedPtr transmission)
std::vector< TransmissionSharedPtr > transmission_data
std::vector< JointInfo > joints_
virtual bool getJointCommandData(const TransmissionInfo &transmission_info, const RawJointDataMap &raw_joint_data_map, JointData &jnt_cmd_data)=0
#define ROS_WARN_STREAM_NAMED(name, args)
ActuatorData act_state_data