Replace double- or single-precision-denominated function calls in the engine with the equivalent mjtNum-denominated calls. This avoids unnecessary casting or precision loss when MuJoCo is compiled for 32-bit float precision. Accordingly, remove #include <math.h> from all engine source files.
build / windows-2022 (push) Has been cancelled
build / macos-12 (push) Has been cancelled
build / ubuntu-20.04-clang-10 (push) Has been cancelled
build / ubuntu-20.04-clang-11 (push) Has been cancelled
build / ubuntu-20.04-clang-12 (push) Has been cancelled
build / ubuntu-22.04-clang-13 (push) Has been cancelled
build / ubuntu-22.04-clang-14 (push) Has been cancelled
build / ubuntu-22.04-gcc-10 (push) Has been cancelled
build / ubuntu-22.04-gcc-11 (push) Has been cancelled
build / ubuntu-22.04-gcc-12 (push) Has been cancelled
build / ubuntu-22.04-gcc-9 (push) Has been cancelled

Also, minor type-related fixes in `user_mesh.cc`.

PiperOrigin-RevId: 675082329
Change-Id: Icc5eb9f9eb4fbf09b08d7d4b9b2929f414e4a75c
This commit is contained in:
Yuval Tassa
2024-09-16 03:39:11 -07:00
committed by Copybara-Service
parent dde25d039b
commit fd17b2144a
12 changed files with 52 additions and 64 deletions
+1 -3
View File
@@ -14,8 +14,6 @@
#include "engine/engine_collision_primitive.h"
#include <math.h>
#include <mujoco/mjdata.h>
#include <mujoco/mjmacro.h>
#include <mujoco/mjmodel.h>
@@ -414,7 +412,7 @@ int mjraw_CapsuleCapsule(mjContact* con, mjtNum margin,
mjtNum det = ma*mc - mb*mb;
// general configuration (non-parallel axes)
if (fabs(det) >= mjMINVAL) {
if (mju_abs(det) >= mjMINVAL) {
// find projections, clip to segments
mjtNum x1 = (mc*u - mb*v) / det;
mjtNum x2 = (ma*v - mb*u) / det;