StanfordVL / OmniGibson

OmniGibson: a platform for accelerating Embodied AI research built upon NVIDIA's Omniverse engine. Join our Discord for support: https://discord.gg/bccR5vGFEx
https://behavior.stanford.edu/omnigibson/
MIT License
382 stars 42 forks source link

How to keep the gripper of FrankaPanda closed? #709

Closed qwerty863 closed 2 months ago

qwerty863 commented 2 months ago

Hi, I'm trying FrankaPanda with grasping_mode='physical' like below, and struggling to keep the gripper closed. I directly set the last two dimensions as -1 to make it closed, but once closed, it opens again. What I want here is to keep it closed so that I can grasp some objects. Can you let me know what I'm missing here?

Thank you!

import omnigibson as og
from omnigibson.macros import gm

# Don't use GPU dynamics and Use flatcache for performance boost
gm.USE_GPU_DYNAMICS = True
gm.ENABLE_FLATCACHE = True

def main(random_selection=False, headless=False, short_exec=False):
    scene_cfg = dict(type="Scene")
    robot0_cfg = dict(
        type="FrankaPanda",
        obs_modalities=["rgb"],
        action_type="continuous",
        action_normalize=True,
        fixed_base=True,
        grasping_mode='physical',
    )
    cfg = dict(scene=scene_cfg, robots=[robot0_cfg])
    env = og.Environment(configs=cfg)

    robot = env.robots[0]
    robot.reset()
    robot.keep_still()

    for _ in range(50):
        og.sim.step()

    ################################################
    # FrankaPanda gripper close
    joint_pos = robot.get_joint_positions()
    joint_pos[-2:] = -1
    robot.set_joint_positions(joint_pos)
    ################################################

    for _ in range(500):
        og.sim.step()

    env.close()

if __name__ == "__main__":
    main()