Skip to content

Adapt DexSim v0.4.2 for EmbodiChain #301

Merged
yuecideng merged 5 commits into
mainfrom
feat/adapt-dexsim-v0.4.2
Jun 14, 2026
Merged

Adapt DexSim v0.4.2 for EmbodiChain #301
yuecideng merged 5 commits into
mainfrom
feat/adapt-dexsim-v0.4.2

Conversation

@yuecideng

Copy link
Copy Markdown
Contributor

Description

This PR adapts EmbodiChain to DexSim v0.4.2 by bumping the dexsim_engine dependency and aligning articulation joint state accessors with the renamed DexSim entity API.

DexSim v0.4.2 separates current vs. target joint state into explicit methods (get_target_qpos, get_target_qvel, set_current_qpos, set_target_qpos, set_current_qvel, set_target_qvel) instead of the previous get_current_qpos(is_target=True) / set_qpos / set_qvel pattern. EmbodiChain's Articulation and Robot wrappers are updated accordingly.

Dependencies: dexsim_engine==0.4.2

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which improves an existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

Screenshots

N/A — backend API alignment only.

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.

🤖 Generated with Claude Code

Made with Cursor

Bump dexsim_engine to 0.4.2 and align articulation target/current
qpos/qvel getters and setters with the renamed DexSim entity API.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings June 12, 2026 08:14
@yuecideng yuecideng added enhancement New feature or request dexsim Things related to dexsim dependencies Pull requests that update a dependency file labels Jun 12, 2026
@yuecideng yuecideng changed the title Adapt DexSim v0.4.2 for EmbodiChain current modification Adapt DexSim v0.4.2 for EmbodiChain Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates EmbodiChain’s simulation wrappers to match DexSim v0.4.2’s split “current vs target” joint-state API, and bumps the dexsim_engine dependency accordingly.

Changes:

  • Bump dexsim_engine dependency from 0.4.1 to 0.4.2.
  • Update Articulation CPU joint-state target accessors (target_qpos, target_qvel) to use DexSim’s new explicit getters.
  • Update joint velocity setting paths to use DexSim’s explicit “current/target” setters.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
pyproject.toml Bumps dexsim_engine to 0.4.2.
embodichain/lab/sim/objects/robot.py Routes Robot.set_qvel through the updated articulation velocity setter.
embodichain/lab/sim/objects/articulation.py Aligns CPU getters/setters with DexSim v0.4.2 explicit current/target joint APIs.

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

Comment on lines +1147 to +1148

def set_qvel(
def set_current_qvel(
Comment on lines +1187 to 1191
self._entities[env_idx].set_target_qvel
if target
else self._entities[env_idx].set_qvel
else self._entities[env_idx].set_current_qvel
)
setter(qvel[i].numpy(), local_joint_ids)
Comment on lines 1148 to 1151
def set_current_qvel(
self,
qvel: torch.Tensor,
joint_ids: Sequence[int] | None = None,
Comment on lines 271 to 277
# Fetch target_qpos from CPU entities
return torch.as_tensor(
np.array(
[
entity.get_current_qpos(is_target=True)
for entity in self.entities
],
[entity.get_target_qpos() for entity in self.entities],
),
dtype=torch.float32,
device=self.device,
Copilot AI review requested due to automatic review settings June 14, 2026 03:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 3 out of 3 changed files in this pull request and generated 3 comments.

Comment on lines +1580 to +1587
local_env_ids = self._all_indices if env_ids is None else env_ids
if self.device.type == "cpu":
zero_joint_data = np.zeros((len(local_env_ids), self.dof), dtype=np.float32)
for i, env_idx in enumerate(local_env_ids):
self._entities[env_idx].set_qvel(zero_joint_data[i])
self._entities[env_idx].set_current_qvel(zero_joint_data[i])
self._entities[env_idx].set_current_qf(zero_joint_data[i])
else:
zeros = torch.zeros(
(len(local_env_ids), self.dof), dtype=torch.float32, device=self.device
)
indices = self.body_data.gpu_indices[local_env_ids]
self._ps.gpu_apply_joint_data(
data=zeros,
gpu_indices=indices,
data_type=ArticulationGPUAPIWriteType.JOINT_VELOCITY,
)
self._ps.gpu_apply_joint_data(
data=zeros,
gpu_indices=indices,
data_type=ArticulationGPUAPIWriteType.JOINT_TARGET_VELOCITY,
)
self._ps.gpu_apply_joint_data(
data=zeros,
gpu_indices=indices,
data_type=ArticulationGPUAPIWriteType.JOINT_FORCE,
)
self.set_qvel(torch.zeros(self.dof, device=self.device), env_ids=local_env_ids)
self.set_qvel(
torch.zeros(self.dof, device=self.device),
env_ids=local_env_ids,
target=True,
)
self.set_qf(torch.zeros(self.dof, device=self.device), env_ids=local_env_ids)
Comment on lines +1187 to 1191
self._entities[env_idx].set_target_qvel
if target
else self._entities[env_idx].set_qvel
else self._entities[env_idx].set_current_qvel
)
setter(qvel[i].numpy(), local_joint_ids)
Comment thread .github/workflows/main.yml Outdated
Comment on lines +12 to +18
name: Activate conda py311 environment
shell: bash -l {0}
run: |
source activate py311
echo "$CONDA_PREFIX/bin" >> "$GITHUB_PATH"
python --version
which python pip
Copilot AI review requested due to automatic review settings June 14, 2026 05:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 4 out of 4 changed files in this pull request and generated 4 comments.

Comment on lines 1580 to +1584
local_env_ids = self._all_indices if env_ids is None else env_ids
if self.device.type == "cpu":
zero_joint_data = np.zeros((len(local_env_ids), self.dof), dtype=np.float32)
for i, env_idx in enumerate(local_env_ids):
self._entities[env_idx].set_qvel(zero_joint_data[i])
self._entities[env_idx].set_current_qvel(zero_joint_data[i])
self._entities[env_idx].set_current_qf(zero_joint_data[i])
else:
zeros = torch.zeros(
(len(local_env_ids), self.dof), dtype=torch.float32, device=self.device
)
indices = self.body_data.gpu_indices[local_env_ids]
self._ps.gpu_apply_joint_data(
data=zeros,
gpu_indices=indices,
data_type=ArticulationGPUAPIWriteType.JOINT_VELOCITY,
)
self._ps.gpu_apply_joint_data(
data=zeros,
gpu_indices=indices,
data_type=ArticulationGPUAPIWriteType.JOINT_TARGET_VELOCITY,
)
self._ps.gpu_apply_joint_data(
data=zeros,
gpu_indices=indices,
data_type=ArticulationGPUAPIWriteType.JOINT_FORCE,
)
zeros = torch.zeros((len(local_env_ids), self.dof), device=self.device)
self.set_qvel(zeros, env_ids=local_env_ids)
self.set_qvel(zeros, env_ids=local_env_ids, target=True)
self.set_qf(zeros, env_ids=local_env_ids)
Comment on lines 1098 to 1105
if self.device.type == "cpu":
for i, env_idx in enumerate(local_env_ids):
setter = (
self._entities[env_idx].set_current_qpos
self._entities[env_idx].set_target_qpos
if target
else self._entities[env_idx].set_qpos
else self._entities[env_idx].set_current_qpos
)
setter(qpos[i].numpy(), local_joint_ids.numpy())
Comment on lines 1184 to 1191
if self.device.type == "cpu":
for i, env_idx in enumerate(local_env_ids):
setter = (
self._entities[env_idx].set_current_qvel
self._entities[env_idx].set_target_qvel
if target
else self._entities[env_idx].set_qvel
else self._entities[env_idx].set_current_qvel
)
setter(qvel[i].numpy(), local_joint_ids)
Comment on lines +6 to +12
- name: Activate conda py311 environment
shell: bash -l {0}
run: |
source activate py311
echo "$CONDA_PREFIX/bin" >> "$GITHUB_PATH"
python --version
which python pip
@yuecideng yuecideng merged commit f255594 into main Jun 14, 2026
7 checks passed
@yuecideng yuecideng deleted the feat/adapt-dexsim-v0.4.2 branch June 14, 2026 06:10
yuecideng added a commit that referenced this pull request Jun 15, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file dexsim Things related to dexsim enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants