Skip to content

Articulation use none as default drive type.#210

Merged
yuecideng merged 5 commits intomainfrom
cj/drive-none-update
Mar 31, 2026
Merged

Articulation use none as default drive type.#210
yuecideng merged 5 commits intomainfrom
cj/drive-none-update

Conversation

@matafela
Copy link
Copy Markdown
Collaborator

Description

  • Articulation use none as default drive type. But robot still use force as default drive type.
  • Add cloth asset document.

Fixes # (issue)

  • Articulation use none as default drive type.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update

Checklist

  • I have run the black . command to format the code base.
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Dependencies have been updated, if applicable.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns joint-drive defaults by changing Articulation.set_joint_drive() to default to "none" while keeping Robot default behavior at "force", and expands simulation documentation with a new cloth overview plus related doc updates.

Changes:

  • Change Articulation.set_joint_drive() default drive_type from "force" to "none".
  • Add Robot.set_joint_drive() override to preserve the robot default drive_type="force".
  • Add/adjust documentation for cloth assets and articulation drive-type guidance.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
embodichain/lab/sim/objects/robot.py Adds a set_joint_drive() override so robots keep default drive type "force".
embodichain/lab/sim/objects/articulation.py Switches the articulation API default drive type to "none".
docs/source/tutorial/create_cloth.rst Tweaks the included snippet boundaries for the cloth tutorial.
docs/source/overview/sim/sim_soft_object.md Updates soft-object intro wording (removes cloth example).
docs/source/overview/sim/sim_cloth.md Introduces new cloth-object overview documentation page.
docs/source/overview/sim/sim_assets.md Adds the cloth overview page to the sim assets toctree.
docs/source/overview/sim/sim_articulation.md Updates drive-type default and adds guidance for drive-less articulations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

:start-at: cloth_verts, cloth_faces = create_2d_grid_mesh
:end-at: )
:end-before: padding_box_cfg
:end-at: padding_box_cfg = RigidObjectCfg
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This literalinclude now ends at the line containing padding_box_cfg = RigidObjectCfg, which in the referenced script is the start of a multi-line call. This will include an incomplete statement (unclosed parenthesis) in the rendered docs. Consider ending before padding_box_cfg (e.g., using :end-before:) or ending at the closing ) of the cloth spawn block so the snippet is syntactically complete.

Suggested change
:end-at: padding_box_cfg = RigidObjectCfg
:end-before: padding_box_cfg = RigidObjectCfg(

Copilot uses AI. Check for mistakes.
Comment on lines 1236 to 1240
max_velocity: torch.Tensor | None = None,
friction: torch.Tensor | None = None,
drive_type: str = "force",
drive_type: str = "none",
joint_ids: Sequence[int] | None = None,
env_ids: Sequence[int] | None = None,
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive_type now defaults to "none", but the docstring parameter description still states it defaults to "force". This is misleading for API consumers; please update the docstring to match the new default (and adjust any related wording if needed).

Copilot uses AI. Check for mistakes.
Comment on lines +807 to +808
Different from Articulation, default drive type is 'force' instead of 'none'

Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new set_joint_drive docstring has inconsistent indentation on the second line (it is indented further than the opening line), which will render oddly in generated docs. Consider reflowing this sentence and aligning indentation with the rest of the docstring.

Suggested change
Different from Articulation, default drive type is 'force' instead of 'none'
Different from ``Articulation``, the default drive type is ``"force"`` instead of ``"none"``.

Copilot uses AI. Check for mistakes.
Comment on lines +6 to +10
The {class}`~objects.Cloth` class represents deformable surface entities in EmbodiChain. Unlike rigid bodies, cloth objects are defined by vertices and meshes rather than a single rigid pose.

## Configuration

Configured via {class}`~cfg.ClothObjectCfg`.
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs refer to {class}~objects.Cloth here, but the codebase exports `ClothObject` (see `embodichain/lab/sim/objects/cloth_object.py`). Unless there is an alias not shown here, this should likely be `{class}`~objects.ClothObject to avoid broken references in the generated docs.

Copilot uses AI. Check for mistakes.
| `physical_attr` | `ClothPhysicalAttributesCfg` | `...` | Physical attributes. |
| `shape` | `MeshCfg` | `MeshCfg()` | Mesh configuration. |

### CLoth Body Attributes
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Section title typo: ### CLoth Body Attributes has inconsistent capitalization. Consider renaming to ### Cloth Body Attributes for consistency and readability.

Suggested change
### CLoth Body Attributes
### Cloth Body Attributes

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +140
| `get_current_vertex_velocity()` | `(n_envs, n_vert, 3)` | Current positions of mesh vertices. |
| `get_rest_vertex_position()` | `(n_envs, n_vert, 3` | Rest (initial) positions of collision vertices. |
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vertex API table has a couple of correctness issues: get_current_vertex_velocity() is described as returning positions (should describe velocities), and get_rest_vertex_position()'s return shape is missing a closing parenthesis/backtick. These will confuse readers and should be corrected.

Suggested change
| `get_current_vertex_velocity()` | `(n_envs, n_vert, 3)` | Current positions of mesh vertices. |
| `get_rest_vertex_position()` | `(n_envs, n_vert, 3` | Rest (initial) positions of collision vertices. |
| `get_current_vertex_velocity()` | `(n_envs, n_vert, 3)` | Current velocities of mesh vertices. |
| `get_rest_vertex_position()` | `(n_envs, n_vert, 3)` | Rest (initial) positions of collision vertices. |

Copilot uses AI. Check for mistakes.
### Drive Configuration

The `drive_props` parameter controls the joint physics behavior. It is defined using the `JointDrivePropertiesCfg` class.
The `drive_props` parameter controls the joint physics behavior. It is defined using the `JointDrivePropertiesCfg` class. For articulation object without internal drive force, like cabinet and drawer, better set `drive_type` to `"none"`.
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor grammar/style: "For articulation object ... better set" is awkward English and could be misread. Consider rephrasing (e.g., "For articulations without internal drive force (e.g., cabinets/drawers), it's better to set drive_type to "none".").

Suggested change
The `drive_props` parameter controls the joint physics behavior. It is defined using the `JointDrivePropertiesCfg` class. For articulation object without internal drive force, like cabinet and drawer, better set `drive_type` to `"none"`.
The `drive_props` parameter controls the joint physics behavior. It is defined using the `JointDrivePropertiesCfg` class. For articulations without internal drive force (e.g., cabinets and drawers), it's better to set `drive_type` to `"none"`.

Copilot uses AI. Check for mistakes.
The rectangle is subdivided into an `nx` by `ny` grid (cells) and
triangulated. `nx=1, ny=1` yields the simple two-triangle rectangle.

Returns an vertices and triangles.
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar issue in the example docstring: "Returns an vertices and triangles." should be corrected (e.g., "Returns vertices and triangles."), otherwise it reads incorrectly in the rendered documentation.

Suggested change
Returns an vertices and triangles.
Returns vertices and triangles.

Copilot uses AI. Check for mistakes.
Comment on lines +107 to +111
# 2. Configure Cloth Object
cfg=ClothObjectCfg(
uid="cloth_demo",
shape=MeshCfg(fpath=cloth_save_path),
init_pos=[0.5, 0.0, 0.3],
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setup code block references MeshCfg and ClothPhysicalAttributesCfg (used in shape=... / physical_attr=...), but the snippet only imports ClothObject/ClothObjectCfg. Consider adding the missing imports so the example is self-contained.

Copilot uses AI. Check for mistakes.
Comment on lines +100 to +104
cloth_verts, cloth_faces = create_2d_grid_mesh(width=0.3, height=0.3, nx=12, ny=12)
cloth_mesh = o3d.geometry.TriangleMesh(
vertices=o3d.utility.Vector3dVector(cloth_verts.to("cpu").numpy()),
triangles=o3d.utility.Vector3iVector(cloth_faces.to("cpu").numpy()),
)
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setup code block uses o3d, os, and tempfile, but they are not imported in this snippet. Consider adding the missing imports (or explicitly noting the snippet is partial) to prevent copy/paste errors.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings March 31, 2026 06:35
@matafela matafela force-pushed the cj/drive-none-update branch from 641ee5a to 8cacfaf Compare March 31, 2026 06:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1236 to 1240
max_velocity: torch.Tensor | None = None,
friction: torch.Tensor | None = None,
drive_type: str = "force",
drive_type: str = "none",
joint_ids: Sequence[int] | None = None,
env_ids: Sequence[int] | None = None,
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The drive_type parameter default was changed to "none", but the docstring still says it defaults to "force". Please update the docstring to match the new default so callers aren’t misled.

Copilot uses AI. Check for mistakes.
| `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"`(driven by a force), `"acceleration"`(driven by an acceleration) or `none`(no force). |
| `drive_type` | `str` | `"none"` | Drive mode: `"force"`(driven by a force), `"acceleration"`(driven by an acceleration) or `none`(no force). |
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs list the default drive_type as "none", but the actual config default is still "force" (JointDrivePropertiesCfg.drive_type = "force" in embodichain/lab/sim/cfg.py:502). Either update the code default (if intended) or correct this documentation default to avoid confusing users.

Suggested change
| `drive_type` | `str` | `"none"` | Drive mode: `"force"`(driven by a force), `"acceleration"`(driven by an acceleration) or `none`(no force). |
| `drive_type` | `str` | `"force"` | Drive mode: `"force"`(driven by a force), `"acceleration"`(driven by an acceleration) or `none`(no force). |

Copilot uses AI. Check for mistakes.
| `physical_attr` | `ClothPhysicalAttributesCfg` | `...` | Physical attributes. |
| `shape` | `MeshCfg` | `MeshCfg()` | Mesh configuration. |

### CLoth Body Attributes
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in heading: "CLoth" should be "Cloth".

Suggested change
### CLoth Body Attributes
### Cloth Body Attributes

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +19
### CLoth Body Attributes

Cloth bodies require both voxelization and physical attributes.
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section says cloth bodies require "voxelization", but ClothObjectCfg only has shape and physical_attr (no voxelization attributes). Please revise this text to describe the actual cloth configuration requirements.

Suggested change
### CLoth Body Attributes
Cloth bodies require both voxelization and physical attributes.
### Cloth Body Attributes
Cloth bodies are configured using a mesh shape ({class}`~cfg.MeshCfg` via the `shape` field) and physical attributes ({class}`~cfg.ClothPhysicalAttributesCfg` via the `physical_attr` field).

Copilot uses AI. Check for mistakes.
```python
import torch
from embodichain.lab.sim import SimulationManager, SimulationManagerCfg
from embodichain.lab.sim.objects import ClothObject, ClothObjectCfg
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setup code example references o3d, os, tempfile, MeshCfg, and ClothPhysicalAttributesCfg but they aren’t imported in the snippet, so it won’t run as written. Add the missing imports (or remove those references) to keep the example executable.

Suggested change
from embodichain.lab.sim.objects import ClothObject, ClothObjectCfg
from embodichain.lab.sim.objects import ClothObject, ClothObjectCfg
from embodichain.lab.sim.cfg import MeshCfg, ClothPhysicalAttributesCfg
import os
import tempfile
import open3d as o3d

Copilot uses AI. Check for mistakes.
The rectangle is subdivided into an `nx` by `ny` grid (cells) and
triangulated. `nx=1, ny=1` yields the simple two-triangle rectangle.

Returns an vertices and triangles.
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small docstring grammar issue in the example: "Returns an vertices and triangles." should be corrected (e.g., "Returns vertices and triangles.")

Suggested change
Returns an vertices and triangles.
Returns vertices and triangles.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings March 31, 2026 07:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 25 to 28
### Drive Configuration

The `drive_props` parameter controls the joint physics behavior. It is defined using the `JointDrivePropertiesCfg` class.
The `drive_props` parameter controls the joint physics behavior. It is defined using the `JointDrivePropertiesCfg` class. For articulation object without internal drive force, like cabinet and drawer, better set `drive_type` to `"none"`.

Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation refers to drive_props, but the actual config field used throughout the codebase (and other docs) is drive_pros. Using the wrong name here is confusing and can lead users to pass an unsupported parameter name.

Copilot uses AI. Check for mistakes.
```{currentmodule} embodichain.lab.sim
```

The {class}`~objects.Cloth` class represents deformable surface entities in EmbodiChain. Unlike rigid bodies, cloth objects are defined by vertices and meshes rather than a single rigid pose.
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objects.Cloth doesn’t appear to exist in the codebase (the implementation/export is objects.ClothObject). The class reference here should be updated so the docs resolve correctly.

Suggested change
The {class}`~objects.Cloth` class represents deformable surface entities in EmbodiChain. Unlike rigid bodies, cloth objects are defined by vertices and meshes rather than a single rigid pose.
The {class}`~objects.ClothObject` class represents deformable surface entities in EmbodiChain. Unlike rigid bodies, cloth objects are defined by vertices and meshes rather than a single rigid pose.

Copilot uses AI. Check for mistakes.
| `physical_attr` | `ClothPhysicalAttributesCfg` | `...` | Physical attributes. |
| `shape` | `MeshCfg` | `MeshCfg()` | Mesh configuration. |

### CLoth Body Attributes
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Section title has a capitalization typo: "CLoth" -> "Cloth".

Suggested change
### CLoth Body Attributes
### Cloth Body Attributes

Copilot uses AI. Check for mistakes.
| :--- | :--- | :--- |
| `get_current_vertex_position()` | `(n_envs, n_vert, 3)` | Current positions of mesh vertices. |
| `get_current_vertex_velocity()` | `(n_envs, n_vert, 3)` | Current positions of mesh vertices. |
| `get_rest_vertex_position()` | `(n_envs, n_vert, 3` | Rest (initial) positions of collision vertices. |
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return shape formatting is broken for get_rest_vertex_position() (missing closing parenthesis/backtick). This will render incorrectly and is ambiguous.

Suggested change
| `get_rest_vertex_position()` | `(n_envs, n_vert, 3` | Rest (initial) positions of collision vertices. |
| `get_rest_vertex_position()` | `(n_envs, n_vert, 3)` | Rest (initial) positions of collision vertices. |

Copilot uses AI. Check for mistakes.
Comment on lines 1237 to 1241
friction: torch.Tensor | None = None,
drive_type: str = "force",
drive_type: str = "none",
joint_ids: Sequence[int] | None = None,
env_ids: Sequence[int] | None = None,
) -> None:
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive_type now defaults to "none" in the signature, but the docstring below still states the default is "force". Please update the docstring to avoid misleading API docs.

Copilot uses AI. Check for mistakes.
Comment on lines +795 to +805
def set_joint_drive(
self,
stiffness: torch.Tensor | None = None,
damping: torch.Tensor | None = None,
max_effort: torch.Tensor | None = None,
max_velocity: torch.Tensor | None = None,
friction: torch.Tensor | None = None,
drive_type: str = "force",
joint_ids: Sequence[int] | None = None,
env_ids: Sequence[int] | None = None,
) -> None:
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this override changes the default drive_type only for explicit calls to Robot.set_joint_drive(). It does not prevent robots from initializing with drive_type="none" via RobotCfg inheriting ArticulationCfg’s new default. If the intent is for Robot defaults to remain "force", consider also overriding drive_pros in RobotCfg (or adjusting Robot’s initialization fallback).

Copilot uses AI. Check for mistakes.
@yuecideng yuecideng merged commit 193e64f into main Mar 31, 2026
5 checks passed
@yuecideng yuecideng deleted the cj/drive-none-update branch March 31, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants