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

How to route a cable (over a pulley) #1624

Open
danachee opened this issue Apr 26, 2024 · 7 comments
Open

How to route a cable (over a pulley) #1624

danachee opened this issue Apr 26, 2024 · 7 comments
Labels
question Request for help or information

Comments

@danachee
Copy link

Hi,

I'm a engineer that is very new to this space and I'm trying to use MuJoCo for a simulation project.

I'm looking for some help with connecting both ends of a cable. One to the top of a beam (with a slider joint) and one to its payload.

Here is a model which explains my question:

The goal is to have a cable that is attached to a beam (at the top) and drapes over the end (where there would be a pulley). When the slider moves back, the payload rises. When the slider moves forward, the payload goes down. First problem, I cannot figure out how to get the end of the cable to attach to the slider "hook" (green box). And I would also like to make it ride along the beam (grey box) and drape off of the short edge. Imagine a fishing rod with a line going off the end with a weight on it.

Anyway, google hasn't turned up anyone who has connected a cable this way. Any hints??

Thanks!

<mujoco model="CableSlide">
  <include file="scene.xml"/>

  <extension>
    <plugin plugin="mujoco.elasticity.cable"/>
  </extension>

  <worldbody>
    <body name="payload">
      <geom type="box" size=".05 .05 .05" rgba=".5 .2 .8 1" mass="50"/>
      <freejoint/>
      <composite type="cable" curve="s" count="50" initial="ball">
        <pin coord="0"/>
        <joint kind="main" damping=".015"/>
        <geom type="capsule" size=".005" rgba=".8 .2 .1 1" condim="1"/>
      </composite>
    </body>
    <body name="beam" pos="0 0 .6">
      <geom type="box" size=".45 .0375 .0375" mass="100"/>
      <body name="slider" pos="0 .01 .05">
        <geom type="box" size=".01 .01 .01" rgba="0 1 0 1" mass="10"/>
        <joint name="jslider" type="slide" axis="1 0 0" damping=".1" limited="true" range="-.25 .25"/>
      </body>
    </body>
  </worldbody>

  <equality>
    <!-- <weld name="w0" body1="B_last" body2="slider" anchor="0 0 0"/> -->
    <connect name="c1" body1="slider" body2="B_last" anchor="0 0 0"/>
  </equality>
  <contact>
    <exclude body1="slider" body2="B_last"/>
  </contact>
  <actuator>
    <velocity name="slider" joint="jslider"/>
  </actuator>
</mujoco>

Here is a screenshot illustrating my question:
image

@danachee danachee added the question Request for help or information label Apr 26, 2024
@Balint-H
Copy link
Contributor

Balint-H commented Apr 26, 2024

Hello, could you answer a couple questions?

Does the fact that the cable can bend and twist at any point important, or would it be fine if it was piece-wise straight and only bent at the pulley?

Is the payload supposed to be able to be pulled on top of the beam, or only lifted up in the air?

Depending on the answers it may be more appropriate to simulate this system with tendons instead of cables.
Have a look at this example using tendons in pulley settings:

https://mujoco.readthedocs.io/en/stable/_static/tendon.xml

@danachee
Copy link
Author

Well, it would act like a fishing pole and string, so it would only bend as it goes over the edge of the rod, but it will then swing and spin around with the payload.

The payload will never be on top of the beam, just to the edge.

Is it true that tendons can stretch? In this case, like with a regular line/rope, it should maintain its length and not stretch or shrink.

Thanks!

@Balint-H
Copy link
Contributor

Tendons can be stretchable, but you can just as well define rigid, or rope-like tendons by defining a max length they can be. You can define geoms that a tendon must wrap around if its path would cross it as well.

@danachee
Copy link
Author

One other question, do tendons work with MuJoCo XLA (mjx)? That's the package we need to use.

Thanks for helping! And I'm guessing cables are not designed (yet?) to be routeable?

@Balint-H
Copy link
Contributor

Tendons are coming soon to MJX. If I understand correctly, plugins such as the elasticity are further down the line for support to be added for MJX (could you confirm @yuvaltassa)?

@danachee
Copy link
Author

danachee commented May 1, 2024

Do you have a rough ETA for the tendons? Weeks, months, ...?

Thanks!

@Balint-H
Copy link
Contributor

Balint-H commented May 2, 2024

I'm not involved with MJX development, however based on the pace of releases and the priority I heard it referenced to, my guesstimate is around a month. (Maybe ask for a more accurate estimate in the discord for a quicker reply?)

As features are released when close to 1:1 behaviour is expected, I can recommend starting with a CPU MuJoCo now, and then transitioning to MJX once it is updated.

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

No branches or pull requests

2 participants