Guard against division by zero when calculating pressure in tactile sensor.
PiperOrigin-RevId: 791641958 Change-Id: I457bc7f55c0b03e14b9c3944935866ede14f1d51
This commit is contained in:
committed by
Copybara-Service
parent
3821ff1dcf
commit
49f45a93c8
@@ -1240,7 +1240,7 @@ void mj_sensorAcc(const mjModel* m, mjData* d) {
|
|||||||
mju_rotVecQuat(tang2, tang2, m->mesh_quat + 4 * mesh_id);
|
mju_rotVecQuat(tang2, tang2, m->mesh_quat + 4 * mesh_id);
|
||||||
mjtNum force[3];
|
mjtNum force[3];
|
||||||
mjtNum kMaxDepth = 0.05;
|
mjtNum kMaxDepth = 0.05;
|
||||||
mjtNum pressure = depth / (kMaxDepth - depth);
|
mjtNum pressure = depth / mju_max(kMaxDepth - depth, mjMINVAL);
|
||||||
mju_scl3(force, normal, pressure);
|
mju_scl3(force, normal, pressure);
|
||||||
|
|
||||||
// one row of mat^T * force
|
// one row of mat^T * force
|
||||||
|
|||||||
Reference in New Issue
Block a user