Add tendon actuator force limits and tendon actuator force sensor.
PiperOrigin-RevId: 745096883 Change-Id: Ib9acb727fbbfc6b0b0323ee6a889053a7a878056
This commit is contained in:
committed by
Copybara-Service
parent
16e49f2761
commit
96dda6ea75
@@ -5388,7 +5388,9 @@ mjCTendon& mjCTendon::operator=(const mjCTendon& other) {
|
||||
bool mjCTendon::is_limited() const {
|
||||
return islimited(limited, range);
|
||||
}
|
||||
|
||||
bool mjCTendon::is_actfrclimited() const {
|
||||
return islimited(actfrclimited, actfrcrange);
|
||||
}
|
||||
|
||||
void mjCTendon::PointToLocal() {
|
||||
spec.element = static_cast<mjsElement*>(this);
|
||||
@@ -5686,6 +5688,21 @@ void mjCTendon::Compile(void) {
|
||||
throw mjCError(this, "invalid limits in tendon");
|
||||
}
|
||||
|
||||
// if limited is auto, set to 1 if range is specified, otherwise unlimited
|
||||
if (actfrclimited == mjLIMITED_AUTO) {
|
||||
bool hasactfrcrange = !(actfrcrange[0] == 0 && actfrcrange[1] == 0);
|
||||
checklimited(this, compiler->autolimits, "tendon", "", actfrclimited,
|
||||
hasactfrcrange);
|
||||
}
|
||||
|
||||
// check actfrclimits
|
||||
if (actfrcrange[0] >= actfrcrange[1] && is_actfrclimited()) {
|
||||
throw mjCError(this, "invalid actuatorfrcrange in tendon");
|
||||
}
|
||||
if ((actfrcrange[0] > 0 || actfrcrange[1] < 0) && is_actfrclimited()) {
|
||||
throw mjCError(this, "invalid actuatorfrcrange in tendon");
|
||||
}
|
||||
|
||||
// check springlength
|
||||
if (springlength[0] > springlength[1]) {
|
||||
throw mjCError(this, "invalid springlength in tendon");
|
||||
@@ -6479,6 +6496,18 @@ void mjCSensor::Compile(void) {
|
||||
}
|
||||
break;
|
||||
|
||||
case mjSENS_TENDONACTFRC:
|
||||
// must be attached to tendon
|
||||
if (objtype != mjOBJ_TENDON) {
|
||||
throw mjCError(this, "sensor must be attached to tendon");
|
||||
}
|
||||
|
||||
// set
|
||||
dim = 1;
|
||||
datatype = mjDATATYPE_REAL;
|
||||
needstage = mjSTAGE_ACC;
|
||||
break;
|
||||
|
||||
case mjSENS_TENDONPOS:
|
||||
case mjSENS_TENDONVEL:
|
||||
// must be attached to tendon
|
||||
|
||||
Reference in New Issue
Block a user