57 ros::NodeHandle model_nh;
64 ROS_ERROR(
"Parent model is NULL! MimicJointPlugin could not be loaded.");
69 if(!ros::isInitialized())
71 ROS_ERROR(
"A ROS node for Gazebo has not been initialized, unable to load plugin.");
77 if(_sdf->HasElement(
"robotNamespace"))
83 if(!_sdf->HasElement(
"joint"))
85 ROS_ERROR(
"No joint element present. MimicJointPlugin could not be loaded.");
89 joint_name_ = _sdf->GetElement(
"joint")->Get<std::string>();
92 if(!_sdf->HasElement(
"mimicJoint"))
94 ROS_ERROR(
"No mimicJoint element present. MimicJointPlugin could not be loaded.");
102 if(_sdf->HasElement(
"hasPID"))
109 nh.param(
"p", p, 0.0);
110 nh.param(
"i", i, 0.0);
111 nh.param(
"d", d, 0.0);
113 pid_ = control_toolbox::Pid(p,i,d);
118 if(_sdf->HasElement(
"multiplier"))
119 multiplier_ = _sdf->GetElement(
"multiplier")->Get<
double>();
123 if (_sdf->HasElement(
"offset"))
124 offset_ = _sdf->GetElement(
"offset")->Get<
double>();
128 if (_sdf->HasElement(
"sensitiveness"))
129 sensitiveness_ = _sdf->GetElement(
"sensitiveness")->Get<
double>();
133 if (_sdf->HasElement(
"maxEffort"))
135 max_effort_ = _sdf->GetElement(
"maxEffort")->Get<
double>();
142 ROS_ERROR(
"No joint named %s. MimicJointPlugin could not be loaded.",
joint_name_.c_str());
148 ROS_ERROR(
"No (mimic) joint named %s. MimicJointPlugin could not be loaded.",
mimic_joint_name_.c_str());
155 #if GAZEBO_MAJOR_VERSION > 2 170 static ros::Duration period(
world_->GetPhysicsEngine()->GetMaxStepSize());
182 double error = angle-a;
187 #if GAZEBO_MAJOR_VERSION >= 4
control_toolbox::Pid pid_
std::string robot_namespace_
event::ConnectionPtr updateConnection
void Load(physics::ModelPtr _parent, sdf::ElementPtr _sdf)
GZ_REGISTER_MODEL_PLUGIN(DisableLinkPlugin)
std::string mimic_joint_name_
physics::JointPtr mimic_joint_