Added optional smoothing to muscle dynamics:
- `muscle` actuators take a new `tausmooth` attribute (defaults to 0) which when positive, smooths the transition between activation and deactivation timescales. - `mju_muscleDynamics` takes 3 parameters, adding width of smoothing sigmoid. PiperOrigin-RevId: 531473354 Change-Id: I8ab6c0289ff04437e798c3ca6edda132a30fcc31
This commit is contained in:
committed by
Copybara-Service
parent
777cad52b4
commit
770b4b363a
@@ -2944,7 +2944,7 @@ mju_muscleDynamics
|
||||
|
||||
.. mujoco-include:: mju_muscleDynamics
|
||||
|
||||
Muscle activation dynamics, prm = (tau_act, tau_deact).
|
||||
Muscle activation dynamics, prm = (tau_act, tau_deact, smoothing_width).
|
||||
|
||||
.. _mju_encodePyramid:
|
||||
|
||||
|
||||
@@ -5535,7 +5535,7 @@ section. The underlying :el:`general` attributes are set as follows:
|
||||
========= ======= ========= ======================================================
|
||||
Attribute Setting Attribute Setting
|
||||
========= ======= ========= ======================================================
|
||||
dyntype muscle dynprm timeconst(2)
|
||||
dyntype muscle dynprm timeconst(2) tausmooth
|
||||
gaintype muscle gainprm range(2), force, scale, lmin, lmax, vmax, fpmax, fvmax
|
||||
biastype muscle biasprm same as gainprm
|
||||
========= ======= ========= ======================================================
|
||||
@@ -5589,6 +5589,12 @@ This element has nine custom attributes in addition to the common attributes:
|
||||
:at:`timeconst`: :at-val:`real(2), "0.01 0.04"`
|
||||
Time constants for activation and de-activation dynamics.
|
||||
|
||||
.. _actuator-muscle-tausmooth:
|
||||
|
||||
:at:`tausmooth`: :at-val:`real, "0"`
|
||||
Width of smooth transition between activation and deactivation time constants. Units of ctrl, must be
|
||||
nonegative.
|
||||
|
||||
.. _actuator-muscle-range:
|
||||
|
||||
:at:`range`: :at-val:`real(2), "0.75 1.05"`
|
||||
|
||||
+4
-4
@@ -1105,13 +1105,13 @@
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`jointinparent<actuator-muscle-jointinparent>` | :ref:`tendon<actuator-muscle-tendon>` | :ref:`slidersite<actuator-muscle-slidersite>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`cranksite<actuator-muscle-cranksite>` | :ref:`timeconst<actuator-muscle-timeconst>` | :ref:`range<actuator-muscle-range>` | |
|
||||
| | | | :ref:`cranksite<actuator-muscle-cranksite>` | :ref:`timeconst<actuator-muscle-timeconst>` | :ref:`tausmooth<actuator-muscle-tausmooth>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`force<actuator-muscle-force>` | :ref:`scale<actuator-muscle-scale>` | :ref:`lmin<actuator-muscle-lmin>` | |
|
||||
| | | | :ref:`range<actuator-muscle-range>` | :ref:`force<actuator-muscle-force>` | :ref:`scale<actuator-muscle-scale>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`lmax<actuator-muscle-lmax>` | :ref:`vmax<actuator-muscle-vmax>` | :ref:`fpmax<actuator-muscle-fpmax>` | |
|
||||
| | | | :ref:`lmin<actuator-muscle-lmin>` | :ref:`lmax<actuator-muscle-lmax>` | :ref:`vmax<actuator-muscle-vmax>` | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
| | | | :ref:`fvmax<actuator-muscle-fvmax>` | | | |
|
||||
| | | | :ref:`fpmax<actuator-muscle-fpmax>` | :ref:`fvmax<actuator-muscle-fvmax>` | | |
|
||||
| | | +-----------------------------------------------------------------+-----------------------------------------------------------------+-----------------------------------------------------------------+ |
|
||||
+------------------------------------+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |_| actuator |br| |_| |L| | | .. table:: |
|
||||
|
||||
@@ -45,6 +45,11 @@ General
|
||||
6x^5 - 15x^4 + 10x^3, & 0 \lt & x \lt 1 \\
|
||||
1, & 1 \le & x \qquad
|
||||
\end{cases}
|
||||
- Added optional :ref:`tausmooth<actuator-muscle-tausmooth>` attribute to muscle actuators. When positive, the
|
||||
time-constant :math:`\tau` of muscle activation/deactivation uses :ref:`mju_sigmoid` to transition smoothly
|
||||
between the two extremal values given by the `Millard et al. (2013) <https://doi.org/10.1115/1.4023390>`__ muscle
|
||||
model, within a range of width tausmooth. See :ref:`Muscle actuators<CMuscle>` for more details.
|
||||
Relatedly, :ref:`mju_muscleDynamics` now takes 3 parameters instead of 2, adding the new smoothing-width parameter.
|
||||
|
||||
|
||||
.. youtube:: ZppeDArq6AU
|
||||
|
||||
@@ -2434,7 +2434,7 @@ mjtNum mju_muscleGain(mjtNum len, mjtNum vel, const mjtNum lengthrange[2],
|
||||
mjtNum acc0, const mjtNum prm[9]);
|
||||
mjtNum mju_muscleBias(mjtNum len, const mjtNum lengthrange[2],
|
||||
mjtNum acc0, const mjtNum prm[9]);
|
||||
mjtNum mju_muscleDynamics(mjtNum ctrl, mjtNum act, const mjtNum prm[2]);
|
||||
mjtNum mju_muscleDynamics(mjtNum ctrl, mjtNum act, const mjtNum prm[3]);
|
||||
void mju_encodePyramid(mjtNum* pyramid, const mjtNum* force, const mjtNum* mu, int dim);
|
||||
void mju_decodePyramid(mjtNum* force, const mjtNum* pyramid, const mjtNum* mu, int dim);
|
||||
mjtNum mju_springDamper(mjtNum pos0, mjtNum vel0, mjtNum Kp, mjtNum Kv, mjtNum dt);
|
||||
|
||||
+15
-7
@@ -754,13 +754,12 @@ ascending portion of the :math:`\text{FL}` curve, or the descending portion, or
|
||||
model with 50 muscles. Do you believe that someone did careful experiments and measured the operating range for every
|
||||
muscle in your model, taking into account all the joints that the muscle spans? If not, then it is better to think of
|
||||
musculo-skeletal models as having the same general behavior as the biological system, while being different in various
|
||||
details - including details that are of great interest to some research community. For most muscle properties which
|
||||
details -- including details that are of great interest to some research community. For most muscle properties which
|
||||
modelers consider constant and known, there is an experimental paper showing that they vary under some conditions. This
|
||||
is not to discourage people from building accurate models, but rather to discourage people from believing too strongly
|
||||
in their models. Modeling in biology is quite different from modeling in physics and engineering... which is why we find
|
||||
it ironic when people in Robotics complain that building accurate robot models is hard.
|
||||
in their models.
|
||||
|
||||
Coming back to our muscle model, there is the muscle activation act. This is the state of a first-order nonlinear
|
||||
Coming back to our muscle model, there is the muscle activation ``act``. This is the state of a first-order nonlinear
|
||||
filter whose input is the control signal. The filter dynamics are:
|
||||
|
||||
|
||||
@@ -773,12 +772,17 @@ are two time constants specified with the attribute timeconst, namely :math:`\te
|
||||
<https://doi.org/10.1115/1.4023390>`__, the effective time constant :math:`\tau` is then computed at runtime as:
|
||||
|
||||
.. math::
|
||||
\tau(\texttt{ctrl}, \texttt{act}) =
|
||||
\tau(\texttt{ctrl}-\texttt{act}) =
|
||||
\begin{cases}
|
||||
\tau_\text{act} \cdot (0.5 + 1.5\cdot\texttt{act}) & \texttt{ctrl} \gt \texttt{act} \\
|
||||
\tau_\text{deact} / (0.5 + 1.5\cdot\texttt{act}) & \texttt{ctrl} \leq \texttt{act}
|
||||
\tau_\text{act} \cdot (0.5 + 1.5\cdot\texttt{act}) & \texttt{ctrl}-\texttt{act} \gt 0 \\
|
||||
\tau_\text{deact} / (0.5 + 1.5\cdot\texttt{act}) & \texttt{ctrl} - \texttt{act} \leq 0
|
||||
\end{cases}
|
||||
|
||||
Since the above equation describes discontinuous switching, which can be undesirable when using derivative-based
|
||||
optimization, we introduce the optional smoothing parameter :ref:`tausmooth<actuator-muscle-tausmooth>`. When greater
|
||||
than 0, the switching is replaced by :ref:`mju_sigmoid`, which will smoothly interpolate between the two values within
|
||||
the range :math:`(\texttt{ctrl}-\texttt{act}) \pm \text{tausmooth}/2`.
|
||||
|
||||
Now we summarize the attributes of element :ref:`muscle <actuator-muscle>` which users may want to adjust,
|
||||
depending on their familiarity with the biomechanics literature and availability of detailed measurements with regard
|
||||
to a particular model:
|
||||
@@ -801,6 +805,10 @@ timeconst
|
||||
Muscles are composed of slow-twitch and fast-twitch fibers. The typical muscle is mixed, but some muscles have a
|
||||
higher proportion of one or the other fiber type, making them faster or slower. This can be modeled by adjusting the
|
||||
time constants. The vmax parameter of the :math:`\text{\small FLV}` function should also be adjusted accordingly.
|
||||
tausmooth
|
||||
When positive, smooths the transition between activation and de-activation time-constants. While a single
|
||||
`motor unit <https://en.wikipedia.org/wiki/Motor_unit>`__ is either activating or de-activating, an entire muscle
|
||||
will have a mixture of many units, leading to a corresponding mixture of timescales.
|
||||
lmin, lmax, vmax, fpmax, fvmax
|
||||
These are the parameters controlling the shape of the :math:`\text{\small FLV}` function. Advanced users can
|
||||
experiment with them; see MATLAB function `FLV.m <_static/FLV.m>`__. Similar to the scale setting, if you want to
|
||||
|
||||
Reference in New Issue
Block a user