diff options
Diffstat (limited to 'simulation')
| -rw-r--r-- | simulation/controllers/Soccer_Ball/Soccer_Ball.py | 18 | ||||
| -rw-r--r-- | simulation/protos/Ball.proto | 4 | ||||
| -rw-r--r-- | simulation/protos/BallCandy.proto | 38 | ||||
| -rw-r--r-- | simulation/protos/field.proto | 13 | ||||
| -rw-r--r-- | simulation/protos/icons/BallCandy.png | bin | 0 -> 10445 bytes | |||
| -rw-r--r-- | simulation/protos/soccer_ball.proto | 29 | ||||
| -rw-r--r-- | simulation/protos/soccerballrbc.proto | 16 | ||||
| -rw-r--r-- | simulation/protos/three_omniwheel.proto | 10 | ||||
| -rw-r--r-- | simulation/worlds/.soccer.jpg | bin | 33784 -> 106131 bytes | |||
| -rw-r--r-- | simulation/worlds/.soccer.wbproj | 8 | ||||
| -rw-r--r-- | simulation/worlds/soccer.wbt | 18 |
11 files changed, 121 insertions, 33 deletions
diff --git a/simulation/controllers/Soccer_Ball/Soccer_Ball.py b/simulation/controllers/Soccer_Ball/Soccer_Ball.py new file mode 100644 index 0000000..70a26d7 --- /dev/null +++ b/simulation/controllers/Soccer_Ball/Soccer_Ball.py @@ -0,0 +1,18 @@ +from controller import Robot, Emitter +import time + +robot = Robot() +emitter = robot.getDevice("emitter") + +# Time step of the simulation +timestep = int(robot.getBasicTimeStep()) + +# Pulse emission interval (e.g., 1 pulse per second) +pulse_interval = 1.0 + +# Main loop +while robot.step(timestep) != -1: + current_time = robot.getTime() + if int(current_time) % pulse_interval == 0: + emitter.send(b'\x01') # Emit a single byte pulse + time.sleep(1.0 / pulse_interval) diff --git a/simulation/protos/Ball.proto b/simulation/protos/Ball.proto index c992189..14726f1 100644 --- a/simulation/protos/Ball.proto +++ b/simulation/protos/Ball.proto @@ -18,11 +18,9 @@ PROTO Ball [ field SFFloat angularDamping 0.33 # Defines the angular damping of the ball. field SFString contactMaterial "default" # Is `Solid.contactMaterial`. ] -{ - Solid { +Robot { translation IS translation rotation IS rotation - children [ DEF BALL_SHAPE Shape { appearance PBRAppearance { baseColor IS color diff --git a/simulation/protos/BallCandy.proto b/simulation/protos/BallCandy.proto new file mode 100644 index 0000000..08438fc --- /dev/null +++ b/simulation/protos/BallCandy.proto @@ -0,0 +1,38 @@ +#VRML_SIM R2024a utf8 +# license: Copyright Cyberbotics Ltd. Licensed for use only with Webots. +# license url: https://cyberbotics.com/webots_assets_license +# documentation url: https://webots.cloud/run?url=https://github.com/cyberbotics/webots/blob/released/projects/robots/softbank/nao/protos/BallCandy.proto +# keywords: robot/accessory + +PROTO BallCandy [ + field SFVec3f translation 0 0 0.0162 + field SFRotation rotation 0 0 1 0 + field SFString name "ball candy" + field SFColor color 0.9 0.1 0.1 +] +{ +Solid { + translation IS translation + rotation IS rotation + children [ + Shape { + appearance PBRAppearance { + baseColor IS color + roughness 0.3 + metalness 0 + } + geometry DEF CANDY_BALL_SHAPE Sphere { + radius 0.0325 + subdivision 3 + } + } + ] + name IS name + model "ball candy" + boundingObject USE CANDY_BALL_SHAPE + physics Physics { + density -1 + mass 0.16 + } +} +} diff --git a/simulation/protos/field.proto b/simulation/protos/field.proto deleted file mode 100644 index aa96ff5..0000000 --- a/simulation/protos/field.proto +++ /dev/null @@ -1,13 +0,0 @@ -#VRML_SIM R2023b utf8 -# Describe the functionality of your PROTO here. - - -PROTO field [ - field SFBool castShadows TRUE -] -{ - CadShape { - castShadows IS castShadows - url "/home/atim/Documenten/robotica/3dfiles/soccerfield.obj" - } -} diff --git a/simulation/protos/icons/BallCandy.png b/simulation/protos/icons/BallCandy.png Binary files differnew file mode 100644 index 0000000..6a3a0a1 --- /dev/null +++ b/simulation/protos/icons/BallCandy.png diff --git a/simulation/protos/soccer_ball.proto b/simulation/protos/soccer_ball.proto new file mode 100644 index 0000000..629df1a --- /dev/null +++ b/simulation/protos/soccer_ball.proto @@ -0,0 +1,29 @@ +#VRML_SIM R2024a utf8 +# Describe the functionality of your PROTO here. + +EXTERNPROTO "/home/abel/Documents/robotica/simulation/protos/Ball.proto" + +PROTO soccer_ball [ + field SFVec3f translation 0 0 0.1625 + field SFRotation rotation 0 0 1 0 + field SFString name "soccer_ball" + field SFString controller "" +] +{ + Ball { + translation IS translation + rotation IS rotation + name IS name + children [ + Emitter { + channel 1 # Assign an appropriate channel number + range -1 # Setting range to -1 makes it unlimited + aperture 6.28319 # 2 * PI radians for omnidirectional + beamWidth 6.28319 # 2 * PI radians for omnidirectional + dataSize 1 # Size of the data packet + dataRate 1 # Rate of data emission in bits per second + } + ] + controller IS controller + } +} diff --git a/simulation/protos/soccerballrbc.proto b/simulation/protos/soccerballrbc.proto new file mode 100644 index 0000000..7a744d0 --- /dev/null +++ b/simulation/protos/soccerballrbc.proto @@ -0,0 +1,16 @@ +#VRML_SIM R2024a utf8 +# Describe the functionality of your PROTO here. + + +PROTO soccerballrbc [ + field SFVec3f translation 0 0 0 + field SFRotation rotation 0 0 1 0 + field SFString name "emitter" +] +{ + Emitter { + translation IS translation + rotation IS rotation + name IS name + } +} diff --git a/simulation/protos/three_omniwheel.proto b/simulation/protos/three_omniwheel.proto index 14f3f61..7643587 100644 --- a/simulation/protos/three_omniwheel.proto +++ b/simulation/protos/three_omniwheel.proto @@ -731,12 +731,12 @@ DEF OMNI_WHEELS Robot { } } Camera { - translation 0 0 5 - rotation 0 1 0 1.5708 - fieldOfView 3.14 + translation 0 0 2 + fieldOfView 0.5 width 640 - height 640 - projection "spherical" + height 480 + exposure 1.0 + projection "planar" } DEF BODY_TRANS Pose { translation 0 0 0.03 diff --git a/simulation/worlds/.soccer.jpg b/simulation/worlds/.soccer.jpg Binary files differindex 58cbefe..06e82b2 100644 --- a/simulation/worlds/.soccer.jpg +++ b/simulation/worlds/.soccer.jpg diff --git a/simulation/worlds/.soccer.wbproj b/simulation/worlds/.soccer.wbproj index 34fdd72..0f1697c 100644 --- a/simulation/worlds/.soccer.wbproj +++ b/simulation/worlds/.soccer.wbproj @@ -1,10 +1,10 @@ -Webots Project File version R2023b -perspectives: 000000ff00000000fd00000003000000000000000000000000fc0100000001fb0000001a0044006f00630075006d0065006e0074006100740069006f006e000000000000000014000000000000000000000001000001f60000038efc0200000001fb0000001400540065007800740045006400690074006f007201000000170000038e0000008900ffffff0000000300000780000000cdfc0100000002fb0000000e0043006f006e0073006f006c00650100000000000005660000000000000000fc00000000000007800000006900fffffffa000000000100000002fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000ffffffff0000006900fffffffb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000ffffffff0000000000000000000005880000038e00000001000000020000000100000008fc00000000 +Webots Project File version R2024a +perspectives: 000000ff00000000fd00000003000000000000000000000000fc0100000001fb0000001a0044006f00630075006d0065006e0074006100740069006f006e000000000000000014000000000000000000000001000001f400000391fc0200000001fb0000001400540065007800740045006400690074006f00720100000016000003910000008900ffffff0000000300000780000000d5fc0100000002fb0000000e0043006f006e0073006f006c00650100000000000005660000000000000000fc00000000000007800000006900fffffffa000000000100000002fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000ffffffff0000006900fffffffb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000ffffffff00000000000000000000058a0000039100000001000000020000000100000008fc00000000 simulationViewPerspectives: 000000ff000000010000000200000100000003480100000002010000000100 -sceneTreePerspectives: 000000ff00000001000000030000001d000000c0000000fa0100000002010000000200 +sceneTreePerspectives: 000000ff00000001000000030000001f000000c0000000fa0100000002010000000200 maximizedDockId: -1 centralWidgetVisible: 1 orthographicViewHeight: 1 textFiles: 2 "controllers/OMHI_test/OMHI_test.py" "protos/three_omniwheel.proto" "protos/Ball.proto" consoles: Console:All:All -renderingDevicePerspectives: robot:camera;1;0.33125;0.00518135;0 +renderingDevicePerspectives: robot:camera;1;0.564583;0;0 diff --git a/simulation/worlds/soccer.wbt b/simulation/worlds/soccer.wbt index 923ea36..af3ec77 100644 --- a/simulation/worlds/soccer.wbt +++ b/simulation/worlds/soccer.wbt @@ -1,31 +1,33 @@ -#VRML_SIM R2023b utf8 +#VRML_SIM R2024a utf8 EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2023b/projects/objects/backgrounds/protos/TexturedBackground.proto" EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2023b/projects/objects/backgrounds/protos/TexturedBackgroundLight.proto" EXTERNPROTO "../protos/three_omniwheel.proto" EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2023b/projects/samples/contests/robocup/protos/RobocupSoccerField.proto" -EXTERNPROTO "../protos/Ball.proto" WorldInfo { } Viewpoint { - orientation -0.03595733212996323 0.5262633829020815 0.8495610172804262 6.193238178192842 - position -2.037531963006127 0.0964241547726655 0.3894014354770412 + orientation 0.2328975714773309 -0.7440385747903977 -0.6262310439636758 5.334957372457696 + position -0.6838588961447356 -0.458946565376689 0.9090251685961268 } TexturedBackground { + texture "stadium_dry" } TexturedBackgroundLight { + texture "stadium" } DEF Robot three_omniwheel { translation 0.273203 -0.0732043 0.169476 rotation 0 0 -1 -0.7854153071795862 controller "OMHI_test" } +PointLight { + attenuation 0 0 1 + intensity 20 + location 0 0.3 20 +} RobocupSoccerField { translation -0.031783 -0.00794585 -1.82077e-14 rotation 0 0 -1 0.0850848 } -Ball { - translation -0.51 0 0.1625 - color 0.533333 0.541176 0.521569 -} |
