Skip to content

Commit 93f5821

Browse files
yuvaltassahavess
authored andcommitted
Add <dcmotor> actuator and related docs and tests.
PiperOrigin-RevId: 892927987 Change-Id: I38ed6412801341ba03ddf5fe7b93a6081df24d37
1 parent 0715115 commit 93f5821

31 files changed

Lines changed: 3994 additions & 55 deletions

doc/APIreference/functions.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4658,6 +4658,15 @@ Set actuator to muscle; return error if any.a
46584658

46594659
Set actuator to active adhesion; return error if any.
46604660

4661+
.. _mjs_setToDCMotor:
4662+
4663+
`mjs_setToDCMotor <#mjs_setToDCMotor>`__
4664+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4665+
4666+
.. mujoco-include:: mjs_setToDCMotor
4667+
4668+
Set actuator to DC motor; return error if any.
4669+
46614670
.. _AddAssets:
46624671

46634672
Assets

doc/XMLreference.rst

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6323,6 +6323,174 @@ This element has a subset of the common attributes and two custom attributes.
63236323
to the target body.
63246324

63256325

6326+
.. _actuator-dcmotor:
6327+
6328+
:el-prefix:`actuator/` |-| **dcmotor** |*|
6329+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6330+
This element creates a DC motor actuator. Note that :el:`dcmotor` is quite different from the :ref:`general actuation
6331+
model<geActuation>`. Unlike the general model where the components of force generation are independent affine functions
6332+
mapping from control to force, :el:`dcmotor` relies on highly coupled physical dynamics. See the `DC motor technical
6333+
note <_static/dcmotor.pdf>`__ for complete mathematical formulations and parameter semantics, but we include a few
6334+
important notes here:
6335+
6336+
- Note that while :ref:`resistance<actuator-dcmotor-resistance>`, :ref:`motorconst<actuator-dcmotor-motorconst>` and
6337+
:ref:`nominal<actuator-dcmotor-nominal>` are each optional, some combination of them is required.
6338+
See Section 2.1 of the `technical note <_static/dcmotor.pdf>`__.
6339+
- The control :ref:`input<actuator-dcmotor-input>` semantic is either the voltage applied to the motor terminals, or a
6340+
position or velocity target for a PID :ref:`controller<actuator-dcmotor-controller>`.
6341+
- Optional features include electrical dynamics (:ref:`inductance<actuator-dcmotor-inductance>`),
6342+
:ref:`cogging torque<actuator-dcmotor-cogging>`, :ref:`thermal resistance variation<actuator-dcmotor-thermal>`, and
6343+
:ref:`LuGre<actuator-dcmotor-lugre>` friction.
6344+
6345+
The underlying :el:`general` attributes are set to the :el:`dcmotor` type, and their associated parameter arrays are
6346+
computed internally:
6347+
6348+
========= ======= ========= ========
6349+
Attribute Setting Attribute Setting
6350+
========= ======= ========= ========
6351+
dyntype dcmotor dynprm computed
6352+
gaintype dcmotor gainprm computed
6353+
biastype dcmotor biasprm computed
6354+
========= ======= ========= ========
6355+
6356+
This element has the following custom attributes in addition to the common attributes:
6357+
6358+
.. _actuator-dcmotor-name:
6359+
6360+
.. _actuator-dcmotor-class:
6361+
6362+
.. _actuator-dcmotor-group:
6363+
6364+
.. _actuator-dcmotor-delay:
6365+
6366+
.. _actuator-dcmotor-nsample:
6367+
6368+
.. _actuator-dcmotor-interp:
6369+
6370+
.. _actuator-dcmotor-ctrllimited:
6371+
6372+
.. _actuator-dcmotor-ctrlrange:
6373+
6374+
.. _actuator-dcmotor-lengthrange:
6375+
6376+
.. _actuator-dcmotor-gear:
6377+
6378+
.. _actuator-dcmotor-damping:
6379+
6380+
.. _actuator-dcmotor-armature:
6381+
6382+
.. _actuator-dcmotor-cranklength:
6383+
6384+
.. _actuator-dcmotor-joint:
6385+
6386+
.. _actuator-dcmotor-jointinparent:
6387+
6388+
.. _actuator-dcmotor-tendon:
6389+
6390+
.. _actuator-dcmotor-cranksite:
6391+
6392+
.. _actuator-dcmotor-slidersite:
6393+
6394+
.. _actuator-dcmotor-site:
6395+
6396+
.. _actuator-dcmotor-refsite:
6397+
6398+
.. _actuator-dcmotor-user:
6399+
6400+
.. |actuator/dcmotor attrib list| replace::
6401+
:at:`name`, :at:`class`, :at:`group`, :at:`nsample`, :at:`interp`, :at:`delay`, :at:`ctrllimited`, :at:`ctrlrange`,
6402+
:at:`lengthrange`, :at:`gear`, :at:`damping`, :at:`armature`, :at:`cranklength`, :at:`joint`, :at:`jointinparent`,
6403+
:at:`tendon`, :at:`cranksite`, :at:`slidersite`, :at:`site`, :at:`refsite`, :at:`user`
6404+
6405+
|actuator/dcmotor attrib list|
6406+
Same as in actuator/ :ref:`general <actuator-general>`.
6407+
6408+
.. _actuator-dcmotor-resistance:
6409+
6410+
:at:`resistance`: :at-val:`real, optional`
6411+
Terminal resistance :math:`R` in Ohm. (see `tech note <_static/dcmotor.pdf>`__ for details)
6412+
6413+
.. _actuator-dcmotor-motorconst:
6414+
6415+
:at:`motorconst`: :at-val:`real(2), optional`
6416+
Motor constants, defined as :at:`motorconst` = ":at-val:`Kt` :at-val:`Ke`" (N·m/A, equivalently V·s/rad).
6417+
:at-val:`Kt` is the torque constant and :at-val:`Ke` the back-EMF constant; they can differ when magnetic saturation
6418+
is present. If both are positive, the effective constant is :math:`K = \sqrt{K_t K_e}` (geometric mean). If only one
6419+
is positive, :math:`K` equals that value; a single value is interpreted as :math:`K_t = K_e`. If your datasheet gives
6420+
the speed constant :math:`K_v` in rad/(V·s), use :math:`K_e = 1/K_v`. (see `tech note <_static/dcmotor.pdf>`__ for
6421+
details)
6422+
6423+
.. _actuator-dcmotor-nominal:
6424+
6425+
:at:`nominal`: :at-val:`real(3), optional`
6426+
Nominal operating point, defined as :at:`nominal` = ":at-val:`voltage` :at-val:`stall_torque`
6427+
:at-val:`no_load_speed`". The compiler derives :math:`K =` :at-val:`voltage` / :at-val:`no_load_speed` and :math:`R =
6428+
K` · :at-val:`voltage` / :at-val:`stall_torque`. (see `tech note <_static/dcmotor.pdf>`__ for details)
6429+
6430+
.. _actuator-dcmotor-inductance:
6431+
6432+
:at:`inductance`: :at-val:`real(2), "0 0"`
6433+
Electrical dynamics, defined as :at:`inductance` = ":at-val:`L` :at-val:`timeconst`" (Henry, seconds). These are
6434+
alternative specifications: :at-val:`L` is the winding inductance and :at-val:`timeconst` :math:`= L/R` is the
6435+
electrical time constant. Specify one; if both are given, :at-val:`L` takes precedence. If both are 0 (the default),
6436+
no electrical dynamics are modeled and the current is computed algebraically. Adds one activation variable for
6437+
armature current. (see `tech note <_static/dcmotor.pdf>`__ for details)
6438+
6439+
.. _actuator-dcmotor-thermal:
6440+
6441+
:at:`thermal`: :at-val:`real(6), "0 0 0 0 0 0"`
6442+
Thermal model, defined as :at:`thermal` = ":at-val:`resistance` :at-val:`capacitance` :at-val:`timeconst`
6443+
:at-val:`tempcoef` :at-val:`reftemp` :at-val:`ambient`" (K/W, J/K, s, 1/K, °C, °C). The first three sub-values
6444+
specify the thermal time constant: :at-val:`timeconst` = :at-val:`resistance` :math:`\times` :at-val:`capacitance`.
6445+
Specify either :at-val:`timeconst` directly, or :at-val:`resistance` and :at-val:`capacitance`; if all three are
6446+
given, :at-val:`timeconst` takes precedence. If all are 0 (the default), thermal modeling is disabled. Adds one
6447+
activation variable for winding temperature. (see `tech note <_static/dcmotor.pdf>`__ for details)
6448+
6449+
.. _actuator-dcmotor-saturation:
6450+
6451+
:at:`saturation`: :at-val:`real(4), "0 0 0 0"`
6452+
Limits on the actuator, defined as :at:`saturation` = ":at-val:`torque` :at-val:`current` :at-val:`voltage`
6453+
:at-val:`current_rate`". :at-val:`torque` and :at-val:`current` are alternative specifications of the maximum
6454+
continuous torque: if :at-val:`current` is given, :at-val:`torque` :math:`= K \cdot` :at-val:`current`; if both are
6455+
given, :at-val:`torque` takes precedence. Sets :at:`forcerange` to [:math:`-\tau_{\max},\, \tau_{\max}`].
6456+
:at-val:`voltage` sets the maximum voltage :math:`V_{\max}`. :at-val:`current_rate` sets the maximum rate of change
6457+
of current :math:`(di/dt)_{\max}` (requires :ref:`inductance<actuator-dcmotor-inductance>`). A value of 0 (the
6458+
default) for any sub-value disables the respective limit. (see `tech note <_static/dcmotor.pdf>`__ for details)
6459+
6460+
.. _actuator-dcmotor-cogging:
6461+
6462+
:at:`cogging`: :at-val:`real(3), "0 0 0"`
6463+
Cogging torque, defined as :at:`cogging` = ":at-val:`amplitude` :at-val:`poles` :at-val:`phase`" (N·m, integer, rad).
6464+
Adds a position-dependent torque :math:`= \textsf{amplitude} \cdot \sin(\textsf{poles} \cdot \theta +
6465+
\textsf{phase})`. Disabled when :at-val:`amplitude` = 0 (the default).
6466+
(see `tech note <_static/dcmotor.pdf>`__ for details)
6467+
6468+
.. _actuator-dcmotor-lugre:
6469+
6470+
:at:`lugre`: :at-val:`real(6), "0 0 0 0 0 0"`
6471+
LuGre friction, defined as :at:`lugre` = ":at-val:`stiffness` :at-val:`damping` :at-val:`viscous` :at-val:`coulomb`
6472+
:at-val:`static` :at-val:`stribeck`" (N·m/rad, N·m·s/rad, N·m·s/rad, N·m, N·m, rad/s). Disabled when
6473+
:at-val:`stiffness` = 0 (the default). Adds one activation variable for bristle deflection. Note that the
6474+
:at-val:`viscous` coefficient is mapped directly to the actuator :ref:`damping<actuator-general-damping>` array
6475+
(specifically the linear term, :at-val:`damping[0]`). If both are specified, their values are summed.
6476+
(see `tech note <_static/dcmotor.pdf>`__ for details)
6477+
6478+
.. _actuator-dcmotor-input:
6479+
6480+
:at:`input`: :at-val:`[voltage, position, velocity], "voltage"`
6481+
Specifies the input signal semantics. In "voltage" mode, the control directly sets applied motor voltage. In
6482+
"position" or "velocity" modes, the PID :ref:`controller<actuator-dcmotor-controller>` uses the control as a
6483+
reference setpoint relative to the joint trajectory. (see `tech note <_static/dcmotor.pdf>`__ for details)
6484+
6485+
.. _actuator-dcmotor-controller:
6486+
6487+
:at:`controller`: :at-val:`real(5), "0 0 0 0 0"`
6488+
PID controller parameters, defined as :at:`controller` = ":at-val:`kp` :at-val:`ki` :at-val:`kd`
6489+
:at-val:`slewmax` :at-val:`Imax`". Depending on the :at:`input` mode, the controller stabilizes either position or
6490+
velocity. If the :at:`input` mode is voltage, the controller is ignored. A value of 0 (the default) disables the
6491+
respective feature: :at-val:`slewmax` = 0 means no slew-rate limiting, :at-val:`Imax` = 0 means no anti-windup
6492+
clamping. (see `tech note <_static/dcmotor.pdf>`__ for details)
6493+
63266494
.. _actuator-plugin:
63276495

63286496
:el-prefix:`actuator/` |-| **plugin** |?|
@@ -9887,6 +10055,57 @@ refsite, tendon, slidersite, cranksite.
988710055
All :ref:`adhesion <actuator-adhesion>` attributes are available here except: name, class, body.
988810056

988910057

10058+
.. _default-dcmotor:
10059+
10060+
.. _default-dcmotor-ctrllimited:
10061+
10062+
.. _default-dcmotor-ctrlrange:
10063+
10064+
.. _default-dcmotor-gear:
10065+
10066+
.. _default-dcmotor-damping:
10067+
10068+
.. _default-dcmotor-armature:
10069+
10070+
.. _default-dcmotor-cranklength:
10071+
10072+
.. _default-dcmotor-user:
10073+
10074+
.. _default-dcmotor-group:
10075+
10076+
.. _default-dcmotor-delay:
10077+
10078+
.. _default-dcmotor-nsample:
10079+
10080+
.. _default-dcmotor-interp:
10081+
10082+
.. _default-dcmotor-motorconst:
10083+
10084+
.. _default-dcmotor-resistance:
10085+
10086+
.. _default-dcmotor-nominal:
10087+
10088+
.. _default-dcmotor-saturation:
10089+
10090+
.. _default-dcmotor-inductance:
10091+
10092+
.. _default-dcmotor-cogging:
10093+
10094+
.. _default-dcmotor-controller:
10095+
10096+
.. _default-dcmotor-input:
10097+
10098+
.. _default-dcmotor-thermal:
10099+
10100+
.. _default-dcmotor-lugre:
10101+
10102+
:el-prefix:`default/` |-| **dcmotor** |?|
10103+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10104+
10105+
All :ref:`dcmotor <actuator-dcmotor>` attributes are available here except: name, class, joint, jointinparent, site,
10106+
refsite, tendon, slidersite, cranksite.
10107+
10108+
989010109
.. _custom:
989110110

989210111
**custom** |*|

0 commit comments

Comments
 (0)