1
$\begingroup$

In my Webots simulation, I would like to use a PROTO as a supervisor and therefore added a supervisor TRUE line to the proto definition. However, it does not have any effect (self.getSupervisor() still returns false, and errors if I try to use supervisor only methods). How can I make my PROTO controller to use Supervisor methods?

I am using Webots R2022b and using a Python controller inheriting from the Driver class.

See the PROTO file below :

#VRML_SIM R2022b utf8
# modele de TT02 basé sur Altino
# license: Copyright Cyberbotics Ltd. Licensed for use only with Webots.
# license url: https://cyberbotics.com/webots_assets_license
# documentation url: https://www.cyberbotics.com/doc/guide/altino
# The "ALTINO System" is a robot platform designed for education. It is a four-wheeled robot based on an Ackermann vehicle frame.

EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2022b/projects/vehicles/protos/abstract/Car.proto"
EXTERNPROTO "../protos/TT02Wheel.proto"

PROTO TT02 [
  field SFVec3f    translation     0 0 0.036               # Is `Transform.translation`.
  field SFRotation rotation        0 0 1 0                 # Is `Transform.rotation`.
  field SFString   name            "TT02"                  # Is `Solid.name`.
  field SFString   controller      "<generic>"             # Is `Robot.controller`.
  field MFString   controllerArgs  []                      # Is `Robot.controllerArgs`.
  field SFString   window          "<generic>"             # Is `Robot.window`.
  field SFBool     synchronization TRUE                    # Is `Robot.synchronization`.
  field SFColor    color           0.69 0.0 1.0            # Is `Material.diffuseColor`.
]
{
  Car {
    translation IS translation
    rotation IS rotation
    name IS name
    model "TT02"
    controller IS controller
    supervisor TRUE
    controllerArgs IS controllerArgs
    window IS window
    synchronization IS synchronization
    trackFront                     0.15
    trackRear                      0.15
    wheelbase                      0.257
    minSteeringAngle               -0.314
    maxSteeringAngle               0.314
    suspensionFrontSpringConstant  100000
    suspensionFrontDampingConstant 4000
    suspensionRearSpringConstant   100000
    suspensionRearDampingConstant  4000
    wheelsDampingConstant          5
    extensionSlot [
      Accelerometer {
        name "accelerometer"
        xAxis TRUE
        yAxis TRUE
        zAxis TRUE
      }
      Emitter {
      }
      Speaker {
        translation 0.257 0 0
        name "TT02_speaker"
      }
      [...]
    ]
    physics                 Physics { density -1 mass 2.331 }
    radarCrossSection       100
    wheelFrontRight         TT02Wheel { name "front right wheel" }
    wheelFrontLeft          TT02Wheel { name "front left wheel" }
    wheelRearRight          TT02Wheel { name "rear right wheel" }
    wheelRearLeft           TT02Wheel { name "rear left wheel" }
    type                    "4x4"
    engineType              "electric"
    engineSound             ""
    brakeCoefficient        700
    time0To100              10
    engineMaxTorque         0.0234
    engineMaxPower          32
    engineMinRPM            1
    engineMaxRPM            13800
    gearRatio               [-0.62 0.62]
    maxVelocity             36
  }
}

Note that I can convert the PROTO to a base node and add a supervisor TRUE field which is a working solution, but that means not using the PROTO.

$\endgroup$
3
  • $\begingroup$ Did you try with Webots version R2023a? $\endgroup$ Jan 27, 2023 at 15:25
  • 1
    $\begingroup$ @OlivierMichel It is indeed working with version R2023a, thank you ! $\endgroup$
    – maxew
    Jan 27, 2023 at 16:53
  • $\begingroup$ Please post the solution as an answer and not in the comments, and then mark the answer as the accepted solution. $\endgroup$ May 8, 2023 at 11:46

1 Answer 1

0
$\begingroup$

You should simply upgrade to a more recent version of Webots, e.g., R2023b for example.

Disclaimer: I am a Webots developer working at Cyberbotics.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.