Remove urdfeffort attribute, parse URDF "effort" into mjsJoint.actforcerange.
PiperOrigin-RevId: 630796429 Change-Id: I45363aca8afcce68bf48b2e8bdb556b39852f073
This commit is contained in:
committed by
Copybara-Service
parent
61a651c63a
commit
ac1af8e461
+16
-9
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
#include <array>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@@ -488,17 +489,23 @@ void mjXURDF::Joint(XMLElement* joint_elem) {
|
||||
|
||||
// limit element
|
||||
if ((elem = FindSubElem(joint_elem, "limit"))) {
|
||||
ReadAttr(elem, "lower", 1, pjoint->range, text);
|
||||
ReadAttr(elem, "upper", 1, pjoint->range+1, text);
|
||||
bool is_limited = mjuu_defined(pjoint->range[0]) &&
|
||||
mjuu_defined(pjoint->range[1]) &&
|
||||
pjoint->range[0] < pjoint->range[1];
|
||||
pjoint->limited = is_limited ? mjLIMITED_TRUE : mjLIMITED_FALSE;
|
||||
bool haslower = ReadAttr(elem, "lower", 1, pjoint->range, text);
|
||||
bool hasupper = ReadAttr(elem, "upper", 1, pjoint->range+1, text);
|
||||
|
||||
// handle range mis-specification, otherwise the default mjLIMITED_AUTO will do the right thing
|
||||
bool bad_range = (haslower != hasupper) || pjoint->range[0] > pjoint->range[1];
|
||||
if (bad_range) {
|
||||
pjoint->limited = mjLIMITED_FALSE;
|
||||
}
|
||||
|
||||
// ReadAttr(elem, "velocity", 1, &pjoint->maxvel, text); // no maxvel in MuJoCo
|
||||
ReadAttr(elem, "effort", 1, &pjoint->urdfeffort, text);
|
||||
} else {
|
||||
pjoint->limited = mjLIMITED_FALSE;
|
||||
double effort = 0;
|
||||
ReadAttr(elem, "effort", 1, &effort, text);
|
||||
effort = std::abs(effort);
|
||||
if (effort > 0) {
|
||||
pjoint->actfrcrange[0] = -effort;
|
||||
pjoint->actfrcrange[1] = effort;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user