-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (31 loc) · 905 Bytes
/
main.py
File metadata and controls
36 lines (31 loc) · 905 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
from imageProcessing import *
from movements import *
import time
import timeit
start = timeit.default_timer()
# Capture image from camera
## TESTED
image = captureImage()
# Calculate centroids from the image taken
## TESTED
centroids = findCentroids(image)
# centroids = [[(588, 446), (554, 971)],[]]
# transform all centroids into world coordinates
## TESTED
coordinates = []
for maturity in centroids:
coordinate_maturity = []
for centroid in maturity:
coordinate_maturity.append(transformToWorld(centroid))
coordinates.append(coordinate_maturity)
RIPE_BOX = [20, 25]
RAW_BOX = [-20, 25]
destination = [RIPE_BOX, RAW_BOX]
# Go to coordinate, pick orange, drop in the correct box, again go to intial position
i = -1
for maturity in coordinates:
i += 1
for coordinate in maturity:
placeOrange(coordinate, i)
elapsed = timeit.default_timer() - start
print elapsed