google-deepmind / mujoco

Multi-Joint dynamics with Contact. A general purpose physics simulator.
https://mujoco.org
Apache License 2.0
8.27k stars 827 forks source link

How to firmly attach other bodies to the last joint of the cable? #2093

Closed avaa999 closed 2 months ago

avaa999 commented 2 months ago

Hello! I want to start by expressing my gratitude for the fantastic work and for sharing it with all of us!

In your example " mujoco/model/plugin/elasticity/cable.xml", the last joint of the cable is connected to the ball.

However, when I connect the last joint to a box, I notice that the box remains relatively stationary in position with respect to the last joint, but there is a relative orientation difference between them. I also tried using "weld,"

but the same issue persists. Is there a good solution to ensure that the box and joint are firmly connected without any relative pose difference?

avaa999 commented 2 months ago

111 222 I tried to use the following codes to bind the last joint of the cable to the box:

<equality>
    <!-- <connect name="right_boundary" body1="B_last" body2="slider" anchor=".025 0 0"/> -->
    <weld name="relpose" body1="slider" body2="B_last" relpose="0 0 0 1 0 0 0"/>
 </equality>

You can see that there is always a relative orientation difference between them during the translation of the box. Could you please give me some advice on how to avoid such a phenomenon? Thanks a lot!

yuvaltassa commented 2 months ago

Duplicate of #1243. Save the XML then make the body a child of the last element.

avaa999 commented 2 months ago

Thanks @yuvaltassa ! My problem has been solved. Thank-you very much for these informative and quick responses.

louisdehaybe commented 4 days ago

@avaa999 Hello, please can you share your final XML please ? I am struggling with the same issue. Thanks!

@yuvaltassa I tried what you are suggesting.

My original XML is: ```xml ```

I use this first XML fil to launch a simulation. As you suggested, I save the initial state (before running) in another XML which I modify according to your suggestion (putting the body that serves as gripper as child of the last body of the cable), which gives:

My second, modified XML is: ```xml ```

However, this does not work as expected. The simulation runs, but the right gripper is not constraining the end of the cable.

Can you specify in more details what I would need to change please ?

avaa999 commented 4 days ago

@louisdehaybe Hello! Here’s my current solution, but I’m afraid it still encounters the same issue you described. In my implementation, box3 and the static_box at the end of the rope are connected using a weld constraint, as shown below:

My scene including cable ```xml ```
MyCable_box.xml ```xml ```

However, when I try to actively move the right end of the rope to change its shape, these two objects fail to remain relatively stationary. I’m currently considering using a robotic gripper to directly hold box3 to add additional constraints. Unfortunately, I haven’t been able to resolve the issue completely yet.

If you’ve made any progress or found a solution, I’d greatly appreciate it if you could share it! I hope my attempt can also provide you with some inspiration. Thank you!