<mujoco model="ezgripper">
<!-- =================================================
	Copyright 2021 Vikash Kumar,
	Model	:: ezgripper (MuJoCoV2.0)
	Author	:: Vikash Kumar (vikashplus@gmail.com)
	source	:: https://github.com/vikashplus/ezgripper
	License	:: Under Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
====================================================== -©vk©-->
    <compiler angle="radian" settotalmass=".340"/>
    <size njmax="500" nconmax="100" />
    <asset>
        <mesh name="SAKE_Single_Mount" file="meshes/SAKE_Single_Mount.stl" />
        <mesh name="SAKE_Palm_IM" file="meshes/SAKE_Palm_IM.stl" />
        <mesh name="SAKE_Finger_L1_IM" file="meshes/SAKE_Finger_L1_IM.stl" />
        <mesh name="SAKE_Finger_L2_IM" file="meshes/SAKE_Finger_L2_IM.stl" />
        <mesh name="SAKE_Finger_Pad_IM" file="meshes/SAKE_Finger_Pad_IM.stl" />
    </asset>

    <default>
        <default class="ezgripper">
            <joint damping="0.005" limited="true"/>
            <geom contype="1" conaffinity="0" group="4" type="mesh" rgba=".5 .6 .7 1"/>
            <default class="ezgripper_viz">
                <geom contype="0" conaffinity="0" group="1" type="mesh" rgba=".17 .42 .63 1"/>
            </default>
            <default class="ezgripper_mech">
                <geom contype="0" conaffinity="0" group="1" type="cylinder" rgba="1 0 0 1"/>
                <site rgba="1 0 0 1"/>
            </default>
        </default>
    </default>

    <contact>
        <exclude body1="mount" body2="F1_L1"/>
        <exclude body1="mount" body2="F2_L1"/>
        <pair geom1="f1_tip" geom2="f2_tip" condim="1"/>
        <pair geom1="f1_tip" geom2="f2l1" condim="1"/>
        <pair geom1="f2_tip" geom2="f1l1" condim="1"/>
    </contact>

    <worldbody>
        <geom name='floor' pos='0.1 0 0' size='.4 .4 .125' type='plane' condim='3'/>
        <light directional='false' diffuse='.8 .8 .8' specular='0.3 0.3 0.3' pos='0 0 1.0' dir='0 0 -1'/>

        <!-- PALM -©vk©-->
        <body name="mount" pos="0 0 .1" childclass="ezgripper">
            <geom class="ezgripper_viz" mesh="SAKE_Single_Mount" />
            <geom type="mesh" mesh="SAKE_Single_Mount"/>
            <geom pos="0.016 0 0" class="ezgripper_viz" mesh="SAKE_Palm_IM"/>
            <geom pos="0.016 0 0" type="mesh" mesh="SAKE_Palm_IM"/>
            <geom name="palm_pulley_f1" type="cylinder" size=".006 0.006" pos="0.0755 0.010 0" class="ezgripper_mech"/>
            <geom name="palm_pulley_f2" type="cylinder" size=".006 0.006" pos="0.0755 -.010 0" class="ezgripper_mech"/>
            <site name="palm_peg0" pos=".022 0 0" size=".002"/>
            <site name="palm_peg1" pos=".063 0 0" size=".002"/>
            <site name="palm_peg2" pos=".085 0 0" size=".002"/>

            <!-- FINGER1 -©vk©-->
            <body name="F1_L1" pos="0.0755 0.03 0" quat="0.707105 -0.707108 0 0">
                <joint name="F1_palm_knuckle" pos="0 0 0" axis="0 1 0" range="-1.57075 0.27" stiffness="0.05114105365" springref="-3.14"/>
                <geom class="ezgripper_viz" mesh="SAKE_Finger_L1_IM" rgba="1 1 1 1"/>
                <geom name="f1l1" type="mesh" mesh="SAKE_Finger_L1_IM"/>
                <geom name="f1l1_pulley" type="cylinder" size=".006 0.006" pos="0.022 0 -.002" class="ezgripper_mech" euler="1.57 0 0"/>
                <site name="f1l1_pulleyside" pos=".022 0 .007" size=".002"/>
                <site name="f1l1_peg0" pos=".0115 0 -.007" size=".002"/>
                <site name="f1l1_peg1" pos=".0355 0 -.006" size=".002"/>

                <body name="F1_L2" pos="0.052 0 0">
                    <joint name="F1_knuckle_tip" pos="0 0 0" axis="0 1 0" range="0 1.7" stiffness="0.02459949416" springref="-1.57"/>
                    <geom pos="0 0 0" class="ezgripper_viz" mesh="SAKE_Finger_L2_IM" rgba="1 1 1 1"/>
                    <geom pos="0 0 0" type="mesh" mesh="SAKE_Finger_L2_IM" />
                    <geom pos="0.01849 0 0" quat="0.993291 0 -0.115641 0" class="ezgripper_viz" mesh="SAKE_Finger_Pad_IM" rgba=".2 .2 .2 1"/>
                    <geom name="f1_tip" pos="0.01849 0 0" quat="0.993291 0 -0.115641 0" type="mesh" mesh="SAKE_Finger_Pad_IM" rgba=".2 .2 .2 1"/>
                    <geom name="f1l2_pulley" type="cylinder" size=".006 0.006" class="ezgripper_mech" euler="1.57 0 0"/>
                    <site name="f1l2_peg" pos=".011 0 -.004" size=".002"/>
                    <site name="f1l2_pin" pos=".0185 0 0" size=".002"/>
                </body>
            </body>

            <!-- FINGER2 -©vk©-->
            <body name="F2_L1" pos="0.0755 -0.03 0" quat="0.707105 0.707108 0 0">
                <joint name="F2_palm_knuckle" pos="0 0 0" axis="0 1 0" range="-1.57075 0.27" stiffness="0.05114105365" springref="-3.14"/>
                <geom class="ezgripper_viz" mesh="SAKE_Finger_L1_IM" rgba="1 1 1 1"/>
                <geom name="f2l1" type="mesh" mesh="SAKE_Finger_L1_IM" />
                <geom name="f2l1_pulley"  type="cylinder" size=".006 0.006" pos="0.022 0 -.002" class="ezgripper_mech" euler="1.57 0 0"/>
                <site name="f2l1_pulleyside" pos=".022 0 .007" size=".002"/>
                <site name="f2l1_peg0" pos=".0115 0 -.007" size=".002"/>
                <site name="f2l1_peg1" pos=".0355 0 -.006" size=".002"/>

                <body name="F2_L2" pos="0.052 0 0">
                    <joint name="F2_knuckle_tip" pos="0 0 0" axis="0 1 0" range="0 1.7" stiffness="0.02459949416" springref="-1.57"/>
                    <geom pos="0 0 0" class="ezgripper_viz" mesh="SAKE_Finger_L2_IM" rgba="1 1 1 1"/>
                    <geom pos="0 0 0" type="mesh" mesh="SAKE_Finger_L2_IM" />
                    <geom pos="0.01849 0 0" quat="0.993291 0 -0.115641 0" class="ezgripper_viz" mesh="SAKE_Finger_Pad_IM" rgba=".2 .2 .2 1"/>
                    <geom name="f2_tip" pos="0.01849 0 0" quat="0.993291 0 -0.115641 0" type="mesh" mesh="SAKE_Finger_Pad_IM" rgba=".2 .2 .2 1"/>
                    <geom name="f2l2_pulley" type="cylinder" size=".006 0.006" class="ezgripper_mech" euler="1.57 0 0"/>
                    <site name="f2l2_peg" pos=".011 0 -.004" size=".002"/>
                    <site name="f2l2_pin" pos=".0185 0 0" size=".002"/>
                </body>
            </body>
        </body>

    </worldbody>

    <tendon>
        <spatial name="flex_tendon" limited="false" range="0.145 0.146">
            <site site="palm_peg0"/>
            <site site="palm_peg1"/>
            <!-- branch1 -©vk©-->
            <pulley divisor="2"/>
            <site site="palm_peg1"/>
            <geom geom="palm_pulley_f1" sidesite="palm_peg2"/>
            <site site="f1l1_peg0"/>
            <geom geom="f1l1_pulley" sidesite="f1l1_pulleyside"/>
            <site site="f1l1_peg1"/>
            <geom geom="f1l2_pulley"/>
            <site site="f1l2_peg"/>
            <site site="f1l2_pin"/>
            <!-- branch2 -©vk©-->
            <pulley divisor="2"/>
            <site site="palm_peg1"/>
            <geom geom="palm_pulley_f2" sidesite="palm_peg2"/>
            <site site="f2l1_peg0"/>
            <geom geom="f2l1_pulley" sidesite="f2l1_pulleyside"/>
            <site site="f2l1_peg1"/>
            <geom geom="f2l2_pulley"/>
            <site site="f2l2_peg"/>
            <site site="f2l2_pin"/>

        </spatial>
    </tendon>

    <actuator>
        <motor tendon="flex_tendon" gear="50" ctrllimited="true" ctrlrange="-1 0"/>
    </actuator>

</mujoco>
