Add tendon position sensor to MJX.

PiperOrigin-RevId: 684851437
Change-Id: Ica0a30762a9cb3d612357b40b6f87cd2fc544fdb
This commit is contained in:
Taylor Howell
2024-10-11 08:47:09 -07:00
committed by Copybara-Service
parent 5fe2b88726
commit 223892c051
5 changed files with 24 additions and 5 deletions
+1
View File
@@ -24,6 +24,7 @@ MJX
- Added support for :ref:`spatial tendons <tendon-spatial>` with pulleys and external sphere and cylinder wrapping.
- Added sphere-cylinder and sphere-ellipsoid collision functions (:github:issue:`2126`).
- Fixed a bug with frictionloss constraints.
- Added ``TENDONPOS`` sensor.
Bug fixes
^^^^^^^^^
+5 -5
View File
@@ -217,11 +217,11 @@ The following features are **fully supported** in MJX:
* - :ref:`Tendons <tendon>`
- :ref:`Fixed <tendon-fixed>`
* - :ref:`Sensors <mjtSensor>`
- ``MAGNETOMETER``, ``CAMPROJECTION``, ``RANGEFINDER``, ``JOINTPOS``, ``ACTUATORPOS``, ``BALLQUAT``, ``FRAMEPOS``,
``FRAMEXAXIS``, ``FRAMEYAXIS``, ``FRAMEZAXIS``, ``FRAMEQUAT``, ``SUBTREECOM``, ``CLOCK``, ``VELOCIMETER``,
``GYRO``, ``JOINTVEL``, ``ACTUATORVEL``, ``BALLANGVEL``, ``FRAMELINVEL``, ``FRAMEANGVEL``, ``SUBTREELINVEL``,
``SUBTREEANGMOM``, ``ACCELEROMETER``, ``FORCE``, ``TORQUE``, ``ACTUATORFRC``, ``JOINTACTFRC``, ``FRAMELINACC``,
``FRAMEANGACC``.
- ``MAGNETOMETER``, ``CAMPROJECTION``, ``RANGEFINDER``, ``JOINTPOS``, ``TENDONPOS``, ``ACTUATORPOS``, ``BALLQUAT``,
``FRAMEPOS``, ``FRAMEXAXIS``, ``FRAMEYAXIS``, ``FRAMEZAXIS``, ``FRAMEQUAT``, ``SUBTREECOM``, ``CLOCK``,
``VELOCIMETER``, ``GYRO``, ``JOINTVEL``, ``ACTUATORVEL``, ``BALLANGVEL``, ``FRAMELINVEL``, ``FRAMEANGVEL``,
``SUBTREELINVEL``, ``SUBTREEANGMOM``, ``ACCELEROMETER``, ``FORCE``, ``TORQUE``, ``ACTUATORFRC``, ``JOINTACTFRC``,
``FRAMELINACC``, ``FRAMEANGACC``.
The following features are **in development** and coming soon:
+2
View File
@@ -166,6 +166,8 @@ def sensor_pos(m: Model, d: Data) -> Data:
continue # avoid adding to sensors/adrs list a second time
elif sensor_type == SensorType.JOINTPOS:
sensor = d.qpos[m.jnt_qposadr[objid]]
elif sensor_type == SensorType.TENDONPOS:
sensor = d.ten_length[objid]
elif sensor_type == SensorType.ACTUATORPOS:
sensor = d.actuator_length[objid]
elif sensor_type == SensorType.BALLQUAT:
+2
View File
@@ -308,6 +308,7 @@ class SensorType(enum.IntEnum):
CAMPROJECTION: camera projection
RANGEFINDER: rangefinder
JOINTPOS: joint position
TENDONPOS: scalar tendon position
ACTUATORPOS: actuator position
BALLQUAT: ball joint orientation
FRAMEPOS: frame position
@@ -338,6 +339,7 @@ class SensorType(enum.IntEnum):
CAMPROJECTION = mujoco.mjtSensor.mjSENS_CAMPROJECTION
RANGEFINDER = mujoco.mjtSensor.mjSENS_RANGEFINDER
JOINTPOS = mujoco.mjtSensor.mjSENS_JOINTPOS
TENDONPOS = mujoco.mjtSensor.mjSENS_TENDONPOS
ACTUATORPOS = mujoco.mjtSensor.mjSENS_ACTUATORPOS
BALLQUAT = mujoco.mjtSensor.mjSENS_BALLQUAT
FRAMEPOS = mujoco.mjtSensor.mjSENS_FRAMEPOS
@@ -5,6 +5,7 @@
-camprojection
-rangefinder
-jointpos
-tendonpos
-actuatorpos
-ballquat
-framepos
@@ -107,8 +108,20 @@
ctrllimited="true"/>
</actuator>
<tendon>
<fixed name="fixed">
<joint joint="hinge0" coef=".1"/>
<joint joint="hinge1" coef=".2"/>
</fixed>
<spatial name="spatial">
<site site="site0"/>
<site site="site1"/>
</spatial>
</tendon>
<sensor>
<torque site="site_torque"/>
<tendonpos tendon="fixed"/>
<magnetometer name="magnetometer0" site="site0"/>
<velocimeter name="velocimeter0" site="site0"/>
<velocimeter name="velocimeter0cutoff" site="site0" cutoff="3e-4"/>
@@ -117,6 +130,7 @@
<rangefinder name="rangefinder0" site="site_rangefinder0"/>
<accelerometer name="accelerometer1" site="site1"/>
<force site="site_force"/>
<tendonpos tendon="spatial"/>
<jointpos name="jointpos0" joint="hinge0"/>
<jointpos name="jointpos0cutoff" joint="hinge0" cutoff="1e-4"/>
<jointvel name="jointvel0" joint="hinge0"/>