ManiSkill icon indicating copy to clipboard operation
ManiSkill copied to clipboard

Handle Tensor inputs in motion planning

Open dennisushi opened this issue 1 year ago • 1 comments

https://github.com/haosulab/ManiSkill/blob/825dc6ce094ed072e1574954645fb6bbf008153a/mani_skill/examples/motionplanning/panda/motionplanner.py#L103-L107

This causes a bug when the input pose has torch tensor position/quaternion (which some of the example codes use), causing:

TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. sapien.pysapien.Pose(p: numpy.ndarray[typing.Literal[3], numpy.dtype[numpy.float32]] = array([0., 0., 0.], dtype=float32), q: numpy.ndarray[typing.Literal[4], numpy.dtype[numpy.float32]] = array([1., 0., 0., 0.], dtype=float32))
    2. sapien.pysapien.Pose(matrix: numpy.ndarray[numpy.float32[4, 4]])

Invoked with: kwargs: p=tensor([[-0.1104, -0.0963,  0.1407]]), q=tensor([[ 8.9848e-01, -1.5013e-06,  3.8743e-07,  4.3902e-01]])

The solution is straightforward -- at the top of the function on L105, add the same as in motion planning with screw motion:

        pose = to_sapien_pose(pose)

dennisushi avatar Aug 01 '24 15:08 dennisushi

Yep this is the correct fix, I think it was there because we never used RRT in our examples. If you make a PR i can go and review/merge it

StoneT2000 avatar Aug 01 '24 17:08 StoneT2000