Skip to content

Commit 3fa2fa8

Browse files
committed
Updates for Webots 2022b.
This breaks compability with earlier webots releases, due to incompatible changes in proto & world files (`EXTERNPROTO` statements). The robot controller now uses the new `stepBegin()`/`stepEnd()` Webots API, which should improve performance.
1 parent 8e6125b commit 3fa2fa8

11 files changed

Lines changed: 48 additions & 24 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ By default the controller will (ab)use the battery temperature field (last value
1111

1212
## Dependencies
1313

14-
The controller is written in Python3 and has been tested to work with Webots 2022a & 2022b (nightly).
14+
The controller is written in Python3 and has been tested to work with Webots 2022b.
1515
It depends on [OpenCV](https://pypi.org/project/opencv-python/) and [NumPy](https://numpy.org/) python modules for converting camera images to YUV422.
1616

1717

controllers/nao_lola_python/nao_lola_python.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,10 @@ def run(self):
450450
conn = None
451451
imgCounter = self.frametime
452452

453-
while robot.step(self.timeStep) != -1:
453+
while True:
454+
if self.stepBegin(self.timeStep) == -1:
455+
break
456+
454457
self.key = self.keyboard.getKey()
455458

456459
if conn:
@@ -487,8 +490,12 @@ def run(self):
487490
print(AnsiCodes.GREEN_FOREGROUND + "LoLa client connected." + AnsiCodes.RESET)
488491
except:
489492
conn = None
493+
self.stepEnd()
490494
continue
491495

496+
if self.stepEnd() == -1:
497+
break
498+
492499
# remove socket on exit
493500
os.unlink(self.SOCK_PATH)
494501

protos/NaoJersey.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#VRML_SIM R2022a utf8
1+
#VRML_SIM R2022b utf8
22
# Soccer jersey specifically designed for the Nao robot.
33
#
44
# The appearance can be modified changing the value of the 'jerseyTexture' field,
55
# otherwise if no texture is available the model will use the color specified in 'jerseyColor' field.
66
# A default set of red and blue textures with player number from 1 to 5 is provided.
77

88
PROTO NaoJersey [
9-
field MFString jerseyTexture "textures/nao_jersey_dark_1.png"
10-
field SFColor jerseyColor 0.5 0 0
9+
field MFString jerseyTexture "../protos/textures/nao_jersey_dark_1.png"
10+
field SFColor jerseyColor 0.4 0.05 0.05
1111
]
1212
{
1313
Slot {

protos/NaoLeftWristH25Realistic.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#VRML_SIM R2022a utf8
1+
#VRML_SIM R2022b utf8
22
# tags: hidden
33
# template language: javascript
44

protos/NaoRightWristH25Realistic.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#VRML_SIM R2022a utf8
1+
#VRML_SIM R2022b utf8
22
# tags: hidden
33
# template language: javascript
44

protos/NaoV6.proto

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
#VRML_SIM R2022a utf8
1+
#VRML_SIM R2022b utf8
22
# documentation url: https://www.cyberbotics.com/doc/guide/nao
33
# Generic model of Nao robot
44
# Model designed by Cyberbotics Ltd. according to the online documentation provided by Aldebaran Robotics.
55
# template language: javascript
66

7+
EXTERNPROTO "../protos/NaoLeftWristH25Realistic.proto"
8+
EXTERNPROTO "../protos/NaoRightWristH25Realistic.proto"
9+
710
PROTO NaoV6 [
811
field SFVec3f translation 0 0 0.334 # Is `Transform.translation`.
912
field SFRotation rotation 0 0 1 0 # Is `Transform.rotation`.

protos/SPL_Ball.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#VRML_SIM R2022a utf8
1+
#VRML_SIM R2022b utf8
22
# license: Copyright Cyberbotics Ltd. Licensed for use only with Webots.
33
# license url: https://cyberbotics.com/webots_assets_license
44
# A black and white soccer ball with customizable radius and mass.

protos/SPL_Field.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
#VRML_SIM R2022a utf8
1+
#VRML_SIM R2022b utf8
22
# license: Copyright Cyberbotics Ltd. Licensed for use only with Webots.
33
# license url: https://cyberbotics.com/webots_assets_license
44
# Robot soccer field according to Standard Platform League rules from 2020.
55
# The soccer field is built on a total carpet area of length 10.4 m and width 7.4 m.
66
# The field dimensions (measured between center of white lines) are 9 x 6 m.
77

8+
EXTERNPROTO "../protos/SPL_Goal.proto"
9+
810
PROTO SPL_Field [
911
field SFVec3f translation 0 0 0
1012
field SFRotation rotation 0 0 1 0

protos/SPL_Goal.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#VRML_SIM R2022a utf8
1+
#VRML_SIM R2022b utf8
22
# license: Copyright Cyberbotics Ltd. Licensed for use only with Webots.
33
# license url: https://cyberbotics.com/webots_assets_license
44
# Robot soccer goal inspired from the RoboCup 2013-2014 Standard Platform League.

worlds/full_game.wbt

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
#VRML_SIM R2022a utf8
1+
#VRML_SIM R2022b utf8
2+
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2022b/projects/objects/backgrounds/protos/TexturedBackground.proto"
3+
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2022b/projects/objects/backgrounds/protos/TexturedBackgroundLight.proto"
4+
EXTERNPROTO "../protos/SPL_Field.proto"
5+
EXTERNPROTO "../protos/SPL_Ball.proto"
6+
EXTERNPROTO "../protos/NaoV6.proto"
7+
EXTERNPROTO "../protos/NaoJersey.proto"
28
WorldInfo {
39
info [
410
"Simulation of the Robocup Standard Platform League"
@@ -48,7 +54,7 @@ DEF Blue1 NaoV6 {
4854
]
4955
jersey NaoJersey {
5056
jerseyTexture [
51-
"textures/nao_jersey_dark_1.png"
57+
"../protos/textures/nao_jersey_dark_1.png"
5258
]
5359
jerseyColor 0 0.75 1
5460
}
@@ -63,7 +69,7 @@ DEF Blue2 NaoV6 {
6369
]
6470
jersey NaoJersey {
6571
jerseyTexture [
66-
"textures/nao_jersey_dark_2.png"
72+
"../protos/textures/nao_jersey_dark_2.png"
6773
]
6874
jerseyColor 0 0.75 1
6975
}
@@ -78,7 +84,7 @@ DEF Blue3 NaoV6 {
7884
]
7985
jersey NaoJersey {
8086
jerseyTexture [
81-
"textures/nao_jersey_dark_3.png"
87+
"../protos/textures/nao_jersey_dark_3.png"
8288
]
8389
jerseyColor 0 0.75 1
8490
}
@@ -93,7 +99,7 @@ DEF Blue4 NaoV6 {
9399
]
94100
jersey NaoJersey {
95101
jerseyTexture [
96-
"textures/nao_jersey_dark_4.png"
102+
"../protos/textures/nao_jersey_dark_4.png"
97103
]
98104
jerseyColor 0 0.75 1
99105
}
@@ -108,7 +114,7 @@ DEF Blue5 NaoV6 {
108114
]
109115
jersey NaoJersey {
110116
jerseyTexture [
111-
"textures/nao_jersey_dark_5.png"
117+
"../protos/textures/nao_jersey_dark_5.png"
112118
]
113119
jerseyColor 0 0.75 1
114120
}
@@ -123,7 +129,7 @@ DEF Red1 NaoV6 {
123129
]
124130
jersey NaoJersey {
125131
jerseyTexture [
126-
"textures/nao_jersey_dark_1.png"
132+
"../protos/textures/nao_jersey_dark_1.png"
127133
]
128134
jerseyColor 0.5 0 0
129135
}
@@ -138,7 +144,7 @@ DEF Red2 NaoV6 {
138144
]
139145
jersey NaoJersey {
140146
jerseyTexture [
141-
"textures/nao_jersey_dark_2.png"
147+
"../protos/textures/nao_jersey_dark_2.png"
142148
]
143149
jerseyColor 0.5 0 0
144150
}
@@ -153,7 +159,7 @@ DEF Red3 NaoV6 {
153159
]
154160
jersey NaoJersey {
155161
jerseyTexture [
156-
"textures/nao_jersey_dark_3.png"
162+
"../protos/textures/nao_jersey_dark_3.png"
157163
]
158164
jerseyColor 0.5 0 0
159165
}
@@ -168,7 +174,7 @@ DEF Red4 NaoV6 {
168174
]
169175
jersey NaoJersey {
170176
jerseyTexture [
171-
"textures/nao_jersey_dark_4.png"
177+
"../protos/textures/nao_jersey_dark_4.png"
172178
]
173179
jerseyColor 0.5 0 0
174180
}
@@ -183,7 +189,7 @@ DEF Red5 NaoV6 {
183189
]
184190
jersey NaoJersey {
185191
jerseyTexture [
186-
"textures/nao_jersey_dark_5.png"
192+
"../protos/textures/nao_jersey_dark_5.png"
187193
]
188194
jerseyColor 0.5 0 0
189195
}

0 commit comments

Comments
 (0)