First commit
This commit is contained in:
125
simulator/protos/props/BoxToken.proto
Executable file
125
simulator/protos/props/BoxToken.proto
Executable 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
|
||||
}
|
||||
}
|
||||
}
|
||||
36
simulator/protos/props/Can.proto
Executable file
36
simulator/protos/props/Can.proto
Executable 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
99
simulator/protos/props/Marker.proto
Executable file
99
simulator/protos/props/Marker.proto
Executable 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) { >%
|
||||
]
|
||||
}
|
||||
%< } >%
|
||||
}
|
||||
Reference in New Issue
Block a user