From 3567dde0ec9be3f6e7b9b9485e77dbd003b202cf Mon Sep 17 00:00:00 2001 From: Julien Perez Date: Thu, 20 Jun 2024 19:38:31 +0200 Subject: [PATCH] add target market to the push task --- gym_lowcostrobot/assets/low_cost_robot_6dof/push_cube.xml | 4 +++- gym_lowcostrobot/envs/push_cube_env.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gym_lowcostrobot/assets/low_cost_robot_6dof/push_cube.xml b/gym_lowcostrobot/assets/low_cost_robot_6dof/push_cube.xml index 58d1f89..9fa8a48 100644 --- a/gym_lowcostrobot/assets/low_cost_robot_6dof/push_cube.xml +++ b/gym_lowcostrobot/assets/low_cost_robot_6dof/push_cube.xml @@ -41,7 +41,6 @@ - @@ -122,6 +121,9 @@ + + + diff --git a/gym_lowcostrobot/envs/push_cube_env.py b/gym_lowcostrobot/envs/push_cube_env.py index 861d77b..625bd32 100644 --- a/gym_lowcostrobot/envs/push_cube_env.py +++ b/gym_lowcostrobot/envs/push_cube_env.py @@ -229,6 +229,8 @@ def reset(self, seed=None, options=None): # Sample the target position self.target_pos = self.np_random.uniform(self.target_low, self.target_high).astype(np.float32) + target_geom_id = mujoco.mj_name2id(self.model, mujoco.mjtObj.mjOBJ_SITE, "cube_target") + self.model.site_pos[target_geom_id] = self.target_pos # Step the simulation mujoco.mj_forward(self.model, self.data)