Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error transformation? #90

Open
zhoubohan0 opened this issue Jul 5, 2024 · 9 comments
Open

error transformation? #90

zhoubohan0 opened this issue Jul 5, 2024 · 9 comments

Comments

@zhoubohan0
Copy link

In https://github.com/haosulab/MPlib/blob/main/mplib/planner.py line 616-618:

    def _transform_goal_to_wrt_base(self, goal_pose: Pose) -> Pose:
        """Converts goal pose from T_world_goal to T_base_goal"""
        return self.robot.get_base_pose().inv() * goal_pose

the relative transformation from goal to base should be goal_to_world * world_to_base, resulting in goal_pose * self.robot.get_base_pose().inv() .

@Lexseal
Copy link
Collaborator

Lexseal commented Jul 6, 2024

hi! the poses here are all coordinate frames (not transforms that take points from one coord frame to another), so this is correct.

what issues are you experiencing right now? please let us know if you have any : )

@zhoubohan0
Copy link
Author

Thanks for your reply. Here transformations and coordinate frames are equivalent. In other words, the transformation from goal to world is just the goal coordinate frame in world frame. So I still have this ISSUE. In the current codes self.robot.get_base_pose() returns identity so it affects nothing.

@Lexseal
Copy link
Collaborator

Lexseal commented Jul 6, 2024

sure let’s go with this terminology. if you don’t set the base pose of the robot of course it will be identity. can you clarify what is the issue here? this function computes target wrt base. this is achieved by base -> world -> target.

@fuyh20
Copy link

fuyh20 commented Jul 7, 2024

@Lexseal I also have the same issue. (I'm new to robotics. Maybe I don't understand coordinate system transformations very well.)
In my understanding, the following formula should be correct.

$$^{goal}_{base}T = ^{goal}_{world}T ^{world}_{base}T = ^{goal}_{world}T (^{base}_{world}T)^{-1}$$

This is probably a really stupid question, but I'd like to know why the opposite multiplication should be done. Thanks! :)

@Lexseal
Copy link
Collaborator

Lexseal commented Jul 7, 2024

good question! so let’s say you have a frame B that is written with respect to frame A. that same frame B, if you see it as a transformation, takes points written with respect to coordinate B to coordinate A. i.e. frame and transforms are inverses of each other

@para133
Copy link

para133 commented Jul 11, 2024

I also have a problem with this part. When I run demo, it reports an error 'TypeError: can't multiply sequence by non-int of type 'mplib.pymp.Pose' '. So I try to fix the problem as follows

    def _transform_goal_to_wrt_base(self, goal_pose: Pose) -> Pose:
        """Converts goal pose from T_world_goal to T_base_goal"""
        goal_pose = Pose(goal_pose[:3],goal_pose[3:])
        return self.robot.get_base_pose().inv() * goal_pose 

I'm a beginner to this realm, maybe there are still some problems or better solutions, please tell me.

@Lexseal
Copy link
Collaborator

Lexseal commented Jul 11, 2024

can you attach the error message please?
the demos might not have been updated with mplib.pose and still using the 7 tulle numpy array

@para133
Copy link

para133 commented Jul 11, 2024

can you attach the error message please? the demos might not have been updated with mplib.pose and still using the 7 tulle numpy array

Traceback (most recent call last):
  File "……/anaconda3/envs/Sapien_MP/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "……/anaconda3/envs/Sapien_MP/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "……/StudySapien/Doc_mplib/demo.py", line 93, in <module>
    demo.demo()
  File "……/StudySapien/Doc_mplib/demo.py", line 74, in demo
    self.move_to_pose(pose)
  File "……/StudySapien/Doc_mplib/demo_setup.py", line 204, in move_to_pose
    return self.move_to_pose_with_screw(pose)
  File "……/StudySapien/Doc_mplib/demo_setup.py", line 189, in move_to_pose_with_screw
    result = self.planner.plan_screw(
  File "……/anaconda3/envs/Sapien_MP/lib/python3.10/site-packages/mplib/planner.py", line 724, in plan_screw
    goal_pose = self._transform_goal_to_wrt_base(goal_pose)
  File "……/anaconda3/envs/Sapien_MP/lib/python3.10/site-packages/mplib/planner.py", line 621, in _transform_goal_to_wrt_base
    return self.robot.get_base_pose().inv() * goal_pose
TypeError: can't multiply sequence by non-int of type 'mplib.pymp.Pose'

The detiled error messsage can be above.

@Lexseal
Copy link
Collaborator

Lexseal commented Jul 11, 2024

yeah sorry apparently the demos are not up to date : ((
They are still using the 7 tuple representation. You can convert these poses to mplib.pose quite easily though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants