Fix boundary value and torch warning

This commit is contained in:
wty-yy
2026-06-26 21:26:22 +08:00
parent efde17bd87
commit 9c172a0d39
3 changed files with 10 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ os.environ['MUJOCO_GL'] = 'glfw'
os.environ["OMP_NUM_THREADS"] = "1" os.environ["OMP_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1" os.environ["MKL_NUM_THREADS"] = "1"
os.environ["TORCH_CPP_LOG_LEVEL"] = "ERROR"
import multiprocessing import multiprocessing
import threading import threading

View File

@@ -781,6 +781,13 @@ class MujocoSimulator:
contact_force = np.zeros(6, dtype=np.float64) contact_force = np.zeros(6, dtype=np.float64)
mujoco.mj_contactForce(self.mj_model, self.mj_data, i, contact_force) mujoco.mj_contactForce(self.mj_model, self.mj_data, i, contact_force)
max_contact_force = 1e6
contact_force = np.nan_to_num(
contact_force,
nan=0.0, posinf=max_contact_force, neginf=-max_contact_force
)
contact_force = np.clip(contact_force, -max_contact_force, max_contact_force)
friction = np.array(contact.friction, dtype=np.float32).reshape(-1) friction = np.array(contact.friction, dtype=np.float32).reshape(-1)
positions.append(np.array(contact.pos, dtype=np.float32)) positions.append(np.array(contact.pos, dtype=np.float32))

View File

@@ -10,8 +10,8 @@ setup(
packages=find_packages(), packages=find_packages(),
install_requires=[ install_requires=[
"torch", # Refer: https://pytorch.org/get-started/locally/ "torch", # Refer: https://pytorch.org/get-started/locally/
"numpy==1.20.0", "numpy<2",
"pillow==9.0.0", "pillow<10",
"mujoco==3.2.3", "mujoco==3.2.3",
"dm_control==1.0.23", "dm_control==1.0.23",
"scipy", "scipy",