google-deepmind / dm_robotics

Libraries, tools and tasks created and used at DeepMind Robotics.
Apache License 2.0
332 stars 32 forks source link

IK control frame #6

Closed ikostrikov closed 2 years ago

ikostrikov commented 2 years ago

Thank you for sharing this great codebase!

I have a question regarding the control frame in sawyer.

What is the reason why cartesian 6d control is expressed in the world's orientation? https://github.com/deepmind/dm_robotics/blob/667a0776fbbe217867fc65d31a3de6749bbf3d54/py/moma/effectors/cartesian_6d_velocity_effector.py#L380

Is there a simple way to modify it to express velocity targets in the local orientation frame?

shacklestone commented 2 years ago

Hello,

This is configurable. You should use control_frame of the model_params argument.

Internally, the cartesian controller uses another controller to convert from cartesian velocity to joint velocities (it is this controller that has the world frame orientation assumption).

If you pass a control frame, then the cartesian command will be converted from that frame to the one that the underlying controller expects. This will achieve the result you are looking for.

shacklestone commented 2 years ago

Just to round this off, a control_frame like geometry.PoseStamped(frame=my_mujoco_element) might be the control frame you want. If you wanted to control a point that is off the element itself (E.g. a point in the middle of a gripper or in front of it) then you could also supply a pose to the PoseStamped initializer that would then be an offset from the frame itself.

shacklestone commented 2 years ago

Closing, assume resolved.