worlds
webots_world
controllers
camera
camera.py
Go to the documentation of this file.
1
"""camera controller."""
2
3
# You may need to import some classes of the controller module. Ex:
4
# from controller import Robot, Motor, DistanceSensor
5
from
controller
import
Robot
6
7
# create the Robot instance.
8
robot = Robot()
9
10
# get the time step of the current world.
11
timestep = int(robot.getBasicTimeStep())
12
13
# You should insert a getDevice-like function in order to get the
14
# instance of a device of the robot. Something like:
15
# motor = robot.getMotor('motorname')
16
# ds = robot.getDistanceSensor('dsname')
17
# ds.enable(timestep)
18
19
# Main loop:
20
# - perform simulation steps until Webots is stopping the controller
21
while
robot.step(timestep) != -1:
22
# Read the sensors:
23
# Enter here functions to read sensor data, like:
24
# val = ds.getValue()
25
26
# Process sensor data here.
27
28
# Enter here functions to send actuator commands, like:
29
# motor.setPosition(10.0)
30
pass
31
32
# Enter here exit cleanup code.
rosinljubljana
Author(s): Igor Banfi
autogenerated on Mon Feb 24 2020 12:32:36