mujoco
mujoco copied to clipboard
how to rotate the first caspule of cable in mujoco model
I am trying to wrap a cable around the cylinder, this goal is achieved by giving the first capsule on the rope, the appropriate speed and rotation. But there is a problem in setting the rotation, I try to change the rotation angle of the joint, but it doesn't rotate to the angle I want.
for translation I set self.data.ctrl[11] = vnew[0] self.data.ctrl[12] = vnew[1] and it works good. But if I further set self.data.ctrl[13] = np.pi It doesnot work.
Here is a model which explains my question:
<body>
<geom type="box" size=".011 .011 .011" pos="-0.58 -0.23 0.33" condim="6" friction="0.6 0.6 0.6" />
<body name="CB0" pos="-0.58 -0.23 0.13" euler="0 0 0">
<joint name="pin" type="hinge" axis="0 0 1" damping="1" />
<joint name="pin1" type="hinge" axis="0 1 0" damping="1" />
<joint name="pin2" type="hinge" axis="1 0 0" damping="1" />
<joint name="sliderrrr" type="slide" axis="1 0 0"/>
<joint name="sliderrrr1" type="slide" axis="0 1 0"/>
<composite type="cable" curve="s" count="50 1 1" size="1" offset="0 0 0" initial="none">
<plugin plugin="mujoco.elasticity.cable">
<!--Units are in Pa (SI)-->
<config key="twist" value="1e7"/>
<config key="bend" value="4e6"/>
<config key="vmax" value="0.05"/>
</plugin>
<joint kind="main" damping=".015"/>
<geom type="capsule" size=".005" rgba=".8 .2 .1 1" condim="1"/>
</composite>
</body>
</body>
<body name="target" pos="0 -0.45 0.2" euler="0 0 0">
<geom name="tar" type="cylinder" size="0.1 0.1" rgba="0 .7 0 0.3"/>
</body>
<camera name="cam" mode="targetbody" pos="-2 -1 0.8" target="panda_hand" />
<light directional="true" diffuse=".2 .2 .2" specular="0 0 0" pos="0 1 5" dir="0 -1 -1" castshadow="false"/>
<light directional="false" diffuse=".8 .8 .8" specular="0.3 0.3 0.3" pos="0 -1 4" dir="0 0 -1" />
<light directional="true" diffuse="0 0 0" specular=".7 .7 .7" pos="0 3 3" dir="0 -3 -3" />
<geom name="floor" pos="0 0 0" group="1" size="0 0 .1" type="plane" material="plane" condim="3" />
Here is a screenshot / video, illustrating my question:
https://github.com/google-deepmind/mujoco/assets/83298044/40850bbb-6c3c-4650-90f1-54f67eef019a
Are you sure about your indexing? What type of actuator are you using?
Are you sure about your indexing? What type of actuator are you using? I am sure about the indexing, and the actuator is defined as following
<velocity name="slide" joint="sliderrrr" gear="1" ctrllimited="true" ctrlrange="-6 6"/>
<velocity name="slide1" joint="sliderrrr1" gear="1" ctrllimited="true" ctrlrange="-6 6"/>
<position name="rotation" joint="pin" gear="1" ctrllimited="true" ctrlrange="-1.571 1.571"/>
<position name="rotation1" joint="pin1" gear="1" ctrllimited="true" ctrlrange="-1.571 1.571"/>
<position name="rotation2" joint="pin2" gear="1" ctrllimited="true" ctrlrange="-1.571 1.571"/>