Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Obstacle Sim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Trim Bresilla
Obstacle Sim
Commits
6cb485d8
Verified
Commit
6cb485d8
authored
2 years ago
by
Trim Bresilla
Browse files
Options
Downloads
Patches
Plain Diff
ADD: basic sim
parent
ed068bd4
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
controllers/my_controller/my_controller.py
+32
-0
32 additions, 0 deletions
controllers/my_controller/my_controller.py
worlds/.empty.wbproj
+8
-0
8 additions, 0 deletions
worlds/.empty.wbproj
worlds/empty.wbt
+42
-0
42 additions, 0 deletions
worlds/empty.wbt
with
82 additions
and
0 deletions
controllers/my_controller/my_controller.py
0 → 100644
+
32
−
0
View file @
6cb485d8
"""
my_controller controller.
"""
# You may need to import some classes of the controller module. Ex:
# from controller import Robot, Motor, DistanceSensor
from
controller
import
Robot
# create the Robot instance.
robot
=
Robot
()
# get the time step of the current world.
timestep
=
int
(
robot
.
getBasicTimeStep
())
# You should insert a getDevice-like function in order to get the
# instance of a device of the robot. Something like:
motor
=
robot
.
getDevice
(
'
moose
'
)
ds
=
robot
.
getDevice
(
'
dsname
'
)
ds
.
enable
(
timestep
)
# Main loop:
# - perform simulation steps until Webots is stopping the controller
while
robot
.
step
(
timestep
)
!=
-
1
:
# Read the sensors:
# Enter here functions to read sensor data, like:
val
=
ds
.
getValue
()
# Process sensor data here.
# Enter here functions to send actuator commands, like:
motor
.
setPosition
(
10.0
)
#pass
# Enter here exit cleanup code.
This diff is collapsed.
Click to expand it.
worlds/.empty.wbproj
0 → 100644
+
8
−
0
View file @
6cb485d8
Webots Project File version R2022a
perspectives: 000000ff00000000fd00000002000000010000026d0000082afc0200000001fb0000001400540065007800740045006400690074006f007201000000140000082a0000008900ffffff00000003000006cf000000d9fc0100000001fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000000006cf000000000000000000000af90000082a00000001000000020000000100000008fc00000000
simulationViewPerspectives: 000000ff00000001000000020000016e00000a8e0100000002010000000100
sceneTreePerspectives: 000000ff0000000100000002000000c0000000fa0100000002010000000200
maximizedDockId: -1
centralWidgetVisible: 1
orthographicViewHeight: 1
textFiles: 0 "controllers/my_controller/my_controller.py"
This diff is collapsed.
Click to expand it.
worlds/empty.wbt
0 → 100644
+
42
−
0
View file @
6cb485d8
#VRML_SIM R2022a utf8
WorldInfo {
}
Viewpoint {
orientation -0.11983785308044682 0.09382975071411193 0.9883495671319924 1.4440953869710094
position -3.074267466187142 -77.90569219932617 28.125151217528988
}
Moose {
hidden position_0_0 0.00013306353513683865
hidden position_0_1 -4.657893805559212e-05
hidden position_0_2 0.0001589276949843798
hidden position_0_3 -0.0002606719988015476
hidden position_0_4 0.00014068689332475537
hidden position_0_5 -0.0002724002604920586
hidden position_0_6 3.3789255993892166e-05
hidden position_0_7 5.085251207931985e-05
hidden rotation_1 -1 0 0 0.00013306353484261992
hidden rotation_2 1 0 0 4.657894196759461e-05
hidden rotation_3 -1 0 0 0.00015892769608741148
hidden rotation_4 1 0 0 0.00026067199915484493
hidden rotation_5 1 0 0 0.00014068689374689748
hidden rotation_6 -1 0 0 0.000272400259960944
hidden rotation_7 1 0 0 3.378924962947211e-05
hidden rotation_8 1 0 0 5.085250883067676e-05
translation 3.4488554728007257 -15.9620195668529 1.2391590877792884
rotation 0.034120978313643 -0.023631249584012064 -0.9991382901690927 1.5698848341583316
controller "my_controller"
}
TexturedBackground {
}
TexturedBackgroundLight {
texture "morning_cloudy_empty"
luminosity 2
}
UnevenTerrain {
size 50 50 2
appearance Grass {
textureTransform TextureTransform {
scale 10 10
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment