No longer modify control vector in-place, add mju_clip.
- Never modify `d->ctrl`: - `ctrl` values which are outside their respective `ctrlrange` are clamped internally, but `d->ctrl` itself is unmodified. - Similarly, if `mjWARN_BADCTRL` is raised (NaNs or huge values), `ctrl` is cleared internally, but `d->ctrl` itself is unmodified. - `mjWARN_BADCTRL` is no longer raised for `d->ctrl` values that are larger in absolute value than `mjMAXVAL`, if clamping makes them smaller than that. - Added `mju_clip()` utility function. - Added missing warning string for `case mjWARN_BADCTRL`. PiperOrigin-RevId: 459025950 Change-Id: Ifbf974f9c02c3d70afdaa3114018fc81dfd746d3
This commit is contained in:
committed by
Copybara-Service
parent
09a5efc09e
commit
6d01627c0b
@@ -806,9 +806,9 @@ void mjv_addGeoms(const mjModel* m, mjData* d, const mjvOption* vopt,
|
||||
|
||||
// clamp act to extended range
|
||||
if (vopt->flags[mjVIS_ACTIVATION] && m->actuator_dyntype[i]) {
|
||||
act = mjMIN(rng[2], mjMAX(rng[0], d->act[i-(m->nu-m->na)]));
|
||||
act = mju_clip(d->act[i-(m->nu-m->na)], rng[0], rng[2]);
|
||||
} else {
|
||||
act = mjMIN(rng[2], mjMAX(rng[0], d->ctrl[i]));
|
||||
act = mju_clip(d->ctrl[i], rng[0], rng[2]);
|
||||
}
|
||||
|
||||
// compute interpolants
|
||||
|
||||
Reference in New Issue
Block a user