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
@@ -69,6 +69,9 @@ MJAPI mjtNum mju_min(mjtNum a, mjtNum b);
|
||||
// max function, single evaluation of a and b
|
||||
MJAPI mjtNum mju_max(mjtNum a, mjtNum b);
|
||||
|
||||
// clip x to the range [min, max]
|
||||
MJAPI mjtNum mju_clip(mjtNum x, mjtNum min, mjtNum max);
|
||||
|
||||
// sign function
|
||||
MJAPI mjtNum mju_sign(mjtNum x);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user