how to define joint range in local coordinate?

Discussion in 'Modeling' started by lin, Jun 27, 2018.

  1. lin

    lin

    I'm using a "box" to simulate a simple car as follows:
    <worldbody>
    <light directional="true" cutoff="100" exponent="1" diffuse="1 1 1" specular=".1 .1 .1" pos="0 0 1.3"
    dir="-0 0 -1.3"/>
    <geom name='floor' material="MatPlane" pos='0 0 0' size='40 40 40' type='plane' conaffinity='1'
    rgba='0.8 0.9 0.8 1' condim='3'/>
    <!-- Arm -->
    <body name="torso" pos="0 0 0">
    <joint axis="0 0 1" name="rot" pos="0 0 0" type="hinge" range="-30 30" limited="true"/>
    <joint axis="1 0 0" name="slider" pos="0 0 0" type="slide"/>
    <geom fromto="0 0 0 0 0 0.2" size="0.25" type="cylinder"/>
    <geom pos=".15 0 0.25" size="0.1 0.1 0.05" type="box"/>
    </body>
    </worldbody>

    I expect that the orientation of the car is limited to range [-30, 30], and declare the above joint range. But the degree is always relative to the global axis. How can I limit the range of joint "rot" with respect to current orientation?

    Thanks a lot!