diff --git a/embodichain/lab/sim/objects/gizmo.py b/embodichain/lab/sim/objects/gizmo.py index 27ebf5b..f58fd0d 100644 --- a/embodichain/lab/sim/objects/gizmo.py +++ b/embodichain/lab/sim/objects/gizmo.py @@ -40,7 +40,6 @@ RigidBodyShape, PhysicalAttr, ) -from dexsim.render import GizmoController from embodichain.lab.sim.utility.gizmo_utils import create_gizmo_callback @@ -421,7 +420,7 @@ def toggle_visibility(self) -> bool: # Apply the visibility setting to the gizmo node if self._gizmo and hasattr(self._gizmo, "node"): - self._gizmo.node.set_physical_visible(self._is_visible, self._is_visible) + self._gizmo.node.set_visible(self._is_visible) return self._is_visible @@ -436,7 +435,7 @@ def set_visibility(self, visible: bool): # Apply the visibility setting to the gizmo node if self._gizmo and hasattr(self._gizmo, "node"): - self._gizmo.node.set_physical_visible(self._is_visible, self._is_visible) + self._gizmo.node.set_visible(self._is_visible) def is_visible(self) -> bool: """ diff --git a/embodichain/lab/sim/sim_manager.py b/embodichain/lab/sim/sim_manager.py index 39c5c9e..8d54226 100644 --- a/embodichain/lab/sim/sim_manager.py +++ b/embodichain/lab/sim/sim_manager.py @@ -46,7 +46,7 @@ from dexsim.engine import CudaArray, Material from dexsim.models import MeshObject from dexsim.render import Light as _Light, LightType -from dexsim.render import GizmoController +from dexsim.engine import GizmoController from embodichain.lab.sim.objects import ( RigidObject, @@ -1046,12 +1046,13 @@ def enable_gizmo( # Initialize GizmoController if not already done. if not hasattr(self, "_gizmo_controller") or self._gizmo_controller is None: - windows = ( + window = ( self._world.get_windows() if hasattr(self._world, "get_windows") else None ) - self._gizmo_controller = GizmoController(windows) + self._gizmo_controller = GizmoController() + window.add_input_control(self._gizmo_controller) except Exception as e: logger.log_error( diff --git a/examples/sim/demo/press_softbody.py b/examples/sim/demo/press_softbody.py index 79c3313..9f4ff44 100644 --- a/examples/sim/demo/press_softbody.py +++ b/examples/sim/demo/press_softbody.py @@ -39,6 +39,7 @@ SoftObjectCfg, SoftbodyVoxelAttributesCfg, SoftbodyPhysicalAttributesCfg, + URDFCfg, ) from embodichain.lab.sim.shapes import MeshCfg @@ -100,12 +101,19 @@ def create_robot(sim: SimulationManager): # Configure the robot with its components and control properties cfg = RobotCfg( uid="UR10", - fpath=ur10_urdf_path, - solver_cfg=PytorchSolverCfg( - end_link_name="ee_link", - root_link_name="base_link", - tcp=np.eye(4), + urdf_cfg=URDFCfg( + components=[{"component_type": "arm", "urdf_path": ur10_urdf_path}] ), + control_parts={ + "arm": ["Joint[0-9]"], + }, + solver_cfg={ + "arm": PytorchSolverCfg( + end_link_name="ee_link", + root_link_name="base_link", + tcp=np.eye(4), + ) + }, init_qpos=[ 0.0, -np.pi / 2, @@ -133,13 +141,14 @@ def create_soft_cow(sim: SimulationManager) -> SoftObject: shape=MeshCfg( fpath=get_resources_data_path("Model", "cow", "cow2.obj"), ), - init_pos=[0.5, 0.0, 0.3], + init_rot=[0, 90, 0], + init_pos=[0.45, -0.1, 0.12], voxel_attr=SoftbodyVoxelAttributesCfg( simulation_mesh_resolution=8, maximal_edge_length=0.5, ), physical_attr=SoftbodyPhysicalAttributesCfg( - youngs=1e4, + youngs=5e3, poissons=0.45, density=100, dynamic_friction=0.1, @@ -162,7 +171,7 @@ def press_cow(sim: SimulationManager, robot: Robot): arm_start_xpos = robot.compute_fk(arm_start_qpos, name="arm", to_matrix=True) press_xpos = arm_start_xpos.clone() - press_xpos[:, :3, 3] = torch.tensor([0.5, -0.1, 0.01], device=press_xpos.device) + press_xpos[:, :3, 3] = torch.tensor([0.5, -0.1, 0.005], device=press_xpos.device) approach_xpos = press_xpos.clone() approach_xpos[:, 2, 3] += 0.05 diff --git a/examples/sim/gizmo/gizmo_w1.py b/examples/sim/gizmo/gizmo_w1.py index 791582a..90d73ed 100644 --- a/examples/sim/gizmo/gizmo_w1.py +++ b/examples/sim/gizmo/gizmo_w1.py @@ -104,8 +104,9 @@ def main(): ), }, drive_pros=JointDrivePropertiesCfg( - stiffness={"LEFT_J[1-7]": 1e4, "RIGHT_J[1-7]": 1e4}, - damping={"LEFT_J[1-7]": 1e3, "RIGHT_J[1-7]": 1e3}, + stiffness={"(LEFT|RIGHT)_J[1-7]": 1e4, "(ANKLE|KNEE|BUTTOCK|WAIST)": 1e7}, + damping={"(LEFT|RIGHT)_J[1-7]": 1e3, "(ANKLE|KNEE|BUTTOCK|WAIST)": 1e4}, + max_effort={"(LEFT|RIGHT)_J[1-7]": 1e5, "(ANKLE|KNEE|BUTTOCK|WAIST)": 1e10}, ), ) robot = sim.add_robot(cfg=robot_cfg) diff --git a/examples/sim/solvers/pink_solver.py b/examples/sim/solvers/pink_solver.py index 8ad325f..aea419c 100644 --- a/examples/sim/solvers/pink_solver.py +++ b/examples/sim/solvers/pink_solver.py @@ -149,9 +149,7 @@ def main(): if ik_qpos.dim() == 3: robot.set_qpos(qpos=ik_qpos[0][0], joint_ids=robot.get_joint_ids(arm_name)) else: - robot.set_qpos( - qpos=ik_qpos.unsqueeze(0), joint_ids=robot.get_joint_ids(arm_name) - ) + robot.set_qpos(qpos=ik_qpos, joint_ids=robot.get_joint_ids(arm_name)) # Visualize current pose ik_xpos = robot.compute_fk(qpos=ik_qpos, name=arm_name, to_matrix=True) diff --git a/pyproject.toml b/pyproject.toml index 9653c7b..1dd9a3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ requires-python = ">=3.10" # Core install dependencies (kept from requirements.txt). Some VCS links are # specified using PEP 508 direct references where present. dependencies = [ - "dexsim_engine @ http://pyp.open3dv.site:2345/packages/dexsim_engine-0.3.6-cp310-cp310-manylinux_2_31_x86_64.whl", + "dexsim_engine @ http://pyp.open3dv.site:2345/packages/dexsim_engine-0.3.7-cp310-cp310-manylinux_2_31_x86_64.whl", "setuptools>=78.1.1", "gymnasium==0.29.1", "casadi==3.7.1",