haosulab / ManiSkill

SAPIEN Manipulation Skill Framework, a GPU parallelized robotics simulator and benchmark
https://maniskill.ai/
Apache License 2.0
931 stars 168 forks source link

[Question] replay trajectories in the GPU simulation #563

Open YiJiangYue opened 2 months ago

YiJiangYue commented 2 months ago

hi, when i follow the instruction in diffusion policy and replay trajectories in the GPU simulation:

python -m mani_skill.trajectory.replay_trajectory \ --traj-path ~/.maniskill/demos/PickCube-v1/motionplanning/trajectory.h5 \ --use-first-env-state -c pd_ee_delta_pos -o state \ --save-traj --num-procs 1 -b gpu --count 100,

i got error log:

`Traceback (most recent call last):

File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
  return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
  exec(code, run_globals)
File "/mnt/volumes/autopilot-dreamwork-ga/cdq/ManiSkill/mani_skill/trajectory/replay_trajectory.py", line 337, in <module>
  main(parse_args())
File "/mnt/volumes/autopilot-dreamwork-ga/cdq/ManiSkill/mani_skill/trajectory/replay_trajectory.py", line 331, in main
  _main(args)
File "/mnt/volumes/autopilot-dreamwork-ga/cdq/ManiSkill/mani_skill/trajectory/replay_trajectory.py", line 259, in _main
  info = action_conversion.from_pd_joint_pos(
File "/mnt/volumes/autopilot-dreamwork-ga/cdq/ManiSkill/mani_skill/trajectory/utils/actions/conversion.py", line 186, in from_pd_joint_pos
  return from_pd_joint_pos_to_ee(**locals())
File "/mnt/volumes/autopilot-dreamwork-ga/cdq/ManiSkill/mani_skill/trajectory/utils/actions/conversion.py", line 113, in from_pd_joint_pos_to_ee
  pin_model = ori_controller.articulation.create_pinocchio_model()
File "/mnt/volumes/autopilot-dreamwork-ga/cdq/ManiSkill/mani_skill/utils/structs/articulation.py", line 683, in create_pinocchio_model
  raise NotImplementedError(

NotImplementedError: Cannot create a pinocchio model when GPU is enabled. If you wish to do inverse kinematics you must use fast_kinematics`

any solution?

StoneT2000 commented 2 months ago

Can you install the latest git commit of maniskill and try again?

chenyenru commented 2 months ago

Hi I'm still encountering the error after installing the latest git commit of maniskill via pip install --upgrade git+https://github.com/haosulab/ManiSkill.git.

I believe the root cause of this error is that create_pinocchio_model() is called in from_pd_joint_pos_to_ee regardless of device type. However, this could be problematic because pinocchio model cannot be created when GPU is enabled, hence why NotImplementedError("Cannot create a pinocchio model when GPU is enabled. If you wish to do inverse kinematics you must use fast_kinematics") is raised.

To work around this, I think the initialization of pin_model should be dependent on device type, i.e. use pinocchio model when using cpu and have inverse kinematics when using gpu.

I saw that compute_ik is recently added in kinematics.py. For next step, should kinematics.compute_ik be used in from_pd_joint_pos_to_ee when gpu is used instead of pinocchio model? Thank you