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
@@ -244,7 +244,6 @@ typedef struct _mjsJoint { // joint specification
|
|||||||
// other
|
// other
|
||||||
int group; // group
|
int group; // group
|
||||||
mjtByte actgravcomp; // is gravcomp force applied via actuators
|
mjtByte actgravcomp; // is gravcomp force applied via actuators
|
||||||
double urdfeffort; // effort (urdf)
|
|
||||||
mjDoubleVec userdata; // user data
|
mjDoubleVec userdata; // user data
|
||||||
mjString info; // message appended to compiler errors
|
mjString info; // message appended to compiler errors
|
||||||
} mjsJoint;
|
} mjsJoint;
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ void mjs_defaultJoint(mjsJoint* joint) {
|
|||||||
joint->actfrclimited = mjLIMITED_AUTO;
|
joint->actfrclimited = mjLIMITED_AUTO;
|
||||||
mj_defaultSolRefImp(joint->solref_limit, joint->solimp_limit);
|
mj_defaultSolRefImp(joint->solref_limit, joint->solimp_limit);
|
||||||
mj_defaultSolRefImp(joint->solref_friction, joint->solimp_friction);
|
mj_defaultSolRefImp(joint->solref_friction, joint->solimp_friction);
|
||||||
joint->urdfeffort = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2411,8 +2411,7 @@ void mjCGeom::Compile(void) {
|
|||||||
if (type==mjGEOM_HFIELD) {
|
if (type==mjGEOM_HFIELD) {
|
||||||
size[0] = hfield->size[0];
|
size[0] = hfield->size[0];
|
||||||
size[1] = hfield->size[1];
|
size[1] = hfield->size[1];
|
||||||
size[2] = 0.5*(0.5*hfield->size[2] +
|
size[2] = 0.25 * hfield->size[2] + 0.5 * hfield->size[3];
|
||||||
hfield->size[3]);
|
|
||||||
} else if (type==mjGEOM_MESH || type==mjGEOM_SDF) {
|
} else if (type==mjGEOM_MESH || type==mjGEOM_SDF) {
|
||||||
const double* aamm = mesh->aamm();
|
const double* aamm = mesh->aamm();
|
||||||
size[0] = mju_max(fabs(aamm[0]), fabs(aamm[3]));
|
size[0] = mju_max(fabs(aamm[0]), fabs(aamm[3]));
|
||||||
@@ -5021,7 +5020,6 @@ void mjCActuator::CopyFromSpec() {
|
|||||||
|
|
||||||
|
|
||||||
void mjCActuator::ResolveReferences(const mjCModel* m) {
|
void mjCActuator::ResolveReferences(const mjCModel* m) {
|
||||||
mjCJoint* pjnt;
|
|
||||||
switch (trntype) {
|
switch (trntype) {
|
||||||
case mjTRN_JOINT:
|
case mjTRN_JOINT:
|
||||||
case mjTRN_JOINTINPARENT:
|
case mjTRN_JOINTINPARENT:
|
||||||
@@ -5031,14 +5029,6 @@ void mjCActuator::ResolveReferences(const mjCModel* m) {
|
|||||||
throw mjCError(this,
|
throw mjCError(this,
|
||||||
"unknown transmission target '%s' for actuator id = %d", target_.c_str(), id);
|
"unknown transmission target '%s' for actuator id = %d", target_.c_str(), id);
|
||||||
}
|
}
|
||||||
pjnt = (mjCJoint*) ptarget;
|
|
||||||
|
|
||||||
// apply urdfeffort
|
|
||||||
if (pjnt->spec.urdfeffort>0) {
|
|
||||||
forcerange[0] = -pjnt->spec.urdfeffort;
|
|
||||||
forcerange[1] = pjnt->spec.urdfeffort;
|
|
||||||
forcelimited = mjLIMITED_TRUE;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case mjTRN_SLIDERCRANK:
|
case mjTRN_SLIDERCRANK:
|
||||||
|
|||||||
+16
-9
@@ -13,6 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -488,17 +489,23 @@ void mjXURDF::Joint(XMLElement* joint_elem) {
|
|||||||
|
|
||||||
// limit element
|
// limit element
|
||||||
if ((elem = FindSubElem(joint_elem, "limit"))) {
|
if ((elem = FindSubElem(joint_elem, "limit"))) {
|
||||||
ReadAttr(elem, "lower", 1, pjoint->range, text);
|
bool haslower = ReadAttr(elem, "lower", 1, pjoint->range, text);
|
||||||
ReadAttr(elem, "upper", 1, pjoint->range+1, text);
|
bool hasupper = ReadAttr(elem, "upper", 1, pjoint->range+1, text);
|
||||||
bool is_limited = mjuu_defined(pjoint->range[0]) &&
|
|
||||||
mjuu_defined(pjoint->range[1]) &&
|
// handle range mis-specification, otherwise the default mjLIMITED_AUTO will do the right thing
|
||||||
pjoint->range[0] < pjoint->range[1];
|
bool bad_range = (haslower != hasupper) || pjoint->range[0] > pjoint->range[1];
|
||||||
pjoint->limited = is_limited ? mjLIMITED_TRUE : mjLIMITED_FALSE;
|
if (bad_range) {
|
||||||
|
pjoint->limited = mjLIMITED_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// ReadAttr(elem, "velocity", 1, &pjoint->maxvel, text); // no maxvel in MuJoCo
|
// ReadAttr(elem, "velocity", 1, &pjoint->maxvel, text); // no maxvel in MuJoCo
|
||||||
ReadAttr(elem, "effort", 1, &pjoint->urdfeffort, text);
|
double effort = 0;
|
||||||
} else {
|
ReadAttr(elem, "effort", 1, &effort, text);
|
||||||
pjoint->limited = mjLIMITED_FALSE;
|
effort = std::abs(effort);
|
||||||
|
if (effort > 0) {
|
||||||
|
pjoint->actfrcrange[0] = -effort;
|
||||||
|
pjoint->actfrcrange[1] = effort;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user