-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsquare.py
34 lines (25 loc) · 859 Bytes
/
square.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import brickpi
import time
interface=brickpi.Interface()
interface.initialize()
motors = [0,1]
speed = 6.0
interface.motorEnable(motors[0])
interface.motorEnable(motors[1])
motorParams = interface.MotorAngleControllerParameters()
motorParams.maxRotationAcceleration = 6.0
motorParams.maxRotationSpeed = 12.0
motorParams.feedForwardGain = 255/20.0
motorParams.minPWM = 18.0
motorParams.pidParameters.minOutput = -255
motorParams.pidParameters.maxOutput = 255
motorParams.pidParameters.k_p = 100.0
motorParams.pidParameters.k_i = 0.0
motorParams.pidParameters.k_d = 0.0
interface.setMotorAngleControllerParameters(motors[0],motorParams)
interface.setMotorAngleControllerParameters(motors[1],motorParams)
interface.setMotorRotationSpeedReferences(motors,[speed,speed])
print "Press Ctrl+C to exit"
while True:
time.sleep(1)
interface.terminate()