Is there a possibility to set up initial joint positions before running the simulation in Unity?

I need to find a way to set up custom joint positions before the simulation starts. Is there a way to do this?

Hi @agru , are you using ArticulationBody components on the joints? Before the simulation starts, the initial joint positions can be set via the Transform in the Editor. If it is a prismatic or revolute joint, you may need to carefully choose the right axis.

  1. select the joint
  2. find the ArticulationBody component and the corresponding Transform component in the Inspector
  3. change the values in the Transform component (positions or rotations)

If you are importing the articulation body from a URDF file using the URDF-Importer, it is also possible to set the initial joint positions in the file.

1 Like

Thanks for your reply. But I think there is no specific tag for initial joint positions in URDF. Or am I wrong?
And yes, I am using Articulation Bodies. But it would be better if I can change them directly in the URDF.

You could rotate the joint initial position by updating the “rpy” attribute in the field. For example, the original joint definition in the URDF is the following

 <joint name="joint_2" type="revolute">
    <parent link="link_1"/>
    <child link="link_2"/>
    <origin rpy="0 0 0" xyz="0.040 0 0"/>
    <axis xyz="0 1 0"/>
    <limit effort="176.4" lower="-1.1344" upper="2.5307" velocity="6.7195"/>
  </joint>

and you could rotate the link by 90 degrees using the “rpy” in the origin field

 <joint name="joint_2" type="revolute">
    <parent link="link_1"/>
    <child link="link_2"/>
    <origin rpy="0 1.57 0" xyz="0.040 0 0"/>
    <axis xyz="0 1 0"/>
    <limit effort="176.4" lower="-1.1344" upper="2.5307" velocity="6.7195"/>
  </joint>

Please let us know if it makes sense to you?

1 Like