File size: 3,801 Bytes
dee27a2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376295f
dee27a2
 
 
 
376295f
 
 
dee27a2
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<mujoco model="drone_forest">
  <compiler angle="radian"/>

  <option timestep="0.002" gravity="0 0 -9.81" integrator="RK4"/>

  <default>
    <geom contype="1" conaffinity="1" condim="3" friction="1 0.5 0.5"/>
    <joint damping="0.01"/>
  </default>

  <asset>
    <texture name="grid" type="2d" builtin="checker" rgb1="0.3 0.6 0.3" rgb2="0.2 0.5 0.2"
             width="512" height="512"/>
    <material name="ground_mat" texture="grid" texrepeat="10 10" texuniform="true"
              reflectance="0.1"/>
    <material name="drone_body_mat" rgba="0.2 0.2 0.2 1"/>
    <material name="drone_arm_mat" rgba="0.4 0.4 0.4 1"/>
    <material name="rotor_mat" rgba="0.1 0.1 0.8 1"/>
    <material name="target_mat" rgba="1.0 0.0 0.0 0.6"/>
  </asset>

  <worldbody>
    <!-- Ground plane -->
    <geom name="ground" type="plane" size="25 25 0.1" material="ground_mat"
          contype="1" conaffinity="1"/>

    <!-- Drone -->
    <body name="drone" pos="0 0 1.5">
      <freejoint name="drone_joint"/>
      <inertial pos="0 0 0" mass="0.4" diaginertia="0.003 0.003 0.005"/>

      <!-- Central body -->
      <geom name="drone_body" type="box" size="0.06 0.06 0.025" material="drone_body_mat"
            mass="0.2" contype="1" conaffinity="1"/>

      <!-- Arm +X (front-right) -->
      <geom name="arm_fr" type="capsule" fromto="0.04 -0.04 0 0.14 -0.14 0"
            size="0.01" material="drone_arm_mat" mass="0.02" contype="0" conaffinity="0"/>
      <site name="rotor_fr" pos="0.14 -0.14 0.01" size="0.04 0.005" type="cylinder"
            rgba="0.1 0.1 0.8 0.5"/>

      <!-- Arm +X +Y (front-left) -->
      <geom name="arm_fl" type="capsule" fromto="0.04 0.04 0 0.14 0.14 0"
            size="0.01" material="drone_arm_mat" mass="0.02" contype="0" conaffinity="0"/>
      <site name="rotor_fl" pos="0.14 0.14 0.01" size="0.04 0.005" type="cylinder"
            rgba="0.1 0.1 0.8 0.5"/>

      <!-- Arm -X -Y (back-right) -->
      <geom name="arm_br" type="capsule" fromto="-0.04 -0.04 0 -0.14 -0.14 0"
            size="0.01" material="drone_arm_mat" mass="0.02" contype="0" conaffinity="0"/>
      <site name="rotor_br" pos="-0.14 -0.14 0.01" size="0.04 0.005" type="cylinder"
            rgba="0.1 0.1 0.8 0.5"/>

      <!-- Arm -X +Y (back-left) -->
      <geom name="arm_bl" type="capsule" fromto="-0.04 0.04 0 -0.14 0.14 0"
            size="0.01" material="drone_arm_mat" mass="0.02" contype="0" conaffinity="0"/>
      <site name="rotor_bl" pos="-0.14 0.14 0.01" size="0.04 0.005" type="cylinder"
            rgba="0.1 0.1 0.8 0.5"/>

      <!-- FPV camera (front-facing, slightly down) -->
      <camera name="drone_fpv" pos="0.08 0 -0.01" xyaxes="0 -1 0 0.1 0 1"
              fovy="90"/>
    </body>

    <!-- Target (visual only) -->
    <body name="target" pos="3 0 1.5">
      <geom name="target_geom" type="sphere" size="0.3" material="target_mat"
            contype="0" conaffinity="0"/>
    </body>

    <!-- Static overhead camera (does not track drone) -->
    <camera name="tracking" pos="0 0 15" xyaxes="1 0 0 0 1 0" mode="fixed"
            fovy="70"/>
  </worldbody>

  <!-- Site-based thrust actuators: force applied in site-local z (tilts with drone) -->
  <actuator>
    <general name="thrust_fr" site="rotor_fr" gear="0 0 1 0 0 0" ctrllimited="true"
             ctrlrange="0 3" gainprm="1" biasprm="0 0 0"/>
    <general name="thrust_fl" site="rotor_fl" gear="0 0 1 0 0 0" ctrllimited="true"
             ctrlrange="0 3" gainprm="1" biasprm="0 0 0"/>
    <general name="thrust_br" site="rotor_br" gear="0 0 1 0 0 0" ctrllimited="true"
             ctrlrange="0 3" gainprm="1" biasprm="0 0 0"/>
    <general name="thrust_bl" site="rotor_bl" gear="0 0 1 0 0 0" ctrllimited="true"
             ctrlrange="0 3" gainprm="1" biasprm="0 0 0"/>
  </actuator>
</mujoco>