Fix boundary value and torch warning
This commit is contained in:
@@ -19,6 +19,7 @@ os.environ['MUJOCO_GL'] = 'glfw'
|
||||
|
||||
os.environ["OMP_NUM_THREADS"] = "1"
|
||||
os.environ["MKL_NUM_THREADS"] = "1"
|
||||
os.environ["TORCH_CPP_LOG_LEVEL"] = "ERROR"
|
||||
|
||||
import multiprocessing
|
||||
import threading
|
||||
|
||||
@@ -781,6 +781,13 @@ class MujocoSimulator:
|
||||
|
||||
contact_force = np.zeros(6, dtype=np.float64)
|
||||
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)
|
||||
|
||||
positions.append(np.array(contact.pos, dtype=np.float32))
|
||||
|
||||
Reference in New Issue
Block a user