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.