Add tendon velocity sensor to MJX.

PiperOrigin-RevId: 685689974
Change-Id: Ib5e65b19c20b74e20cffa66c6baca0d8faaaf3ae
This commit is contained in:
Taylor Howell
2024-10-14 06:47:05 -07:00
committed by Copybara-Service
parent 1e7c109887
commit ac91a7639d
5 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ MJX
- Added support for :ref:`spatial tendons <tendon-spatial>` with pulleys and external sphere and cylinder wrapping. - 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`). - Added sphere-cylinder and sphere-ellipsoid collision functions (:github:issue:`2126`).
- Fixed a bug with frictionloss constraints. - Fixed a bug with frictionloss constraints.
- Added ``TENDONPOS`` sensor. - Added ``TENDONPOS`` and ``TENDONVEL`` sensors.
- Fixed a bug with the computation of tangential contact forces in ``_decode_pyramid``. - Fixed a bug with the computation of tangential contact forces in ``_decode_pyramid``.
Bug fixes Bug fixes
+3 -3
View File
@@ -219,9 +219,9 @@ The following features are **fully supported** in MJX:
* - :ref:`Sensors <mjtSensor>` * - :ref:`Sensors <mjtSensor>`
- ``MAGNETOMETER``, ``CAMPROJECTION``, ``RANGEFINDER``, ``JOINTPOS``, ``TENDONPOS``, ``ACTUATORPOS``, ``BALLQUAT``, - ``MAGNETOMETER``, ``CAMPROJECTION``, ``RANGEFINDER``, ``JOINTPOS``, ``TENDONPOS``, ``ACTUATORPOS``, ``BALLQUAT``,
``FRAMEPOS``, ``FRAMEXAXIS``, ``FRAMEYAXIS``, ``FRAMEZAXIS``, ``FRAMEQUAT``, ``SUBTREECOM``, ``CLOCK``, ``FRAMEPOS``, ``FRAMEXAXIS``, ``FRAMEYAXIS``, ``FRAMEZAXIS``, ``FRAMEQUAT``, ``SUBTREECOM``, ``CLOCK``,
``VELOCIMETER``, ``GYRO``, ``JOINTVEL``, ``ACTUATORVEL``, ``BALLANGVEL``, ``FRAMELINVEL``, ``FRAMEANGVEL``, ``VELOCIMETER``, ``GYRO``, ``JOINTVEL``, ``TENDONVEL``, ``ACTUATORVEL``, ``BALLANGVEL``, ``FRAMELINVEL``,
``SUBTREELINVEL``, ``SUBTREEANGMOM``, ``ACCELEROMETER``, ``FORCE``, ``TORQUE``, ``ACTUATORFRC``, ``JOINTACTFRC``, ``FRAMEANGVEL``, ``SUBTREELINVEL``, ``SUBTREEANGMOM``, ``ACCELEROMETER``, ``FORCE``, ``TORQUE``, ``ACTUATORFRC``,
``FRAMELINACC``, ``FRAMEANGACC``. ``JOINTACTFRC``, ``FRAMELINACC``, ``FRAMEANGACC``.
The following features are **in development** and coming soon: The following features are **in development** and coming soon:
+2
View File
@@ -330,6 +330,8 @@ def sensor_vel(m: Model, d: Data) -> Data:
adr = (adr[:, None] + np.arange(3)[None]).reshape(-1) adr = (adr[:, None] + np.arange(3)[None]).reshape(-1)
elif sensor_type == SensorType.JOINTVEL: elif sensor_type == SensorType.JOINTVEL:
sensor = d.qvel[m.jnt_dofadr[objid]] sensor = d.qvel[m.jnt_dofadr[objid]]
elif sensor_type == SensorType.TENDONVEL:
sensor = d.ten_velocity[objid]
elif sensor_type == SensorType.ACTUATORVEL: elif sensor_type == SensorType.ACTUATORVEL:
sensor = d.actuator_velocity[objid] sensor = d.actuator_velocity[objid]
elif sensor_type == SensorType.BALLANGVEL: elif sensor_type == SensorType.BALLANGVEL:
+2
View File
@@ -321,6 +321,7 @@ class SensorType(enum.IntEnum):
VELOCIMETER: 3D linear velocity, in local frame VELOCIMETER: 3D linear velocity, in local frame
GYRO: 3D angular velocity, in local frame GYRO: 3D angular velocity, in local frame
JOINTVEL: joint velocity JOINTVEL: joint velocity
TENDONVEL: scalar tendon velocity
ACTUATORVEL: actuator velocity ACTUATORVEL: actuator velocity
BALLANGVEL: ball joint angular velocity BALLANGVEL: ball joint angular velocity
FRAMELINVEL: 3D linear velocity FRAMELINVEL: 3D linear velocity
@@ -352,6 +353,7 @@ class SensorType(enum.IntEnum):
VELOCIMETER = mujoco.mjtSensor.mjSENS_VELOCIMETER VELOCIMETER = mujoco.mjtSensor.mjSENS_VELOCIMETER
GYRO = mujoco.mjtSensor.mjSENS_GYRO GYRO = mujoco.mjtSensor.mjSENS_GYRO
JOINTVEL = mujoco.mjtSensor.mjSENS_JOINTVEL JOINTVEL = mujoco.mjtSensor.mjSENS_JOINTVEL
TENDONVEL = mujoco.mjtSensor.mjSENS_TENDONVEL
ACTUATORVEL = mujoco.mjtSensor.mjSENS_ACTUATORVEL ACTUATORVEL = mujoco.mjtSensor.mjSENS_ACTUATORVEL
BALLANGVEL = mujoco.mjtSensor.mjSENS_BALLANGVEL BALLANGVEL = mujoco.mjtSensor.mjSENS_BALLANGVEL
FRAMELINVEL = mujoco.mjtSensor.mjSENS_FRAMELINVEL FRAMELINVEL = mujoco.mjtSensor.mjSENS_FRAMELINVEL
@@ -19,6 +19,7 @@
-velocimeter -velocimeter
-gyro -gyro
-jointvel -jointvel
-tendonvel
-actuatorvel -actuatorvel
-ballangvel -ballangvel
-framelinvel -framelinvel
@@ -122,6 +123,7 @@
<sensor> <sensor>
<torque site="site_torque"/> <torque site="site_torque"/>
<tendonpos tendon="fixed"/> <tendonpos tendon="fixed"/>
<tendonvel tendon="fixed"/>
<magnetometer name="magnetometer0" site="site0"/> <magnetometer name="magnetometer0" site="site0"/>
<velocimeter name="velocimeter0" site="site0"/> <velocimeter name="velocimeter0" site="site0"/>
<velocimeter name="velocimeter0cutoff" site="site0" cutoff="3e-4"/> <velocimeter name="velocimeter0cutoff" site="site0" cutoff="3e-4"/>
@@ -131,6 +133,7 @@
<accelerometer name="accelerometer1" site="site1"/> <accelerometer name="accelerometer1" site="site1"/>
<force site="site_force"/> <force site="site_force"/>
<tendonpos tendon="spatial"/> <tendonpos tendon="spatial"/>
<tendonvel tendon="spatial"/>
<jointpos name="jointpos0" joint="hinge0"/> <jointpos name="jointpos0" joint="hinge0"/>
<jointpos name="jointpos0cutoff" joint="hinge0" cutoff="1e-4"/> <jointpos name="jointpos0cutoff" joint="hinge0" cutoff="1e-4"/>
<jointvel name="jointvel0" joint="hinge0"/> <jointvel name="jointvel0" joint="hinge0"/>