Guard against division by zero when calculating pressure in tactile sensor.

PiperOrigin-RevId: 791641958
Change-Id: I457bc7f55c0b03e14b9c3944935866ede14f1d51
This commit is contained in:
Alessio Quaglino
2025-08-06 05:06:07 -07:00
committed by Copybara-Service
parent 3821ff1dcf
commit 49f45a93c8
+1 -1
View File
@@ -1240,7 +1240,7 @@ void mj_sensorAcc(const mjModel* m, mjData* d) {
mju_rotVecQuat(tang2, tang2, m->mesh_quat + 4 * mesh_id);
mjtNum force[3];
mjtNum kMaxDepth = 0.05;
mjtNum pressure = depth / (kMaxDepth - depth);
mjtNum pressure = depth / mju_max(kMaxDepth - depth, mjMINVAL);
mju_scl3(force, normal, pressure);
// one row of mat^T * force