Closed omichel closed 4 years ago
A few notes:
webots.js
of the ghost object and crashes here because the mMeshKey
is 0 as the object was not finalized.webots.js
on this ghost object.I wrote a simplified example exhibiting the problem.
simple.wbt
#VRML_SIM R2020a utf8
WorldInfo {
}
Viewpoint {
orientation -0.7095662703664664 0.642643640090935 0.2890066777929114 0.7904657261701156
position 3.271213250962302 4.245847478516282 5.147248384110216
}
TexturedBackground {
}
TexturedBackgroundLight {
}
RectangleArena {
floorSize 10 2
wallHeight 0.001
}
Supervisor {
controller "simple"
}
simple.py:
from controller import Supervisor
supervisor = Supervisor()
children = supervisor.getSelf().getField('children')
shape = """DEF SHAPE Shape {
appearance PBRAppearance {
baseColor 0.264 0.264 0.8
roughness 0.19999999999999996
metalness 0
}
geometry IndexedFaceSet {
coord Coordinate {
point [
-0.2 0 0.2
0.2 0 0.2
0.2 0 -0.2
-0.2 0 -0.2
-0.1 0.1 -0.1
-0.1 0.1 0.1
0.1 0.1 0.1
0.1 0.1 -0.1
]
}
coordIndex [
0, 1, 6, 5, -1, 2, 7, 6, 1, -1, 3, 4, 7, 2, -1, 0, 5, 4, 3, -1, 7, 4, 5, 6, -1, 3, 2, 1, 0, -1
]
}
}"""
children.importMFNodeFromString(-1, shape)
while supervisor.step(32) != -1:
pass
If you replace:
Supervisor {
controller "simple"
}
with:
Robot {
supervisor TRUE
controller "simple"
}
Then, it doesn't crash any more...
So, it crashes only if the parent node of the inserted node is a PROTO (Supervisor
is a deprecated PROTO).
The "ghost" object is the node in the PROTO parameter "markers". Actually it is simply a non-finalized node that is needed to forward the changes to the instances used inside the PROTO node. So it is correct that two nodes are created when inserting the node from the controller: one is the non-finalized instance in the PROTO parameter and one is the finalized node instance in the PROTO body.
But the PROTO parameter node should not be sent to webots.js
.
OK, thank you for the explanations. I believe I found a fix. I will write a PR for that and ask you to review it as I am not sure it's the right way to fix the problem.
Running ac3_viewer.wbt with streaming crashes Webots on Linux.
Step to reproduce:
--mode=pause
.Run
button in Webots.Stack: