Skip to content

Conversation

@yangchen73
Copy link
Collaborator

Description

Added StackBlocksTwo-v1 environment - a manipulation task where two blocks need to be stacked on top of each other.

Changes

  • Added StackBlocksTwoEnv class
  • Added gym configuration with RoboTwin-compatible physics parameters

Reference

Based on stack_blocks_two task from RoboTwin.

How to Run

python3 embodichain/lab/scripts/preview_env.py \
    --gym_config configs/gym/stack_blocks_two/gym_config.json \
    --num_envs 1

Testing

Environment tested and verified to work correctly.
Screenshot from 2025-12-21 13-08-34

@yuecideng yuecideng added the task A task written in openai gym format for imitation learning or reinforcement learning label Dec 21, 2025

# RoboTwin check if grippers are open
# This requires checking robot gripper state, which may need to be implemented

Copy link
Collaborator

Choose a reason for hiding this comment

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

这个咱们就不check了。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

好的


# Compute angle and check if fallen
angle = torch.arccos(dot_product)
return angle >= torch.pi / 4
Copy link
Collaborator

Choose a reason for hiding this comment

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

话说这里你有可视化过你load 进去的block的pose吗?是否是z轴朝上还是朝哪里?

Copy link
Collaborator

Choose a reason for hiding this comment

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

def draw_axis(env, pose):
    from embodichain.lab.sim.cfg import MarkerCfg
    marker_cfg = MarkerCfg(
        name='test',
        marker_type="axis",
        axis_xpos=pose,
        axis_size=0.01,
        axis_len=0.2,
        arena_index=-1,  # All arenas
    )
    env.sim.draw_marker(cfg=marker_cfg)
    env.sim.update()

可以用这个方程可视化一些他们的pose。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

没有,因为在config里orientation我已经确定是z朝上了,然后我现在做了下可视化(蓝色是z轴)。
Screenshot from 2025-12-24 23-52-26

我当时用了这个_is_fall是觉得,方块应该是z轴始终朝上的,就需要检测方块的orientation。但是robotwin里方块哪一面朝上都可以(因为它没有判断最后的orientation),这点差别应该没关系吧?


# Check if block2 is within tolerance of expected position
position_diff = torch.abs(block2_pos - expected_block2_pos) # (num_envs, 3)
within_tolerance = torch.all(
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里这样check是合理的吗?我感觉是不是应该check bolck_1和block_2的delta x 以及 delta y不超过eps,然后block_2的 z 比bolck_1高。还是robotwin是这么做的?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

我这里是按照robotwin里来的。

def check_success(self):
        block1_pose = self.block1.get_pose().p
        block2_pose = self.block2.get_pose().p
        eps = [0.025, 0.025, 0.012]

        return (np.all(abs(block2_pose - np.array(block1_pose[:2].tolist() + [block1_pose[2] + 0.05])) < eps)
                and self.is_left_gripper_open() and self.is_right_gripper_open())

其实也是check 了delta x和delta y还有delta z。

}
]
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

我看相比于pour_water的gym_config少了很多东西,要不把他们补上。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

原先我只添加了一些基础配置,pour_water里多了一些和动作规划有关的东西,还有几个多的camera,因为我看scope_ice里也就是只有一些基础配置,我也就没加。我觉得可以补上,说不定以后用会用到。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已经加上了

@Jasonxu1225 Jasonxu1225 changed the base branch from main to yc/more_envs December 25, 2025 02:10
@Jasonxu1225 Jasonxu1225 merged commit ae72ce6 into DexForce:yc/more_envs Dec 25, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

task A task written in openai gym format for imitation learning or reinforcement learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants