Beispiel #1
0
#  ds = robot.getDistanceSensor('dsname')
#  ds.enable(timestep)

# Tutorial Code:
leftMotor = robot.getMotor('left wheel motor')
rightMotor = robot.getMotor('right wheel motor')

leftMotor.setPosition(float('inf'))
rightMotor.setPosition(float('inf'))

leftMotor.setVelocity(0.1 * MAX_SPEED)
rightMotor.setVelocity(-0.1 * MAX_SPEED)

#########################################################

hingeJoint = robot.getChild('HingeJoint')

# 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.