First commit

This commit is contained in:
2025-11-07 11:39:23 +00:00
commit 4fb3471833
281 changed files with 6610 additions and 0 deletions

204
simulator/protos/SR2025bot.proto Executable file
View File

@@ -0,0 +1,204 @@
#VRML_SIM R2023b utf8
EXTERNPROTO "./robot/MotorAssembly.proto"
EXTERNPROTO "./robot/Caster.proto"
EXTERNPROTO "./robot/RobotCamera.proto"
EXTERNPROTO "./robot/UltrasoundModule.proto"
EXTERNPROTO "./robot/RGBLed.proto"
EXTERNPROTO "./robot/ReflectanceSensor.proto"
EXTERNPROTO "./robot/Flag.proto"
EXTERNPROTO "./robot/BumpSensor.proto"
EXTERNPROTO "./robot/VacuumSucker.proto"
PROTO SR2025bot [
field SFString name ""
field SFVec3f translation 0 0 0
field SFRotation rotation 0 0 1 0
field SFString controller "<generic>"
field MFString controllerArgs []
field SFString customData ""
field SFColor flagColour 1 1 1
] {
Robot {
name IS name
translation IS translation
rotation IS rotation
controller IS controller
controllerArgs IS controllerArgs
customData IS customData
children [
Pose {
translation 0 0 0.049
children [
MotorAssembly {
name "left motor"
rotation 0 0 1 3.1415
reversed TRUE
translation 0 0.14 0
}
MotorAssembly {
name "right motor"
translation 0 -0.14 0
}
Caster {
name "caster"
translation -0.15 0 -0.045
}
DEF BASE Solid {
translation -0.065 0 -0.02
children [
Shape {
appearance PBRAppearance {
baseColor 0.757 0.604 0.424
roughness 1
metalness 0
}
geometry Box {
size 0.25 0.25 0.02
}
}
]
name "Chassis"
boundingObject DEF BASE_GEO Box {
size 0.25 0.25 0.02
}
physics Physics {
density 2000 # 66% Aluminium
}
}
DEF BOARD Solid {
translation -0.05 0 0
rotation 0 0 1 1.5708
children [
Shape {
appearance PBRAppearance {
baseColor 0 0 0
roughness 1
metalness 0
}
geometry Box {
size 0.08 0.06 0.02
}
}
]
name "Board"
}
DEF STABILISER Solid {
translation -0.16 0 0
children [
Shape {
appearance PBRAppearance {
baseColor 0.8 0.8 0.75
roughness 1
metalness 0
}
geometry DEF WEIGHT_GEO Box {
size 0.04 0.15 0.02
}
}
]
name "Chassis weight"
boundingObject USE WEIGHT_GEO
physics Physics {
density 8000 # Steel
}
}
RobotCamera {
name "camera"
translation 0.05 0 0.03
}
Solid {
translation 0.03 0 0
children [
Shape {
appearance PBRAppearance {
baseColor 0.4 0.4 0.4
metalness 0
}
geometry Box {
size 0.01 0.01 0.03
}
}
]
name "Camera riser"
}
VacuumSucker {
name "vacuum sucker"
translation 0.01 0 -0.02
}
UltrasoundModule {
name "ultrasound front"
translation 0.04 0 0
}
UltrasoundModule {
name "ultrasound left"
translation -0.08 0.12 0
rotation 0 0 1 1.5708
}
UltrasoundModule {
name "ultrasound back"
translation -0.18 0 0
rotation 0 0 1 3.1416
}
UltrasoundModule {
name "ultrasound right"
translation -0.08 -0.12 0
rotation 0 0 1 -1.5708
}
RGBLed {
name "led 1"
translation -0.11 0.08 -0.008
}
RGBLed {
name "led 2"
translation -0.11 0 -0.008
}
RGBLed {
name "led 3"
translation -0.11 -0.08 -0.008
}
ReflectanceSensor {
name "left reflectance sensor"
translation 0.03 0.02 -0.03
rotation 0 0 1 1.5708
}
ReflectanceSensor {
name "center reflectance sensor"
translation 0.03 0 -0.03
rotation 0 0 1 1.5708
}
ReflectanceSensor {
name "right reflectance sensor"
translation 0.03 -0.02 -0.03
rotation 0 0 1 1.5708
}
BumpSensor {
name "front left bump sensor"
translation 0.06 0.06 -0.02
}
BumpSensor {
name "front right bump sensor"
translation 0.06 -0.06 -0.02
}
BumpSensor {
name "rear left bump sensor"
translation -0.19 0.06 -0.02
}
BumpSensor {
name "rear right bump sensor"
translation -0.19 -0.06 -0.02
}
Flag {
name "flag"
translation 0.03 0.07 0.09
flagColour IS flagColour
}
]
}
]
boundingObject Pose {
translation -0.065 0 0.029
children [USE BASE_GEO]
}
physics Physics {}
}
}

178
simulator/protos/SRObot.proto Executable file
View File

@@ -0,0 +1,178 @@
#VRML_SIM R2023b utf8
EXTERNPROTO "./robot/MotorAssembly.proto"
EXTERNPROTO "./robot/Caster.proto"
EXTERNPROTO "./robot/RobotCamera.proto"
EXTERNPROTO "./robot/UltrasoundModule.proto"
EXTERNPROTO "./robot/RGBLed.proto"
EXTERNPROTO "./robot/ReflectanceSensor.proto"
EXTERNPROTO "./robot/Flag.proto"
EXTERNPROTO "./robot/BumpSensor.proto"
PROTO SRObot [
field SFString name ""
field SFVec3f translation 0 0 0
field SFRotation rotation 0 0 1 0
field SFString controller "<generic>"
field MFString controllerArgs []
field SFString customData ""
field SFColor flagColour 1 1 1
] {
Robot {
name IS name
translation IS translation
rotation IS rotation
controller IS controller
controllerArgs IS controllerArgs
customData IS customData
children [
Pose {
translation 0 0 0.049
children [
MotorAssembly {
name "left motor"
rotation 0 0 1 3.1415
reversed TRUE
translation 0 0.1 0
}
MotorAssembly {
name "right motor"
translation 0 -0.1 0
}
Caster {
name "caster"
translation -0.13 0 -0.045
}
DEF BASE Solid {
translation -0.045 0 -0.02
children [
Shape {
appearance PBRAppearance {
baseColor 0.757 0.604 0.424
roughness 1
metalness 0
}
geometry Box {
size 0.21 0.16 0.02
}
}
]
name "Chassis"
boundingObject DEF BASE_GEO Box {
size 0.21 0.16 0.02
}
physics Physics {
density 3000 # Aluminium
}
}
DEF BOARD Solid {
translation -0.06 0 0
children [
Shape {
appearance PBRAppearance {
baseColor 0 0 0
roughness 1
metalness 0
}
geometry Box {
size 0.08 0.06 0.02
}
}
]
name "Board"
}
RobotCamera {
name "camera"
translation 0 0 0.03
}
Solid {
translation -0.01 0 0
children [
Shape {
appearance PBRAppearance {
baseColor 0.4 0.4 0.4
metalness 0
}
geometry Box {
size 0.01 0.01 0.03
}
}
]
name "Camera riser"
}
UltrasoundModule {
name "ultrasound front"
translation 0.04 0 0
}
UltrasoundModule {
name "ultrasound left"
translation -0.08 0.07 0
rotation 0 0 1 1.5708
}
UltrasoundModule {
name "ultrasound back"
translation -0.14 0 0
rotation 0 0 1 3.1416
}
UltrasoundModule {
name "ultrasound right"
translation -0.08 -0.07 0
rotation 0 0 1 -1.5708
}
RGBLed {
name "led 1"
translation -0.12 0.05 -0.008
}
RGBLed {
name "led 2"
translation -0.12 0 -0.008
}
RGBLed {
name "led 3"
translation -0.12 -0.05 -0.008
}
ReflectanceSensor {
name "left reflectance sensor"
translation 0.03 0.02 -0.03
rotation 0 0 1 1.5708
}
ReflectanceSensor {
name "center reflectance sensor"
translation 0.03 0 -0.03
rotation 0 0 1 1.5708
}
ReflectanceSensor {
name "right reflectance sensor"
translation 0.03 -0.02 -0.03
rotation 0 0 1 1.5708
}
BumpSensor {
name "front left bump sensor"
translation 0.06 0.05 -0.02
}
BumpSensor {
name "front right bump sensor"
translation 0.06 -0.05 -0.02
}
BumpSensor {
name "rear left bump sensor"
translation -0.15 0.05 -0.02
}
BumpSensor {
name "rear right bump sensor"
translation -0.15 -0.05 -0.02
}
Flag {
name "flag"
translation 0.03 0.05 0.09
flagColour IS flagColour
}
]
}
]
boundingObject Pose {
translation -0.045 0 0.029
children [USE BASE_GEO]
}
physics Physics {}
}
}

View File

@@ -0,0 +1,136 @@
#VRML_SIM R2023b utf8
# template language: javascript
PROTO Arena [
field SFVec2f size 1 1
field SFColor wallColour 0.095395215 0.22841774 0.8000001
field MFString floorTexture []
field SFBool locked FALSE
] {
Group {
children [
DEF ARENA_WALLS Group {
children [
Solid { # North Wall
translation 0 %<= -(fields.size.value.y / 2 + 0.075) >% 0.15
children [
DEF NORTH_WALL Shape {
appearance DEF WALL_COLOUR PBRAppearance {
baseColor IS wallColour
roughness 1
metalness 0
}
geometry Box {
size %<= fields.size.value.x >% 0.15 0.3
}
}
]
name "North Wall"
locked IS locked
}
Solid { # East Wall
translation %<= -(fields.size.value.x / 2 + 0.075) >% 0 0.15
children [
DEF EAST_WALL Shape {
appearance USE WALL_COLOUR
geometry Box {
size 0.15 %<= fields.size.value.y + 0.3 >% 0.3
}
}
]
name "East Wall"
locked IS locked
}
Solid { # West Wall
translation %<= fields.size.value.x / 2 + 0.075 >% 0 0.15
children [USE EAST_WALL]
name "West Wall"
locked IS locked
}
Solid { # South Wall
translation 0 %<= fields.size.value.y / 2 + 0.075 >% 0.15
children [USE NORTH_WALL]
name "South Wall"
locked IS locked
}
]
}
DEF ARENA_BOUNDING Group {
children [
Solid { # Floor
translation 0 -0.002 0
rotation 0 0 1 3.1416
children [
DEF FLOOR Shape {
appearance Appearance {
material Material {
ambientIntensity 0
}
texture ImageTexture {
url IS floorTexture
repeatS FALSE
repeatT FALSE
filtering 1
}
}
geometry Plane {
size IS size
}
}
]
name "Floor"
boundingObject Plane {
size IS size
}
locked IS locked
}
Solid { # Ceiling
rotation 1 0 0 3.1419
translation 0 0 2
boundingObject Plane {
size IS size
}
name "Top boundary"
locked IS locked
}
Solid { # North bound
rotation 1 0 0 -1.5708
translation 0 %<= -fields.size.value.y / 2 >% 1
boundingObject Plane {
size %<= fields.size.value.x >% 2
}
name "North boundary"
locked IS locked
}
Solid { # East bound
rotation 0 -1 0 -1.5708
translation %<= -fields.size.value.x / 2 >% 0 1
boundingObject Plane {
size 2 %<= fields.size.value.y >%
}
name "East boundary"
locked IS locked
}
Solid { # South bound
rotation 1 0 0 1.5708
translation 0 %<= fields.size.value.y / 2 >% 1
boundingObject Plane {
size %<= fields.size.value.x >% 2
}
name "South boundary"
locked IS locked
}
Solid { # West bound
rotation 0 -1 0 1.5708
translation %<= fields.size.value.x / 2 >% 0 1
boundingObject Plane {
size 2 %<= fields.size.value.y >%
}
name "West boundary"
locked IS locked
}
]
}
]
}
}

View File

@@ -0,0 +1,50 @@
#VRML_SIM R2023b utf8
# template language: javascript
PROTO Deck [
field SFVec2f size 1 1
field SFVec3f translation 0 0 0.001
field SFRotation rotation 1 0 0 0
field SFFloat height 0.17
field SFColor sideColour 1 1 1
field SFColor topColour 0.1 0.1 0.1
field SFBool locked FALSE
field SFString name ""
] {
Solid {
translation IS translation
rotation IS rotation
children [
Shape {
appearance PBRAppearance {
baseColor IS sideColour
roughness 1
metalness 0.5
}
geometry DEF DECK Box {
size %<= fields.size.value.x >% %<= fields.size.value.y >% %<= fields.height.value >%
}
}
Solid {
translation 0 0 %<= fields.height.value / 2 + 0.002 >%
children [
Shape {
appearance PBRAppearance {
baseColor IS topColour
roughness 1
metalness 0
}
geometry Plane {
size %<= fields.size.value.x >% %<= fields.size.value.y >%
}
castShadows FALSE
}
]
name "Top of deck"
}
]
boundingObject USE DECK
name IS name
locked IS locked
}
}

View File

@@ -0,0 +1,76 @@
#VRML_SIM R2023b utf8
# template language: javascript
# tags: nonDeterministic
EXTERNPROTO "../props/Marker.proto"
PROTO Pillar [
field SFVec3f translation 0 0 0
field SFRotation rotation 0 1 0 0
field SFVec3f size 0.13 0.13 0.13
field SFVec2f {0.08 0.08, 0.15 0.15, 0.2 0.2} marker_size 0.08 0.08
field SFFloat marker_height 0.065
field SFColor colour 0.9 0.9 0.9
field SFString marker "0"
field SFString model ""
field MFString texture_url []
]
{
Pose {
translation IS translation
rotation IS rotation
children [
Solid {
translation 0 0 %<= fields.size.value.z / 2 >%
children [
Shape {
appearance DEF PILLAR_APPEARANCE PBRAppearance {
baseColor IS colour
metalness 0
roughness 1
}
geometry DEF PILLAR_GEOMETRY Box {
size IS size
}
}
Marker {
translation 0 %<= fields.size.value.y / 2 + 0.001 >% %<= fields.marker_height.value - (fields.size.value.z / 2) >%
rotation 1 0 0 -1.5708
size IS marker_size
name "front"
model IS marker
texture_url IS texture_url
}
Marker {
translation 0 %<= -(fields.size.value.y / 2 + 0.001) >% %<= fields.marker_height.value - (fields.size.value.z / 2) >%
rotation 1 0 0 1.5708
size IS marker_size
name "back"
model IS marker
texture_url IS texture_url
}
Marker {
translation %<= fields.size.value.x / 2 + 0.001 >% 0 %<= fields.marker_height.value - (fields.size.value.z / 2) >%
rotation 0 1 0 1.5708
size IS marker_size
name "side-1"
model IS marker
texture_url IS texture_url
}
Marker {
translation %<= -(fields.size.value.x / 2 + 0.001) >% 0 %<= fields.marker_height.value - (fields.size.value.z / 2) >%
rotation 0 1 0 -1.5708
size IS marker_size
name "side-2"
model IS marker
texture_url IS texture_url
}
]
name IS model
model IS model
boundingObject USE PILLAR_GEOMETRY
locked TRUE
}
]
}
}

View File

@@ -0,0 +1,68 @@
#VRML_SIM R2023b utf8
# template language: javascript
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2023b/projects/objects/geometries/protos/Extrusion.proto"
PROTO TriangleDeck [
field SFVec2f size 1 1
field SFVec3f translation 0 0 0.001
field SFRotation rotation 1 0 0 0
field SFFloat height 0.17
field SFColor sideColour 1 1 1
field SFColor topColour 0.1 0.1 0.1
field SFBool locked FALSE
field SFString name ""
] {
Pose {
translation IS translation
rotation IS rotation
children [
Solid {
translation 0 0 %<= -fields.height.value / 2 + 0.002 >%
children [
Shape {
appearance PBRAppearance {
baseColor IS sideColour
roughness 1
metalness 0.5
}
geometry DEF DECK Extrusion {
crossSection [0.5 0.5, 0.5 -0.5, -0.5 0.5, 0.5 0.5]
scale %<= fields.size.value.x >% %<= fields.size.value.y >%
spine [0 0 0, 0 0 %<= fields.height.value >%]
splineSubdivision 1
}
}
Solid {
translation 0 0 %<= fields.height.value + 0.002 >%
children [
Shape {
appearance PBRAppearance {
baseColor IS topColour
roughness 1
metalness 0
}
geometry IndexedFaceSet {
coord Coordinate {
point [
%<= -fields.size.value.x / 2 >% %<= -fields.size.value.y / 2 >% 0
%<= fields.size.value.x / 2 >% %<= -fields.size.value.y / 2 >% 0
%<= -fields.size.value.x / 2 >% %<= fields.size.value.y / 2 >% 0
]
}
coordIndex [
0 1 2 0
]
}
castShadows FALSE
}
]
name "Top of deck"
}
]
boundingObject USE DECK
name IS name
locked IS locked
}
]
}
}

View File

@@ -0,0 +1,125 @@
#VRML_SIM R2023b utf8
# template language: javascript
# tags: nonDeterministic
EXTERNPROTO "./Marker.proto"
PROTO BoxToken [
field SFVec3f translation 0 0 0
field SFRotation rotation 0 1 0 0
field SFVec3f size 0.13 0.13 0.13
field SFVec2f {0.08 0.08, 0.15 0.15, 0.2 0.2} marker_size 0.08 0.08
field SFColor colour 0.7 0.55 0.35
field SFString marker "0"
field SFString model ""
field SFFloat mass 0.080
field MFString texture_url []
field SFFloat connectorStrength 35
field SFFloat connectorShear 20
]
{
Solid {
translation IS translation
rotation IS rotation
children [
Shape {
appearance DEF TOKEN_APPEARANCE PBRAppearance {
baseColor IS colour
metalness 0
roughness 1
}
geometry DEF TOKEN_GEOMETRY Box {
size IS size
}
}
Marker {
translation 0 %<= fields.size.value.y / 2 + 0.001 >% 0
rotation 1 0 0 -1.5708
size IS marker_size
name "front"
model IS marker
texture_url IS texture_url
}
Marker {
translation 0 %<= -(fields.size.value.y / 2 + 0.001) >% 0
rotation 1 0 0 1.5708
size IS marker_size
name "back"
model IS marker
texture_url IS texture_url
}
Marker {
translation %<= fields.size.value.x / 2 + 0.001 >% 0 0
rotation 0 1 0 1.5708
size IS marker_size
name "side-1"
model IS marker
texture_url IS texture_url
}
Marker {
translation %<= -(fields.size.value.x / 2 + 0.001) >% 0 0
rotation 0 1 0 -1.5708
size IS marker_size
name "side-2"
model IS marker
texture_url IS texture_url
}
Marker {
translation 0 0 %<= fields.size.value.z / 2 + 0.001 >%
rotation 0 0 1 0
size IS marker_size
name "top"
model IS marker
texture_url IS texture_url
}
Marker {
translation 0 0 %<= -(fields.size.value.z / 2 + 0.001) >%
rotation 0 1 0 3.1416
size IS marker_size
name "bottom"
model IS marker
texture_url IS texture_url
}
# Shape {
# appearance PBRAppearance {
# transparency 0.4
# baseColor 1 0 0
# }
# geometry Sphere {
# radius %<= fields.size.value.x / 2 * 1.4 >%
# subdivision 5
# }
# }
Connector {
type "passive"
distanceTolerance %<= fields.size.value.x / 2 * 1.4 >%
axisTolerance 3.1415
rotationTolerance 0
numberOfRotations 0
tensileStrength IS connectorStrength
shearStrength IS connectorShear
snap FALSE
name "Front Connector"
}
Connector {
rotation 0 0 1 3.1416
type "passive"
distanceTolerance %<= fields.size.value.x / 2 * 1.4 >%
axisTolerance 3.1415
rotationTolerance 0
numberOfRotations 0
tensileStrength IS connectorStrength
shearStrength IS connectorShear
snap FALSE
name "Rear Connector"
}
]
name IS model
model IS model
boundingObject USE TOKEN_GEOMETRY
physics Physics {
density -1
mass IS mass
}
}
}

View File

@@ -0,0 +1,36 @@
#VRML_SIM R2023b utf8
PROTO Can [
field SFVec3f translation 0 0 0.001
field SFRotation rotation 1 0 0 0
field SFString name ""
] {
Solid {
translation IS translation
rotation IS rotation
children [
Shape {
appearance DEF TOKEN_APPEARANCE PBRAppearance {
baseColor 1 1 1
roughness 1
metalness 1
}
geometry DEF TOKEN_GEOMETRY Cylinder {
height 0.1
radius 0.034
subdivision 12
}
}
]
name IS name
boundingObject USE TOKEN_GEOMETRY
physics Physics {
density -1
mass 0.300
damping Damping {
linear 0.4
angular 0.4
}
}
}
}

View File

@@ -0,0 +1,99 @@
#VRML_SIM R2022b utf8
# template language: javascript
# tags: nonDeterministic
PROTO Marker [
field SFVec3f translation 0 0 0
field SFRotation rotation 0 1 0 0
field SFVec2f {0.08 0.08, 0.1 0.1, 0.15 0.15, 0.2 0.2} size 0.08 0.08
field SFString name ""
field SFString model ""
field MFString texture_url []
field SFBool add_recognition FALSE
field SFBool upright FALSE
]
{
%< if (fields.upright.value) { >%
Pose {
translation IS translation
rotation IS rotation
children [
%< } >%
Solid {
%<
import * as wbrandom from 'wbrandom.js';
wbrandom.seed(context.id);
const uid = wbrandom.integer();
>%
%< if (fields.upright.value) { >%
rotation 1 0 0 1.5708
%< } else { >%
translation IS translation
rotation IS rotation
%< } >%
children [
%<
if (fields.add_recognition.value) {
for (let corner of [['TL', 1, 1], ['TR', -1, 1], ['BR', -1, -1], ['BL', 1, -1]]) {
let corner_name = corner[0];
let horiz_sign = corner[1];
let vert_sign = corner[2];
>%
Solid {
translation %<= horiz_sign * fields.size.value.x / 2 >% %<= vert_sign * fields.size.value.y / 2 >% 0.001
children [
Shape {
appearance PBRAppearance {
transparency 1
metalness 0
}
geometry Plane {
# Make the detection corners one marker pixel in size
size %<= fields.size.value.x / 8 >% %<= fields.size.value.y / 8 >%
}
castShadows FALSE
}
]
model %<= "\"" + uid + "_" + fields.model.value + "_" + corner_name + "\"" >%
name %<= "\"" + corner_name + "\"" >%
locked TRUE
recognitionColors [
0 0 1
]
}
%< }} >%
Shape {
appearance PBRAppearance {
baseColorMap ImageTexture {
url IS texture_url
repeatS FALSE
repeatT FALSE
}
roughness 1
metalness 0
}
geometry Plane {
# The size of the marker including the white border
size %<= 1.25 * fields.size.value.x >% %<= 1.25 * fields.size.value.y >%
}
castShadows FALSE
}
]
%< if (fields.name.value !== "") { >%
name IS name
%< } else { >%
name IS model
%< } >%
model %<= "\"" + uid + "_" + fields.model.value + "_base\"" >%
locked TRUE
%< if (fields.add_recognition.value) { >%
recognitionColors [
1 1 1
]
%< } >%
}
%< if (fields.upright.value) { >%
]
}
%< } >%
}

View File

@@ -0,0 +1,28 @@
#VRML_SIM R2023b utf8
# template language: javascript
PROTO BumpSensor [
field SFString name ""
field SFVec3f translation 0 0 0
field SFRotation rotation 0 0 1 0
] {
TouchSensor {
translation IS translation
rotation IS rotation
name IS name
children [
Shape {
appearance PBRAppearance {
baseColor 0.5 0 0
roughness 0.7
}
geometry DEF BUMPER Box {
size 0.01 0.05 0.01
}
}
]
boundingObject Box {
size 0.03 0.05 0.01
}
}
}

View File

@@ -0,0 +1,52 @@
#VRML_SIM R2023b utf8
PROTO Caster [
field SFString name ""
field SFVec3f translation 0 0 0
field SFRotation rotation 0 0 1 0
] {
Pose {
translation IS translation
rotation IS rotation
children [
Solid {
name IS name
children [
DEF CASTER_BALL Shape {
appearance PBRAppearance {
baseColor 0 0.0051864 0
roughness 0
metalness 0
}
geometry Sphere {
radius 0.005
}
castShadows FALSE
}
]
boundingObject USE CASTER_BALL
physics Physics {
density 8000 # steel
}
}
Pose {
translation 0 0 0.01075
children [
DEF CASTER_TOP_CYLINDER Shape {
appearance PBRAppearance {
baseColor 0 0.0051864 0
roughness 0.5
metalness 0
}
geometry Cylinder {
height 0.0215
radius 0.01
subdivision 6
top FALSE
}
}
]
}
]
}
}

View File

@@ -0,0 +1,51 @@
#VRML_SIM R2023b utf8
# template language: javascript
PROTO Flag [
field SFString name ""
field SFVec3f translation 0 0 0
field SFRotation rotation 0 0 1 0
field SFColor flagColour 0.1 0.1 0.7
] {
Solid {
translation IS translation
rotation IS rotation
name IS name
children [
Shape { # pole
appearance PBRAppearance {
baseColor 0.0705882 0.0705882 0.0705882
roughness 0.4
metalness 0
}
geometry Cylinder {
height 0.2
radius 0.0075
subdivision 8
bottom FALSE
}
}
Solid {
translation -0.08 0 0.04925
children [
Shape {
appearance PBRAppearance {
metalness 0
baseColor IS flagColour
}
geometry Box {
size 0.15 0.005 0.1
}
}
]
name %<= "\"" + fields.name.value + "flag\"" >%
}
]
boundingObject Box {
size 0.015 0.015 0.2
}
physics Physics {
density 1000
}
}
}

View File

@@ -0,0 +1,85 @@
#VRML_SIM R2023b utf8
# template language: javascript
PROTO MotorAssembly [
field SFString name ""
field SFVec3f translation 0 0 0
field SFRotation rotation 0 0 1 0
field SFFloat maxVelocity 25
field SFBool reversed FALSE
] {
Pose {
translation IS translation
rotation IS rotation
children [
Solid {
translation 0 0.04 0
rotation -1 0 0 1.5708
name %<= "\"" + fields.name.value + " housing\"" >%
children [
Shape {
appearance PBRAppearance {
baseColor 0.36 0.36 0.36
roughness 0.3
metalness 0
}
geometry Cylinder {
height 0.07
radius 0.015
subdivision 12
}
}
]
boundingObject Box {
size 0.03 0.03 0.07
}
physics Physics {
density 8000 # steel
}
}
HingeJoint {
jointParameters HingeJointParameters {
position 0
%< if (fields.reversed.value) { >%
axis 0 -1 0
%< } else { >%
axis 0 1 0
%< } >%
}
device [
RotationalMotor {
name IS name
maxVelocity IS maxVelocity
sound ""
}
PositionSensor {
name %<= "\"" + fields.name.value + " sensor\"" >%
}
]
endPoint Solid {
translation 0 0 0
rotation -1 0 0 1.5708
children [
DEF WHEEL_GEO Shape {
appearance PBRAppearance {
baseColor 0 0.0051864 0
roughness 0.3
metalness 0
}
geometry Cylinder {
height 0.021
radius 0.05
subdivision 24
}
}
]
name IS name
boundingObject USE WHEEL_GEO
physics Physics {
density 2000
}
}
}
]
}
}

View File

@@ -0,0 +1,37 @@
#VRML_SIM R2023b utf8
PROTO RGBLed [
field SFString name ""
field SFVec3f translation 0 0 0
field SFRotation rotation 0 0 1 0
] {
LED {
name IS name
translation IS translation
rotation IS rotation
children [
Shape {
appearance DEF APP_LED PBRAppearance {
baseColor 0.6 0.4 0.4
roughness 1
emissiveIntensity 100
}
geometry Box {
size 0.02 0.04 0.005
}
castShadows FALSE
}
]
color [
1 0 0 # RED
1 1 0 # YELLOW
0 1 0 # GREEN
0 1 1 # CYAN
0 0 1 # BLUE
1 0 1 # MAGENTA
1 1 1 # WHITE
]
}
}

View File

@@ -0,0 +1,40 @@
#VRML_SIM R2023b utf8
PROTO ReflectanceSensor [
field SFString name ""
field SFVec3f translation 0 0 0
field SFRotation rotation 0 0 1 0
] {
Pose {
translation IS translation
rotation IS rotation
children [
DistanceSensor {
name IS name
rotation 0 1 0 1.5708
type "infra-red"
lookupTable [
# 2% standard deviation
0 0 0.02
0.1 1023 0.02
]
children [
Pose {
children [
Shape {
appearance PBRAppearance {
baseColor 0.1 0.1 1
metalness 0
}
geometry Box {
size 0.002 0.045 0.015
}
castShadows FALSE
}
]
}
]
}
]
}
}

View File

@@ -0,0 +1,56 @@
#VRML_SIM R2023b utf8
PROTO RobotCamera [
field SFString name ""
field SFVec3f translation 0 0 0
field SFRotation rotation 0 0 1 0
field SFInt32 width 800
field SFInt32 height 450
] {
Camera {
name IS name
translation IS translation
rotation IS rotation
children [
Pose {
translation 0 0 0
rotation 0 1 0 1.5708
children [
Shape {
appearance PBRAppearance {
baseColor 0 0 0
}
geometry Cylinder {
height 0.01
radius 0.01
}
castShadows FALSE
}
]
translationStep 0.001
}
Pose {
translation -0.02 0 0
children [
Shape {
appearance PBRAppearance {
baseColor 0.4 0.4 0.4
metalness 0
}
geometry Box {
size 0.03 0.03 0.03
}
}
]
}
]
# In radians, ~45 degrees
fieldOfView 0.82
width IS width
height IS height
recognition Recognition {
frameThickness 2
maxRange 6
}
}
}

View File

@@ -0,0 +1,75 @@
#VRML_SIM R2023b utf8
# template language: javascript
PROTO UltrasoundModule [
field SFString name ""
field SFVec3f translation 0 0 0
field SFRotation rotation 0 0 1 0
field SFInt32 range 4
field SFBool upright FALSE
] {
DistanceSensor {
name IS name
translation IS translation
rotation IS rotation
type "sonar"
numberOfRays 10
aperture 0.3
lookupTable [
# 1% standard deviation, with no deviation at the limits
0 0 0
0.01 10 0.01
%<= fields.range.value * 0.99 >% %<= fields.range.value * 1000 * 0.99 >% 0.01
%<= fields.range.value >% %<= fields.range.value * 1000 >% 0
# Return 0 for out of range values
%<= fields.range.value + 0.001 >% 0 0
]
children [
Pose {
%< if (fields.upright.value) { >%
rotation 0 1 1 3.14159
%< } else { >%
rotation 0 0 1 3.14159
%< } >%
children [
Shape {
appearance PBRAppearance {
baseColor 0.1 0.1 1
metalness 0
}
geometry Box {
size 0.002 0.045 0.02
}
}
Pose {
translation -0.007 0.013 0
rotation 0 -1 0 1.5708
children [
DEF SONAR_TRX Shape {
appearance PBRAppearance {
baseColor 0.92 0.92 0.92
roughness 0.3
}
geometry Cylinder {
radius 0.008
height 0.012
subdivision 12
bottom FALSE
}
castShadows FALSE
}
]
}
Pose {
translation -0.007 -0.013 0
rotation 0 -1 0 1.5708
children [
USE SONAR_TRX
]
}
]
}
]
}
}

View File

@@ -0,0 +1,201 @@
#VRML_SIM R2023b utf8
# template language: javascript
PROTO VacuumSucker [
field SFString name ""
field SFVec3f translation 0 0 0
field SFRotation rotation 0 0 1 0
field SFFloat max_height 0.35
field SFFloat forward_reach 0.12
] {
Pose {
translation IS translation
rotation IS rotation
children [
Pose {
translation 0 0 %<= fields.max_height.value / 4 >%
children [
DEF BASE Solid {
children [
Shape {
appearance PBRAppearance {
baseColor 0.7 0.7 0.7
roughness 1
metalness 0
}
geometry DEF BASE_GEO Box {
size 0.06 0.06 %<= fields.max_height.value / 2 >%
}
}
]
name "Tower Base"
boundingObject USE BASE_GEO
physics Physics {
density 500 # Hollow Aluminium
}
}
SliderJoint {
jointParameters JointParameters {
axis 0 0 1
minStop 0
maxStop IS max_height
position 0.01
}
device [
LinearMotor {
name %<= "\"" + fields.name.value + " motor::main\"" >%
minPosition 0
maxPosition IS max_height
maxVelocity 2
sound ""
}
PositionSensor {
name %<= "\"" + fields.name.value + " position sensor\"" >%
}
]
endPoint Solid {
translation %<= (fields.forward_reach.value + 0.055) - 0.05 >% 0 %<= fields.max_height.value / 4 - 0.05 >%
children [
Solid {
children [
Pose {
translation %<= 0.025 - (fields.forward_reach.value + 0.055) / 2 >% 0 0.08
children [
Shape { # Horizontal arm
appearance PBRAppearance {
baseColor 0.7 0.7 0.7
roughness 1
metalness 0
}
geometry Box {
size %<= fields.forward_reach.value + 0.055 >% 0.05 0.02
}
}
]
}
Pose {
translation %<= 0.05 - (fields.forward_reach.value + 0.055) >% 0 %<= 0.06 - (fields.max_height.value / 4) >%
children [
Shape { # Column
appearance PBRAppearance {
baseColor 0.7 0.7 0.7
roughness 1
metalness 0
}
geometry DEF COLUMN_GEO Box {
size 0.05 0.05 %<= fields.max_height.value / 2 + 0.02 >%
}
}
]
}
Pose {
translation 0 0 0.045
children [
Shape {
appearance PBRAppearance {
baseColor 0.7 0.7 0.7
roughness 1
metalness 0
}
geometry Box {
size 0.05 0.05 0.05
}
}
]
}
]
name "Armature"
boundingObject Pose {
translation %<= 0.05 - (fields.forward_reach.value + 0.055) >% 0 %<= 0.06 - (fields.max_height.value / 4) >%
children [USE COLUMN_GEO]
}
physics Physics {
density 200 # Hollow Aluminium
}
}
DEF SUCKER Shape {
appearance PBRAppearance {
baseColor 0 0 0
roughness 1
metalness 1
}
geometry DEF hook_geo Box {
size 0.05 0.05 0.04
}
castShadows FALSE
}
Connector {
# Shift origin to near the lower face of the hook shape
translation 0 0 -0.01
rotation 0 1 0 3.1416
type "active"
distanceTolerance 0.094 # (0.14 / 2) * sqrt(2)
axisTolerance 3.1415
rotationTolerance 0
numberOfRotations 0
tensileStrength 35
shearStrength 20
snap FALSE
autoLock TRUE
name IS name
unilateralUnlock TRUE
unilateralLock TRUE
}
]
boundingObject Pose {
translation 0 0 0.005
children [
Box {
size 0.05 0.05 0.03
}
]
}
physics Physics {
density 1500 # rubber
}
}
}
# Secondary slider joint for telescoping column
SliderJoint {
jointParameters JointParameters {
axis 0 0 1
minStop 0
maxStop %<= fields.max_height.value / 2 >%
position 0.005
}
device [
LinearMotor {
name %<= "\"" + fields.name.value + " motor::extension\"" >%
minPosition 0
maxPosition %<= fields.max_height.value / 2 >%
maxVelocity 1
sound ""
multiplier 0.5
}
]
endPoint Solid {
translation 0 0 0.005
children [
Shape {
appearance PBRAppearance {
baseColor 0.7 0.7 0.7
roughness 1
metalness 0
}
geometry DEF COLUMN_GEO Box {
size 0.055 0.055 %<= fields.max_height.value / 2 + 0.01 >%
}
}
]
name "Extension"
boundingObject USE COLUMN_GEO
physics Physics {
density 200 # Hollow Aluminium
}
}
}
]
}
]
}
}