38 DefaultRobotHWSim(), fake_state_(NULL)
44 const std::string new_joint_name)
const 46 if (items->size() > 0)
48 items->at(0).name_ = new_joint_name;
50 std::string xml_data = items->at(0).xml_element_;
51 for (
size_t index = xml_data.find(old_joint_name, 0); std::string::npos != index;
52 index = xml_data.find(old_joint_name, index))
54 xml_data.replace(index, old_joint_name.length(), new_joint_name);
55 index += new_joint_name.length();
57 items->at(0).xml_element_ = xml_data;
63 for (
size_t i = 0; i < transmissions->size(); ++i)
67 if (transmissions->at(i).joints_.size() > 0)
69 const std::string joint_name = transmissions->at(i).joints_[0].name_;
70 std::string second_joint_name = joint_name;
71 second_joint_name[second_joint_name.size() - 1] =
'2';
77 for (
size_t i = transmissions->size() - 1; i !=
static_cast<size_t>(-1); --i)
79 if (transmissions->at(i).joints_.size() > 0)
81 const std::string joint_name = transmissions->at(i).joints_[0].name_;
83 if ((joint_name.size() > 0) && (
'3' == joint_name[joint_name.size() - 1]))
85 std::string second_joint_name = joint_name;
86 second_joint_name[second_joint_name.size() - 1] =
'2';
94 transmissions->push_back(new_transmission);
102 const std::string &joint_name)
const 107 for (
size_t i = 0; i < transmissions.size(); ++i)
109 if ((transmissions[i].joints_.size() > 0)
112 if (transmissions[i].joints_[0].name_ == joint_name)
123 const std::vector<transmission_interface::TransmissionInfo>
129 it != urdf_model->joints_.end(); ++it)
133 this->
fake_state_.joint_states_[it->first].joint_ = it->second;
134 this->
fake_state_.joint_states_[it->first].calibrated_ =
true;
144 std::vector<transmission_interface::TransmissionInfo> transmissions)
146 for (
size_t j = 0; j < transmissions.size(); j++)
148 std::vector<std::string> joint_interfaces = transmissions[j].joints_[0].hardware_interfaces_;
149 if (joint_interfaces.size() > 1)
154 if (joint_interfaces[1] ==
"PositionJointInterface")
167 gazebo::physics::ModelPtr parent_model,
const urdf::Model *
const urdf_model,
168 std::vector<transmission_interface::TransmissionInfo> transmissions)
187 for (
unsigned int j = 0; j <
n_dof_; ++j)
190 if (NULL != this->
fake_state_.getJointState(joint_name))
203 for (
unsigned int j = 0; j <
n_dof_; ++j)
211 if (NULL != this->
fake_state_.getJointState(joint_name))
void registerInterface(T *iface)
void readSim(ros::Time time, ros::Duration period)
hardware_interface::PositionJointInterface pj_interface_
std::vector< double > joint_position_command_
virtual void readSim(ros::Time time, ros::Duration period)
Gazebo custom hardware implementation.
std::vector< double > joint_position_
ros_ethercat_model::RobotStateInterface robot_state_interface_
hardware_interface::JointStateInterface js_interface_
std::vector< double > joint_velocity_
std::vector< std::string > joint_names_
virtual void writeSim(ros::Time time, ros::Duration period)
std::vector< double > joint_effort_
std::vector< double > joint_effort_command_
void registerHandle(const JointHandle &handle)
void initializeFakeRobotState(const urdf::Model *const urdf_model, const std::vector< transmission_interface::TransmissionInfo > &transmissions)
JointStateHandle getHandle(const std::string &name)
static const std::string simple_transmission_name
bool isHandJoint(const std::vector< transmission_interface::TransmissionInfo > &transmissions, const std::string &joint_name) const
void registerSecondHardwareInterface(std::vector< transmission_interface::TransmissionInfo > transmissions)
#define ROS_INFO_STREAM(args)
virtual bool initSim(const std::string &robot_namespace, ros::NodeHandle model_nh, gazebo::physics::ModelPtr parent_model, const urdf::Model *const urdf_model, std::vector< transmission_interface::TransmissionInfo > transmissions)
void fixJointName(std::vector< T > *items, const std::string old_joint_name, const std::string new_joint_name) const
bool initSim(const std::string &robot_namespace, ros::NodeHandle model_nh, gazebo::physics::ModelPtr parent_model, const urdf::Model *const urdf_model, std::vector< transmission_interface::TransmissionInfo > transmissions)
void addFakeTransmissionsForJ0(std::vector< transmission_interface::TransmissionInfo > *transmissions)
ros_ethercat_model::RobotState fake_state_
void writeSim(ros::Time time, ros::Duration period)
std::vector< ActuatorInfo > actuators_
PLUGINLIB_EXPORT_CLASS(transmission_interface::BiDirectionalEffortJointInterfaceProvider, transmission_interface::RequisiteProvider)
std::vector< double > joint_velocity_command_
std::vector< JointInfo > joints_
static const std::string j0_transmission_name
boost::unordered_map< std::string, std::string > j2_j1_joints_