From 5ab2e6084e3ca0dcb9ba21db483b7f13f04fd6c3 Mon Sep 17 00:00:00 2001 From: Aditya Vasantharao Date: Thu, 21 Jan 2021 22:08:58 -0500 Subject: [PATCH] Add controller --- simulation/controllers/olympian/olympian.py | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 simulation/controllers/olympian/olympian.py diff --git a/simulation/controllers/olympian/olympian.py b/simulation/controllers/olympian/olympian.py new file mode 100644 index 0000000..bb32be9 --- /dev/null +++ b/simulation/controllers/olympian/olympian.py @@ -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.