#VRML_SIM R2025a utf8
# Shepherd Dog Robot - mecanum-wheeled base with dog character on top
# 4-wheel omnidirectional drive (front-left, front-right, rear-left, rear-right).

PROTO ShepherdDogMecanum360 [
  field SFVec3f    translation     0 0 0
  field SFRotation rotation        0 1 0 0
  field SFString   name            "ShepherdDog"
  field SFString   controller      "shepherd_dog"
  field MFString   controllerArgs  []
  field SFString   customData      ""
  field SFBool     supervisor      TRUE
  field SFBool     synchronization TRUE
]
{
  Robot {
    translation IS translation
    rotation IS rotation
    name IS name
    controller IS controller
    controllerArgs IS controllerArgs
    customData IS customData
    supervisor IS supervisor
    synchronization IS synchronization
    children [
      # ========== CHASSIS / BASE ==========
      DEF CHASSIS Transform {
        translation 0 0 0.05
        children [
          Shape {
            appearance DEF CHASSIS_APP PBRAppearance {
              baseColor 0.2 0.2 0.2
              roughness 0.6
              metalness 0.3
            }
            geometry Box {
              size 0.32 0.16 0.06
            }
          }
        ]
      }
      # Front slope
      DEF CHASSIS_FRONT Transform {
        translation 0.14 0 0.07
        children [
          Shape {
            appearance USE CHASSIS_APP
            geometry Box {
              size 0.06 0.14 0.04
            }
          }
        ]
      }
      # Rear slope
      DEF CHASSIS_REAR Transform {
        translation -0.14 0 0.07
        children [
          Shape {
            appearance USE CHASSIS_APP
            geometry Box {
              size 0.06 0.14 0.04
            }
          }
        ]
      }

      # ========== DOG BODY on top of chassis ==========
      DEF BODY Transform {
        translation 0 0 0.11
        children [
          Shape {
            appearance DEF FUR_BROWN PBRAppearance {
              baseColor 0.55 0.35 0.17
              roughness 0.85
              metalness 0.0
            }
            geometry Box {
              size 0.30 0.16 0.08
            }
          }
        ]
      }

      # ========== CHEST ==========
      DEF CHEST Transform {
        translation 0.12 0 0.11
        children [
          Shape {
            appearance DEF FUR_CREAM PBRAppearance {
              baseColor 0.85 0.72 0.55
              roughness 0.85
              metalness 0.0
            }
            geometry Box {
              size 0.08 0.18 0.08
            }
          }
        ]
      }

      # ========== HEAD ==========
      DEF HEAD Transform {
        translation 0.20 0 0.17
        children [
          Shape {
            appearance USE FUR_BROWN
            geometry Box {
              size 0.10 0.12 0.09
            }
          }
        ]
      }

      # ========== SNOUT + LIDAR ==========
      DEF SNOUT Transform {
        translation 0.28 0 0.155
        children [
          Shape {
            appearance USE FUR_CREAM
            geometry Box {
              size 0.08 0.07 0.05
            }
          }
          # Nose
          Transform {
            translation 0.04 0 0.01
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.1 0.1 0.1
                  roughness 0.4
                }
                geometry Sphere {
                  radius 0.013
                  subdivision 2
                }
              }
            ]
          }
          # Lidar — full 360° FOV (mecanum 360 variant)
          Lidar {
            translation 0.05 0 0.01
            name "lidar"
            horizontalResolution 360
            fieldOfView 6.28
            numberOfLayers 1
            minRange 0.10
            maxRange 15.0
            noise 0.005
          }
        ]
      }

      # ========== LEFT EAR ==========
      DEF LEFT_EAR HingeJoint {
        jointParameters HingeJointParameters {
          axis 0 0 1
          anchor 0.19 0.055 0.21
        }
        device [
          RotationalMotor {
            name "left ear motor"
            maxVelocity 10.0
            minPosition -0.5
            maxPosition 0.5
          }
        ]
        endPoint Solid {
          translation 0.19 0.055 0.21
          rotation 0 0 1 0.2
          name "left ear"
          children [
            Shape {
              appearance DEF FUR_DARK PBRAppearance {
                baseColor 0.35 0.20 0.10
                roughness 0.85
                metalness 0.0
              }
              geometry Box {
                size 0.035 0.025 0.06
              }
            }
          ]
          boundingObject Box {
            size 0.035 0.025 0.06
          }
          physics Physics {
            density -1
            mass 0.005
          }
        }
      }

      # ========== RIGHT EAR ==========
      DEF RIGHT_EAR HingeJoint {
        jointParameters HingeJointParameters {
          axis 0 0 1
          anchor 0.19 -0.055 0.21
        }
        device [
          RotationalMotor {
            name "right ear motor"
            maxVelocity 10.0
            minPosition -0.5
            maxPosition 0.5
          }
        ]
        endPoint Solid {
          translation 0.19 -0.055 0.21
          rotation 0 0 -1 0.2
          name "right ear"
          children [
            Shape {
              appearance USE FUR_DARK
              geometry Box {
                size 0.035 0.025 0.06
              }
            }
          ]
          boundingObject Box {
            size 0.035 0.025 0.06
          }
          physics Physics {
            density -1
            mass 0.005
          }
        }
      }

      # ========== EYES ==========
      DEF LEFT_EYE Transform {
        translation 0.25 0.05 0.19
        children [
          Shape {
            appearance PBRAppearance {
              baseColor 0.95 0.95 0.95
              roughness 0.3
            }
            geometry Sphere {
              radius 0.016
              subdivision 2
            }
          }
          # Pupil
          Transform {
            translation 0.012 0 0.004
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.1 0.1 0.1
                  roughness 0.2
                }
                geometry Sphere {
                  radius 0.009
                  subdivision 2
                }
              }
            ]
          }
        ]
      }
      DEF RIGHT_EYE Transform {
        translation 0.25 -0.05 0.19
        children [
          Shape {
            appearance PBRAppearance {
              baseColor 0.95 0.95 0.95
              roughness 0.3
            }
            geometry Sphere {
              radius 0.016
              subdivision 2
            }
          }
          # Pupil
          Transform {
            translation 0.012 0 0.004
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.1 0.1 0.1
                  roughness 0.2
                }
                geometry Sphere {
                  radius 0.009
                  subdivision 2
                }
              }
            ]
          }
        ]
      }

      # ========== COLLAR ==========
      DEF COLLAR Transform {
        translation 0.16 0 0.125
        children [
          Shape {
            appearance PBRAppearance {
              baseColor 0.8 0.1 0.1
              roughness 0.5
            }
            geometry Cylinder {
              height 0.02
              radius 0.095
              subdivision 16
            }
          }
          # ID tag
          Transform {
            translation 0 0.10 0
            rotation 1 0 0 1.5708
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.75 0.75 0.0
                  metalness 0.8
                  roughness 0.2
                }
                geometry Cylinder {
                  height 0.003
                  radius 0.018
                  subdivision 8
                }
              }
            ]
          }
        ]
      }

      # ========== TAIL (lidar inside tail tip ball) ==========
      DEF TAIL HingeJoint {
        jointParameters HingeJointParameters {
          axis 0 1 0
          anchor -0.15 0 0.11
        }
        device [
          RotationalMotor {
            name "tail motor"
            maxVelocity 5.0
            minPosition -1.0
            maxPosition 1.0
          }
        ]
        endPoint Solid {
          translation -0.17 0 0.13
          name "tail solid"
          children [
            Shape {
              appearance USE FUR_BROWN
              geometry Capsule {
                height 0.12
                radius 0.013
                top FALSE
              }
            }
            # Tail tip ball
            Transform {
              translation 0 0 0.08
              children [
                Shape {
                  appearance PBRAppearance {
                    baseColor 0.2 0.2 0.2
                    roughness 0.3
                    metalness 0.6
                  }
                  geometry Sphere {
                    radius 0.028
                    subdivision 4
                  }
                }
              ]
            }
          ]
          boundingObject Group {
            children [
              Capsule {
                height 0.12
                radius 0.013
              }
              Transform {
                translation 0 0 0.08
                children [
                  Sphere {
                    radius 0.028
                  }
                ]
              }
            ]
          }
          physics Physics {
            density -1
            mass 0.08
          }
        }
      }

      # ========== AXLE ARMS (4 corners) ==========
      DEF FRONT_RIGHT_AXLE Transform {
        translation 0.14 -0.115 0.038
        children [
          Shape {
            appearance PBRAppearance {
              baseColor 0.5 0.5 0.5
              roughness 0.3
              metalness 0.8
            }
            geometry Box {
              size 0.02 0.08 0.02
            }
          }
        ]
      }
      DEF FRONT_LEFT_AXLE Transform {
        translation 0.14 0.115 0.038
        children [
          Shape {
            appearance PBRAppearance {
              baseColor 0.5 0.5 0.5
              roughness 0.3
              metalness 0.8
            }
            geometry Box {
              size 0.02 0.08 0.02
            }
          }
        ]
      }
      DEF REAR_RIGHT_AXLE Transform {
        translation -0.14 -0.115 0.038
        children [
          Shape {
            appearance PBRAppearance {
              baseColor 0.5 0.5 0.5
              roughness 0.3
              metalness 0.8
            }
            geometry Box {
              size 0.02 0.08 0.02
            }
          }
        ]
      }
      DEF REAR_LEFT_AXLE Transform {
        translation -0.14 0.115 0.038
        children [
          Shape {
            appearance PBRAppearance {
              baseColor 0.5 0.5 0.5
              roughness 0.3
              metalness 0.8
            }
            geometry Box {
              size 0.02 0.08 0.02
            }
          }
        ]
      }

      # ========== FRONT RIGHT WHEEL ==========
      DEF FRONT_RIGHT_WHEEL_JOINT HingeJoint {
        jointParameters HingeJointParameters {
          axis 0 1 0
          anchor 0.14 -0.14 0.038
        }
        device [
          RotationalMotor {
            name "front right wheel motor"
            maxVelocity 70.0
            maxTorque 20.0
          }
          PositionSensor {
            name "front right wheel sensor"
            resolution 0.00628
          }
        ]
        endPoint Solid {
          translation 0.14 -0.14 0.038
          rotation 0 -1 0 1.570796
          children [
            # Visual hub only — the rollers below provide ground contact.
            Pose {
              rotation 1 0 0 -1.5708
              children [
                Shape {
                  appearance PBRAppearance {
                    baseColor 0.5 0.5 0.5
                    roughness 0.3
                    metalness 0.7
                  }
                  geometry Cylinder {
                    height 0.018
                    radius 0.018000000000000002
                    subdivision 16
                  }
                }
                Shape {
                  appearance PBRAppearance {
                    baseColor 0.6 0.6 0.6
                    roughness 0.2
                    metalness 0.8
                  }
                  geometry Cylinder {
                    height 0.022
                    radius 0.008
                    subdivision 8
                  }
                }
              ]
            }
        # Mecanum roller 1 (θ=0°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.707107 0.707107 0.000000
            anchor 0.000000 0.000000 -0.031000
          }
          endPoint Solid {
            translation 0.000000 0.000000 -0.031000
            rotation 0.000000 0.000000 -1.000000 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front right roller 1"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 2 (θ=45°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.500000 0.707107 0.500000
            anchor 0.021920 0.000000 -0.021920
          }
          endPoint Solid {
            translation 0.021920 0.000000 -0.021920
            rotation 0.707107 0.000000 -0.707107 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front right roller 2"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 3 (θ=90°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.000000 0.707107 0.707107
            anchor 0.031000 0.000000 -0.000000
          }
          endPoint Solid {
            translation 0.031000 0.000000 -0.000000
            rotation 1.000000 0.000000 -0.000000 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front right roller 3"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 4 (θ=135°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.500000 0.707107 0.500000
            anchor 0.021920 0.000000 0.021920
          }
          endPoint Solid {
            translation 0.021920 0.000000 0.021920
            rotation 0.707107 0.000000 0.707107 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front right roller 4"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 5 (θ=180°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.707107 0.707107 0.000000
            anchor 0.000000 0.000000 0.031000
          }
          endPoint Solid {
            translation 0.000000 0.000000 0.031000
            rotation 0.000000 0.000000 1.000000 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front right roller 5"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 6 (θ=225°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.500000 0.707107 -0.500000
            anchor -0.021920 0.000000 0.021920
          }
          endPoint Solid {
            translation -0.021920 0.000000 0.021920
            rotation -0.707107 0.000000 0.707107 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front right roller 6"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 7 (θ=270°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.000000 0.707107 -0.707107
            anchor -0.031000 0.000000 0.000000
          }
          endPoint Solid {
            translation -0.031000 0.000000 0.000000
            rotation -1.000000 0.000000 0.000000 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front right roller 7"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 8 (θ=315°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.500000 0.707107 -0.500000
            anchor -0.021920 0.000000 -0.021920
          }
          endPoint Solid {
            translation -0.021920 0.000000 -0.021920
            rotation -0.707107 0.000000 -0.707107 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front right roller 8"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
          ]
          name "front right wheel"
          boundingObject Pose {
            rotation 1 0 0 -1.5708
            children [
              Cylinder {
                height 0.022
                radius 0.02
              }
            ]
          }
          physics Physics {
            density -1
            mass 0.045
            centerOfMass [
              0 0 0
            ]
          }
        }
      }

      # ========== FRONT LEFT WHEEL ==========
      DEF FRONT_LEFT_WHEEL_JOINT HingeJoint {
        jointParameters HingeJointParameters {
          axis 0 1 0
          anchor 0.14 0.14 0.038
        }
        device [
          RotationalMotor {
            name "front left wheel motor"
            maxVelocity 70.0
            maxTorque 20.0
          }
          PositionSensor {
            name "front left wheel sensor"
            resolution 0.00628
          }
        ]
        endPoint Solid {
          translation 0.14 0.14 0.038
          rotation 0 -1 0 1.570796
          children [
            # Visual hub only — the rollers below provide ground contact.
            Pose {
              rotation 1 0 0 -1.5708
              children [
                Shape {
                  appearance PBRAppearance {
                    baseColor 0.5 0.5 0.5
                    roughness 0.3
                    metalness 0.7
                  }
                  geometry Cylinder {
                    height 0.018
                    radius 0.018000000000000002
                    subdivision 16
                  }
                }
                Shape {
                  appearance PBRAppearance {
                    baseColor 0.6 0.6 0.6
                    roughness 0.2
                    metalness 0.8
                  }
                  geometry Cylinder {
                    height 0.022
                    radius 0.008
                    subdivision 8
                  }
                }
              ]
            }
        # Mecanum roller 1 (θ=0°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.707107 -0.707107 0.000000
            anchor 0.000000 0.000000 -0.031000
          }
          endPoint Solid {
            translation 0.000000 0.000000 -0.031000
            rotation 0.000000 0.000000 -1.000000 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front left roller 1"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 2 (θ=45°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.500000 -0.707107 0.500000
            anchor 0.021920 0.000000 -0.021920
          }
          endPoint Solid {
            translation 0.021920 0.000000 -0.021920
            rotation 0.707107 0.000000 -0.707107 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front left roller 2"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 3 (θ=90°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.000000 -0.707107 0.707107
            anchor 0.031000 0.000000 -0.000000
          }
          endPoint Solid {
            translation 0.031000 0.000000 -0.000000
            rotation 1.000000 0.000000 -0.000000 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front left roller 3"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 4 (θ=135°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.500000 -0.707107 0.500000
            anchor 0.021920 0.000000 0.021920
          }
          endPoint Solid {
            translation 0.021920 0.000000 0.021920
            rotation 0.707107 0.000000 0.707107 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front left roller 4"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 5 (θ=180°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.707107 -0.707107 0.000000
            anchor 0.000000 0.000000 0.031000
          }
          endPoint Solid {
            translation 0.000000 0.000000 0.031000
            rotation 0.000000 0.000000 1.000000 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front left roller 5"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 6 (θ=225°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.500000 -0.707107 -0.500000
            anchor -0.021920 0.000000 0.021920
          }
          endPoint Solid {
            translation -0.021920 0.000000 0.021920
            rotation -0.707107 0.000000 0.707107 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front left roller 6"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 7 (θ=270°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.000000 -0.707107 -0.707107
            anchor -0.031000 0.000000 0.000000
          }
          endPoint Solid {
            translation -0.031000 0.000000 0.000000
            rotation -1.000000 0.000000 0.000000 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front left roller 7"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 8 (θ=315°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.500000 -0.707107 -0.500000
            anchor -0.021920 0.000000 -0.021920
          }
          endPoint Solid {
            translation -0.021920 0.000000 -0.021920
            rotation -0.707107 0.000000 -0.707107 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "front left roller 8"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
          ]
          name "front left wheel"
          boundingObject Pose {
            rotation 1 0 0 -1.5708
            children [
              Cylinder {
                height 0.022
                radius 0.02
              }
            ]
          }
          physics Physics {
            density -1
            mass 0.045
            centerOfMass [
              0 0 0
            ]
          }
        }
      }

      # ========== REAR RIGHT WHEEL ==========
      DEF REAR_RIGHT_WHEEL_JOINT HingeJoint {
        jointParameters HingeJointParameters {
          axis 0 1 0
          anchor -0.14 -0.14 0.038
        }
        device [
          RotationalMotor {
            name "rear right wheel motor"
            maxVelocity 70.0
            maxTorque 20.0
          }
          PositionSensor {
            name "rear right wheel sensor"
            resolution 0.00628
          }
        ]
        endPoint Solid {
          translation -0.14 -0.14 0.038
          rotation 0 -1 0 1.570796
          children [
            # Visual hub only — the rollers below provide ground contact.
            Pose {
              rotation 1 0 0 -1.5708
              children [
                Shape {
                  appearance PBRAppearance {
                    baseColor 0.5 0.5 0.5
                    roughness 0.3
                    metalness 0.7
                  }
                  geometry Cylinder {
                    height 0.018
                    radius 0.018000000000000002
                    subdivision 16
                  }
                }
                Shape {
                  appearance PBRAppearance {
                    baseColor 0.6 0.6 0.6
                    roughness 0.2
                    metalness 0.8
                  }
                  geometry Cylinder {
                    height 0.022
                    radius 0.008
                    subdivision 8
                  }
                }
              ]
            }
        # Mecanum roller 1 (θ=0°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.707107 -0.707107 0.000000
            anchor 0.000000 0.000000 -0.031000
          }
          endPoint Solid {
            translation 0.000000 0.000000 -0.031000
            rotation 0.000000 0.000000 -1.000000 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear right roller 1"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 2 (θ=45°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.500000 -0.707107 0.500000
            anchor 0.021920 0.000000 -0.021920
          }
          endPoint Solid {
            translation 0.021920 0.000000 -0.021920
            rotation 0.707107 0.000000 -0.707107 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear right roller 2"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 3 (θ=90°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.000000 -0.707107 0.707107
            anchor 0.031000 0.000000 -0.000000
          }
          endPoint Solid {
            translation 0.031000 0.000000 -0.000000
            rotation 1.000000 0.000000 -0.000000 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear right roller 3"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 4 (θ=135°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.500000 -0.707107 0.500000
            anchor 0.021920 0.000000 0.021920
          }
          endPoint Solid {
            translation 0.021920 0.000000 0.021920
            rotation 0.707107 0.000000 0.707107 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear right roller 4"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 5 (θ=180°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.707107 -0.707107 0.000000
            anchor 0.000000 0.000000 0.031000
          }
          endPoint Solid {
            translation 0.000000 0.000000 0.031000
            rotation 0.000000 0.000000 1.000000 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear right roller 5"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 6 (θ=225°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.500000 -0.707107 -0.500000
            anchor -0.021920 0.000000 0.021920
          }
          endPoint Solid {
            translation -0.021920 0.000000 0.021920
            rotation -0.707107 0.000000 0.707107 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear right roller 6"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 7 (θ=270°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.000000 -0.707107 -0.707107
            anchor -0.031000 0.000000 0.000000
          }
          endPoint Solid {
            translation -0.031000 0.000000 0.000000
            rotation -1.000000 0.000000 0.000000 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear right roller 7"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 8 (θ=315°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.500000 -0.707107 -0.500000
            anchor -0.021920 0.000000 -0.021920
          }
          endPoint Solid {
            translation -0.021920 0.000000 -0.021920
            rotation -0.707107 0.000000 -0.707107 2.356194
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear right roller 8"
            contactMaterial "MecanumWheelB"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
          ]
          name "rear right wheel"
          boundingObject Pose {
            rotation 1 0 0 -1.5708
            children [
              Cylinder {
                height 0.022
                radius 0.02
              }
            ]
          }
          physics Physics {
            density -1
            mass 0.045
            centerOfMass [
              0 0 0
            ]
          }
        }
      }

      # ========== REAR LEFT WHEEL ==========
      DEF REAR_LEFT_WHEEL_JOINT HingeJoint {
        jointParameters HingeJointParameters {
          axis 0 1 0
          anchor -0.14 0.14 0.038
        }
        device [
          RotationalMotor {
            name "rear left wheel motor"
            maxVelocity 70.0
            maxTorque 20.0
          }
          PositionSensor {
            name "rear left wheel sensor"
            resolution 0.00628
          }
        ]
        endPoint Solid {
          translation -0.14 0.14 0.038
          rotation 0 -1 0 1.570796
          children [
            # Visual hub only — the rollers below provide ground contact.
            Pose {
              rotation 1 0 0 -1.5708
              children [
                Shape {
                  appearance PBRAppearance {
                    baseColor 0.5 0.5 0.5
                    roughness 0.3
                    metalness 0.7
                  }
                  geometry Cylinder {
                    height 0.018
                    radius 0.018000000000000002
                    subdivision 16
                  }
                }
                Shape {
                  appearance PBRAppearance {
                    baseColor 0.6 0.6 0.6
                    roughness 0.2
                    metalness 0.8
                  }
                  geometry Cylinder {
                    height 0.022
                    radius 0.008
                    subdivision 8
                  }
                }
              ]
            }
        # Mecanum roller 1 (θ=0°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.707107 0.707107 0.000000
            anchor 0.000000 0.000000 -0.031000
          }
          endPoint Solid {
            translation 0.000000 0.000000 -0.031000
            rotation 0.000000 0.000000 -1.000000 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear left roller 1"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 2 (θ=45°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.500000 0.707107 0.500000
            anchor 0.021920 0.000000 -0.021920
          }
          endPoint Solid {
            translation 0.021920 0.000000 -0.021920
            rotation 0.707107 0.000000 -0.707107 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear left roller 2"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 3 (θ=90°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.000000 0.707107 0.707107
            anchor 0.031000 0.000000 -0.000000
          }
          endPoint Solid {
            translation 0.031000 0.000000 -0.000000
            rotation 1.000000 0.000000 -0.000000 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear left roller 3"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 4 (θ=135°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.500000 0.707107 0.500000
            anchor 0.021920 0.000000 0.021920
          }
          endPoint Solid {
            translation 0.021920 0.000000 0.021920
            rotation 0.707107 0.000000 0.707107 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear left roller 4"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 5 (θ=180°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.707107 0.707107 0.000000
            anchor 0.000000 0.000000 0.031000
          }
          endPoint Solid {
            translation 0.000000 0.000000 0.031000
            rotation 0.000000 0.000000 1.000000 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear left roller 5"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 6 (θ=225°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.500000 0.707107 -0.500000
            anchor -0.021920 0.000000 0.021920
          }
          endPoint Solid {
            translation -0.021920 0.000000 0.021920
            rotation -0.707107 0.000000 0.707107 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear left roller 6"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 7 (θ=270°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis -0.000000 0.707107 -0.707107
            anchor -0.031000 0.000000 0.000000
          }
          endPoint Solid {
            translation -0.031000 0.000000 0.000000
            rotation -1.000000 0.000000 0.000000 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear left roller 7"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
        # Mecanum roller 8 (θ=315°)
        HingeJoint {
          jointParameters HingeJointParameters {
            axis 0.500000 0.707107 -0.500000
            anchor -0.021920 0.000000 -0.021920
          }
          endPoint Solid {
            translation -0.021920 0.000000 -0.021920
            rotation -0.707107 0.000000 -0.707107 0.785398
            children [
              Shape {
                appearance PBRAppearance {
                  baseColor 0.12 0.12 0.12
                  roughness 0.7
                  metalness 0.1
                }
                geometry Capsule {
                  height 0.02
                  radius 0.007
                  subdivision 8
                }
              }
            ]
            name "rear left roller 8"
            contactMaterial "MecanumWheelA"
            boundingObject Capsule {
              height 0.02
              radius 0.007
              subdivision 8
            }
            physics Physics {
              density -1
              mass 0.003
              centerOfMass [
                0 0 0
              ]
            }
          }
        }
          ]
          name "rear left wheel"
          boundingObject Pose {
            rotation 1 0 0 -1.5708
            children [
              Cylinder {
                height 0.022
                radius 0.02
              }
            ]
          }
          physics Physics {
            density -1
            mass 0.045
            centerOfMass [
              0 0 0
            ]
          }
        }
      }


      # ========== IMU SENSORS ==========
      Accelerometer {
        translation 0 0 0.10
        name "accelerometer"
      }
      Gyro {
        translation 0 0 0.10
        name "gyro"
      }
      Compass {
        translation 0 0 0.10
        name "compass"
      }

      # ========== GPS ==========
      GPS {
        translation 0 0 0.17
        name "gps"
      }

      # ========== RECEIVER ==========
      Receiver {
        name "receiver"
        channel 1
      }

      # ========== EMITTER ==========
      Emitter {
        name "emitter"
        channel 1
        range 50.0
      }
    ]

    # ========== BOUNDING OBJECT ==========
    boundingObject Group {
      children [
        # Chassis box
        Transform {
          translation 0 0 0.05
          children [
            Box {
              size 0.32 0.16 0.06
            }
          ]
        }
        # Body box
        Transform {
          translation 0 0 0.11
          children [
            Box {
              size 0.30 0.16 0.08
            }
          ]
        }
      ]
    }

    # ========== PHYSICS ==========
    # Chassis dynamics are not exercised in herding runs — the
    # controller drives the body kinematically via Supervisor
    # setVelocity (see drive_mecanum in controllers/shepherd_dog).
    # Webots-derived inertia from the bounding box is sufficient.
    physics Physics {
      density -1
      mass 5.0
      centerOfMass [
        0 0 0.03
      ]
    }
  }
}
