forked from peter-dye/ButtBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimelapse.py
More file actions
38 lines (34 loc) · 851 Bytes
/
timelapse.py
File metadata and controls
38 lines (34 loc) · 851 Bytes
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
35
36
37
38
from motor_driver import MotorDriver
from arm_driver import ArmDriver
from servo_driver import ServoDriver
import time
import random as r
md = MotorDriver()
sd = ServoDriver()
ad = ArmDriver()
while True:
dist = r.randint(15,50)
print("dist is", dist)
speed = 1
print("speed is ", speed)
md.motor_send(speed, dist, 'fwd')
time.sleep(dist*0.1)
func = r.randint(1,3)
if func == 1:
sub_func = r.randint(1,2)
if sub_func == 1:
if ad.state == 'up':
ad.down()
else:
ad.up()
else:
ad.pickup()
elif func == 2:
sub_func = r.randint(1,2)
if sub_func == 1:
ang = r.randint(-180,180)
sd.pan(ang)
else:
ang = r.randint(0,126)
sd.pitch(ang)
time.sleep(5)