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
2 changes: 1 addition & 1 deletion docs/source/overview/sim/sim_articulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion embodichain/lab/sim/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions embodichain/lab/sim/objects/articulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions embodichain/lab/sim/objects/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions embodichain/lab/sim/utility/sim_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand All @@ -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}")

Expand Down