np.random.seed(5) # degrees for left, right, up, down head_directions = [90, 270, 0, 180] timestep = 2000 # Initialize devices ps = [] psNames = ['ps0', 'ps1', 'ps2', 'ps3', 'ps4', 'ps5', 'ps6', 'ps7'] for i in range(8): ps.append(robot.getDistanceSensor(psNames[i])) ps[i].enable(timestep) cmpXY1 = robot.createCompass("compassXY_01") cmpXY1.enable(timestep) cmpZ1 = robot.createCompass("compassZ_01") cmpZ1.enable(timestep) # Initialize motors leftMotor = robot.getMotor('left wheel motor') rightMotor = robot.getMotor('right wheel motor') leftMotor.setPosition(float('inf')) rightMotor.setPosition(float('inf')) leftMotor.setVelocity(0.0) leftMotor.setVelocity(0.0) # Configuring parameters t = 0