mirror of
https://github.com/PotentiaRobotics/engine-software.git
synced 2025-04-16 02:00:16 -04:00
Add controller
This commit is contained in:
parent
e49febc38d
commit
5ab2e6084e
32
simulation/controllers/olympian/olympian.py
Normal file
32
simulation/controllers/olympian/olympian.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
"""olympian 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.getMotor('motorname')
|
||||
# ds = robot.getDistanceSensor('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.
|
Loading…
Reference in New Issue
Block a user