diff --git a/docs/source/overview/sim/sim_articulation.md b/docs/source/overview/sim/sim_articulation.md index 1fe6bac6..5e4c0669 100644 --- a/docs/source/overview/sim/sim_articulation.md +++ b/docs/source/overview/sim/sim_articulation.md @@ -32,7 +32,7 @@ The `drive_props` parameter controls the joint physics behavior. It is defined u | `max_effort` | `float` / `Dict` | `1.0e10` | Maximum effort (force/torque) the joint can exert. | | `max_velocity` | `float` / `Dict` | `1.0e10` | Maximum velocity allowed for the joint ($m/s$ or $rad/s$). | | `friction` | `float` / `Dict` | `0.0` | Joint friction coefficient. | -| `drive_type` | `str` | `"force"` | Drive mode: `"force"` or `"acceleration"`. | +| `drive_type` | `str` | `"force"` | Drive mode: `"force"`(driven by a force), `"acceleration"`(driven by an acceleration) or `none`(no force). | ### Setup & Initialization diff --git a/embodichain/lab/sim/cfg.py b/embodichain/lab/sim/cfg.py index 68dc6d41..8866fea0 100644 --- a/embodichain/lab/sim/cfg.py +++ b/embodichain/lab/sim/cfg.py @@ -388,11 +388,12 @@ def attr(self) -> SoftBodyAttr: class JointDrivePropertiesCfg: """Properties to define the drive mechanism of a joint.""" - drive_type: Literal["force", "acceleration"] = "force" + drive_type: Literal["force", "acceleration", "none"] = "force" """Joint drive type to apply. If the drive type is "force", then the joint is driven by a force and the acceleration is computed based on the force applied. If the drive type is "acceleration", then the joint is driven by an acceleration and the force is computed based on the acceleration applied. + If the drive type is "none", then no force will be applied to joint. """ stiffness: Union[Dict[str, float], float] = 1e4 diff --git a/embodichain/lab/sim/objects/articulation.py b/embodichain/lab/sim/objects/articulation.py index 760f32c6..ef77f063 100644 --- a/embodichain/lab/sim/objects/articulation.py +++ b/embodichain/lab/sim/objects/articulation.py @@ -1386,9 +1386,9 @@ def _set_default_joint_drive(self) -> None: drive_pros = self.cfg.drive_pros if isinstance(drive_pros, dict): - drive_type = drive_pros.get("drive_type", None) + drive_type = drive_pros.get("drive_type", "none") else: - drive_type = getattr(drive_pros, "drive_type", None) + drive_type = getattr(drive_pros, "drive_type", "none") # Apply drive parameters to all articulations in the batch self.set_drive( diff --git a/embodichain/lab/sim/objects/robot.py b/embodichain/lab/sim/objects/robot.py index 09f8c3f1..cb35d62a 100644 --- a/embodichain/lab/sim/objects/robot.py +++ b/embodichain/lab/sim/objects/robot.py @@ -855,9 +855,9 @@ def _set_default_joint_drive(self) -> None: drive_pros = self.cfg.drive_pros if isinstance(drive_pros, dict): - drive_type = drive_pros.get("drive_type", None) + drive_type = drive_pros.get("drive_type", "force") else: - drive_type = getattr(drive_pros, "drive_type", None) + drive_type = getattr(drive_pros, "drive_type", "force") # Apply drive parameters to all articulations in the batch self.set_drive( diff --git a/embodichain/lab/sim/utility/sim_utils.py b/embodichain/lab/sim/utility/sim_utils.py index 6bf1d5fc..8086689c 100644 --- a/embodichain/lab/sim/utility/sim_utils.py +++ b/embodichain/lab/sim/utility/sim_utils.py @@ -73,6 +73,8 @@ def get_dexsim_drive_type(drive_type: str) -> DriveType: return DriveType.FORCE elif drive_type == "acceleration": return DriveType.ACCELERATION + elif drive_type == "none": + return DriveType.NONE else: logger.error(f"Invalid dexsim drive type: {drive_type}") @@ -97,6 +99,8 @@ def get_drive_type(drive_pros): drive_type = DriveType.FORCE elif drive_type == "acceleration": drive_type = DriveType.ACCELERATION + elif drive_type == "none": + return DriveType.NONE else: logger.log_error(f"Unknow drive type {drive_type}")