<mujoco model="xarm6">
    <!-- <compiler angle="radian" meshdir="/home/aravind/allegro_ws/src/third_party/xarm_ros/xarm_description/meshes/xarm6/visual/" /> -->
    <compiler angle="radian"/>
    <size njmax="500" nconmax="100" />
    <!-- These are copied from panda -->
    <actuator>
        <!-- Physical limits of the actuator. -->
        <motor ctrllimited="true" ctrlrange="-80.0 80.0" joint="joint1" name="torq_j1"/>
        <motor ctrllimited="true" ctrlrange="-80.0 80.0" joint="joint2" name="torq_j2"/>
        <motor ctrllimited="true" ctrlrange="-80.0 80.0" joint="joint3" name="torq_j3"/>
        <motor ctrllimited="true" ctrlrange="-80.0 80.0" joint="joint4" name="torq_j4"/>
        <motor ctrllimited="true" ctrlrange="-80.0 80.0" joint="joint5" name="torq_j5"/>
        <motor ctrllimited="true" ctrlrange="-12.0 12.0" joint="joint6" name="torq_j6"/>
    </actuator>
    <asset>
<!--         <mesh name="base" file="base.stl" />
        <mesh name="link1" file="link1.stl" />
        <mesh name="link2" file="link2.stl" />
        <mesh name="link3" file="link3.stl" />
        <mesh name="link4" file="link4.stl" />
        <mesh name="link5" file="link5.stl" />
        <mesh name="link6" file="link6.stl" />
 -->        
        <mesh name="base" file="meshes/base.stl" />
        <mesh name="link1" file="meshes/link1.stl" />
        <mesh name="link2" file="meshes/link2.stl" />
        <mesh name="link3" file="meshes/link3.stl" />
        <mesh name="link4" file="meshes/link4.stl" />
        <mesh name="link5" file="meshes/link5.stl" />
        <mesh name="link6" file="meshes/link6.stl" />

        <mesh file="../common_meshes/pedestal.stl" name="pedestal"/>

        <!-- Custom textures based on body names for domain randomization -->
        <texture type="cube" name="pedestal_tex" builtin="flat" width="100" height="100" rgb1="0.2 0.2 0.2" rgb2="0.2 0.2 0.2"/>
        <texture type="cube" name="torso_tex" builtin="flat" width="100" height="100" rgb1="0.2 0.2 0.2" rgb2="0.2 0.2 0.2"/>
        <texture type="cube" name="arm_tex" builtin="flat" width="100" height="100" rgb1="1 1 1" rgb2="1 1 1"/>

        <!-- Custom mats based on body names for domain randomization -->
        <material name="pedestal_mat" texture="pedestal_tex"/>
        <material name="torso_mat" texture="torso_tex"/>
        <material name="arm_mat" texture="arm_tex"/>
        
    </asset>
    <worldbody>
        <body name="link0" pos="0 0 0">
            <body name="base" pos="0 0 0">

                <!-- robot view -->
                <camera mode="fixed" name="robotview" pos="1.0 0 0.4" quat="0.653 0.271 0.271 0.653"/>
                <inertial diaginertia="0 0 0" mass="0" pos="0 0 0"/>
                <body name="controller_box" pos="0 0 0">
                    <inertial diaginertia="1.71363 1.27988 0.809981" mass="46.64" pos="-0.325 0 -0.38"/>
                    <geom pos="-0.325 0 -0.38" size="0.11 0.2 0.265" type="box" name="controller_box_col"/>
                </body>
                <body name="pedestal_feet" pos="0 0 0">
                    <inertial diaginertia="8.16095 9.59375 15.0785" mass="167.09" pos="-0.1225 0 -0.758"/>
                    <geom pos="-0.1225 0 -0.758" size="0.385 0.35 0.155" type="box" name="pedestal_feet_col"/>
                </body>
                <body name="torso" pos="0 0 0">
                    <inertial diaginertia="1e-08 1e-08 1e-08" mass="0.0001" pos="0 0 0"/>
                    <geom conaffinity="0" contype="0" group="1" pos="0 0 -0.05" size="0.05 0.05 0.05" type="box" name="torso_col" material="torso_mat"/>
                </body>
                <body name="pedestal" pos="0 0 0">
                    <inertial diaginertia="6.0869 5.81635 4.20915" mass="60.864" pos="0 0 0" quat="0.659267 -0.259505 -0.260945 0.655692"/>
                    <geom conaffinity="0" contype="0" group="1" mesh="pedestal" type="mesh" name="pedestal_col1" material="pedestal_mat" />
                    <geom pos="-0.02 0 -0.29" rgba="0.2 0.2 0.2 1" size="0.18 0.31" type="cylinder" name="pedestal_col2"/>
                </body>
            </body>
            <!-- TODO add inertial here? -->
            <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="1 1 1 1" mesh="base" name="base"/>
            <geom type="mesh" rgba="1 1 1 1" mesh="base" name="base_collision"/>
            <body name="link1" pos="0 0 0.267">
                <inertial pos="-0.002 0.02692 -0.01332" quat="0.983139 0.180751 -0.00455228 0.0272976" mass="2.16" diaginertia="0.00539487 0.00519906 0.00281397" />
                <joint name="joint1" pos="0 0 0" axis="0 0 1" limited="true" range="-6.28319 6.28319" damping="1" frictionloss="1" />
                <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="1 1 1 1" mesh="link1" name="link1"/>
                <geom type="mesh" rgba="1 1 1 1" mesh="link1" name="link1_collision"/>
                <body name="link2" pos="0 0 0" quat="0.707105 -0.707108 0 0">
                    <inertial pos="0.03531 -0.21398 0.03386" quat="0.71118 0.614686 0.139936 -0.311132" mass="1.71" diaginertia="0.017867 0.017867 0.017867" />
                    <joint name="joint2" pos="0 0 0" axis="0 0 1" limited="true" range="-2.059 2.0944" damping="1" frictionloss="1" />
                    <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="1 1 1 1" mesh="link2" name="link"/>
                    <geom type="mesh" rgba="1 1 1 1" mesh="link2" name="link2_collision"/>
                    <body name="link3" pos="0.0535 -0.2845 0">
                        <inertial pos="0.06781 0.10749 0.01457" quat="0.119516 0.409082 -0.734824 0.527638" mass="1.384" diaginertia="0.004543 0.004543 0.004543" />
                        <joint name="joint3" pos="0 0 0" axis="0 0 1" limited="true" range="-3.927 0.19198" damping="1" frictionloss="1" />
                        <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="1 1 1 1" mesh="link3" name="link3"/>
                        <geom type="mesh" rgba="1 1 1 1" mesh="link3" name="link3_collision"/>
                        <body name="link4" pos="0.0775 0.3425 0" quat="0.707105 -0.707108 0 0">
                            <inertial pos="-0.00021 0.02578 -0.02538" quat="0.994019 0.0752563 -0.00686804 0.0788347" mass="1.115" diaginertia="0.00440091 0.00406855 0.00103407" />
                            <joint name="joint4" pos="0 0 0" axis="0 0 1" limited="true" range="-6.28319 6.28319" damping="1" frictionloss="1" />
                            <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="1 1 1 1" mesh="link4" name="link4"/>
                            <geom type="mesh" rgba="1 1 1 1" mesh="link4" name="link4_collision"/>
                            <body name="link5" pos="0 0 0" quat="0.707105 0.707108 0 0">
                                <inertial pos="0.05428 0.01781 0.00543" quat="-0.0766302 0.578118 -0.269638 0.766291" mass="1.275" diaginertia="0.00289757 0.0023276 0.000951789" />
                                <joint name="joint5" pos="0 0 0" axis="0 0 1" limited="true" range="-1.69297 3.14159" damping="1" frictionloss="1" />
                                <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="1 1 1 1" mesh="link5" name="link5"/>
                                <geom type="mesh" rgba="1 1 1 1" mesh="link5" name="link5_collision"/>
                                <body name="link6" pos="0.076 0.097 0" quat="0.707105 -0.707108 0 0">
                                    <inertial pos="0 0.00064 -0.00952" quat="0 0.707107 0 0.707107" mass="0.1096" diaginertia="7.9715e-05 4.8111e-05 4.5293e-05" />
                                    <joint name="joint6" pos="0 0 0" axis="0 0 1" limited="true" range="-6.28319 6.28319" damping="1" frictionloss="1" />
                                    <geom type="mesh" contype="0" conaffinity="0" group="1" rgba="0.753 0.753 0.753 1" mesh="link6" name="link6"/>
                                    <geom type="mesh" rgba="0.753 0.753 0.753 1" mesh="link6" name="link6_collision"/>
                                    <!-- TODO this is copied from pandaforallegro -->
                                    <!-- <body name="right_hand" pos="0 0 0.1"> -->
                                    <!-- rotate to align with hardware setup -->
                                    <body name="right_hand" pos="0 0 -0.01" euler="0 0 -1.5707963267948966">
                                            <inertial pos="0 0 0" mass="0.5" diaginertia="0.05 0.05 0.05" />
                                            <!-- This sites were added for visualization. They are all standardized between models-->
                                            <!-- Position mimics the gripper attachment point (right_hand) -->
                                            <!--  Y-axis should be perpendicular to grasping motion, and Z-axis should point out of the robot eef -->
                                            <site name="ee" pos="0 0 0" size="0.01 0.01 0.01" rgba="0 0 1 1" type="sphere" group="1"/>
                                            <site name="ee_x" pos="0 0 0" size="0.005 .1"  quat="0.707105 0.707108 0 0 " rgba="1 0 0 0" type="cylinder" group="1"/>
                                            <site name="ee_z" pos="0 0 0" size="0.005 .1" quat="0.707105 0 0 0.707108" rgba="0 0 1 0" type="cylinder" group="1"/>
                                            <site name="ee_y" pos="0 0 0" size="0.005 .1" quat="0.707105 0 0.707108 0 " rgba="0 1 0 0" type="cylinder" group="1"/>
                                            <!-- This camera points out from the eef. -->
                                            <camera mode="fixed" name="eye_in_hand" pos="0.05 0 0" quat="0 0.707108 0.707108 0" fovy="75"/>
                                            <!-- to add gripper -->
                                        </body>
                                </body>
                            </body>
                        </body>
                    </body>
                </body>
            </body>
        </body>
    </worldbody>
</mujoco>
