- maxEffort
- A **double** specifying the max effort the mimic joint can generate. Defaults to 1.0.
+ A **double** specifying the max effort the mimic joint can generate. Defaults to the effort limit in the sdf model.
- sensitiveness
- robotNamespace
- A **string** specifying the namespace the robot is under. Defaults to '/'.
+ A **string** specifying the namespace the robot is under. Defaults to "".
- hasPID
- Determines whether the joint has PID in order to be controlled via PID position/effort controller. Takes no value: *\<hasPID/\>* means that the mimic joint is controlled via PID. Ommit it so that the mimic joint is controlled via setAngle.
+ Determines whether the joint has PID in order to be controlled via PID position/effort controller. Takes no value: *\<hasPID/\>* means that the mimic joint is controlled via PID. Omit it so that the mimic joint is controlled via setAngle.
DisableLinkPlugin
-----------------
}
// Check for robot namespace
- robot_namespace_ = "/";
+ robot_namespace_ = "";
if (_sdf->HasElement("robotNamespace")) {
robot_namespace_ = _sdf->GetElement("robotNamespace")->Get<std::string>();
}
if (_sdf->HasElement("sensitiveness"))
sensitiveness_ = _sdf->GetElement("sensitiveness")->Get<double>();
- // Check for max effort
- max_effort_ = 1.0;
- if (_sdf->HasElement("maxEffort")) {
- max_effort_ = _sdf->GetElement("maxEffort")->Get<double>();
- }
-
// Get pointers to joints
joint_ = model_->GetJoint(joint_name_);
if (!joint_) {
return;
}
+ // Check for max effort
+#if GAZEBO_MAJOR_VERSION > 2
+ max_effort_ = mimic_joint_->GetEffortLimit(0);
+#else
+ max_effort_ = mimic_joint_->GetMaxForce(0);
+#endif
+ if (_sdf->HasElement("maxEffort")) {
+ max_effort_ = _sdf->GetElement("maxEffort")->Get<double>();
+ }
+
// Set max effort
if (!has_pid_) {
#if GAZEBO_MAJOR_VERSION > 2
double a = mimic_joint_->GetAngle(0).Radian();
#endif
- if (abs(angle - a) >= sensitiveness_) {
+ if (fabs(angle - a) >= sensitiveness_) {
if (has_pid_) {
if (a != a)
a = angle;