-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmotorTesting.py
61 lines (49 loc) · 1.09 KB
/
motorTesting.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
'''
@author Juan Carlos Aguilera
'''
import os
import sys
sys.path.append('/usr/local/lib/python3.4/site-packages/')
import threading
import time
import math
import numpy as np
import cv2
import random
import pathfinding
import socket
from scipy import misc
from scipy.ndimage import rotate
import lib.variables as var
import lib.motors as motors
import lib.imu as imu
import Jetson.dbscan_contours as dbscan
def navigation_init(self, threadID, name):
threading.Thread.__init__(self);
self.threadID = threadID;
self.name = name;
def try_right(power):
motors.move_right(100)
motors.move_left(-100)
def try_left(power):
motors.move_right(-100)
motors.move_left(100)
curr = 0
def run():
#imu.init();
#imu.get_delta_theta();
turn_degrees_accum = 0;
start = time.gmtime()
motors.move_both(0);
while curr < 5:
#print(imu.compass());
#imu_angle = imu.get_delta_theta()['z']%360;
#if(imu_angle > 180):
# imu_angle = imu_angle -360;
#print(imu_angle);
motors.move_left(0)
motors.move_right(0)
curr = time.gmtime() - start
motors.move_both(0)
if __name__ == '__main__':
run()