Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions embodichain/lab/sim/objects/gizmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
RigidBodyShape,
PhysicalAttr,
)
from dexsim.render import GizmoController

from embodichain.lab.sim.utility.gizmo_utils import create_gizmo_callback

Expand Down Expand Up @@ -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

Expand All @@ -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:
"""
Expand Down
7 changes: 4 additions & 3 deletions embodichain/lab/sim/sim_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
25 changes: 17 additions & 8 deletions examples/sim/demo/press_softbody.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
SoftObjectCfg,
SoftbodyVoxelAttributesCfg,
SoftbodyPhysicalAttributesCfg,
URDFCfg,
)
from embodichain.lab.sim.shapes import MeshCfg

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions examples/sim/gizmo/gizmo_w1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions examples/sim/solvers/pink_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down