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

[Question] reset_mocapxbody() in mocap_set_action() #113

Open
matinmoezzi opened this issue Feb 16, 2023 · 3 comments
Open

[Question] reset_mocapxbody() in mocap_set_action() #113

matinmoezzi opened this issue Feb 16, 2023 · 3 comments
Labels
good first issue Good for newcomers

Comments

@matinmoezzi
Copy link

Question

Hi, I have a robotic arm and am controlling it using a mocap body and mocap_set_actoin() provided in mujoco_utils. What I am observing is that every time I call mocap_set_action, reset_mocapxbody() is called inside it which leads to an undesirable movement of the end-effector as it is trying to change the mocap body position. I am wondering if reset_mocapxbody is necessary for mocap_set_action. I understand the purpose of this function but it causes an extra unwanted movement of the end-effector.
Thanks.

@rodrigodelazcano
Copy link
Member

rodrigodelazcano commented Feb 17, 2023

Hey @matinmoezzi . I can give you an answer to why the reset function is used but I don't know for certain why you are experiencing extra end-effector displacements. It shouldn't be adding any extra movement to the end-effector body if the mocap is linked to it. Are you experiencing big displacements due to this reset function?

You are correct that this is a little redundant but it is a good sanity check to make sure that the mocap is at the same pose as the body it is linked to before adding the displacement action to the mocap.

@matinmoezzi
Copy link
Author

Hi @rodrigodelazcano,
Thank you for your response.
Yes. I understand what the reset function does. But, any changes in the position of the mocap result in a movement of the body because of the weld constraint. In fact, this procedure is the basis of mocap_set_action: changing mocap_pos -> changing end-effector pos
Moreover, I have experienced that the mocap pos could not be the same as the body pos since every mocap displacement could not lead to the body displacement because of inverse kinematics. Please correct me if my understanding is wrong.

@rodrigodelazcano
Copy link
Member

rodrigodelazcano commented Feb 19, 2023

@matinmoezzi yes you are correct, Mujoco will prioritize having a feasible IK configuration before following the mocap body (this is the reason the mocap is reset every step, to make sure that it doesn't grow to unachievable configurations).
A better way to implement the actions will be to calculate the new end-effector pose with the current end-effector body pose and then update the mocap's pose. However, I still don't see why resetting the mocap pose gives extra displacements.

Do you have the time to implement these changes in a PR?

@Kallinteris-Andreas Kallinteris-Andreas added the good first issue Good for newcomers label Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants