-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainController.py
68 lines (57 loc) · 2.61 KB
/
MainController.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
62
63
64
65
66
import HandrailLocator
import MapManager
import CameraController
# This code manages the state of the robot and calls the necessary functions
class MainController:
def __init__(self):
self.handrail_locator = HandrailLocator.calibrate_from_package_return_handrail_filter()
self.map_manager = MapManager.create_sample_map_manager()
self.camera = CameraController()
def find_and_id_handrails(self):
handrail_vectors = self.handrail_locator.get_handrail_vectors()
id_confidence_list = [self.map_manager.assign_id_and_conf_to_handrail_detection(distance, offset) for
distance, offset in handrail_vectors]
# Initializing robot
# Instantiate robot object
# Give it initial state
# Give it an initial location
# Give it positions of handrail
# State driven behavior
# Do while(all handrails are not cleaned)
# If state = 1 (searching for handrails)
# While handrail is not found (state = 1):
# HardwareController.find_handrail
# Take pictures every so often
# Run handrail detection (HandrailLocator.get_handrail_vectors())
# If (handrail detected)
# MapManager.assignID
# Go to state 2
# If state = 2
# While (state != 5)
# Move to handrail
# Update position
# HardwareController.go_to_handrail(current postion, handrail position)
# If (obstacle)
# State = 3
# If (handrail)
# State = 5
#If state = 3
# While (state = 3)
# Map.AddObstacle(current position, obstacle position)
# Map.PlanNewPath
# If (avoided obstacle)
# If all handrails clean
# State = 4
# If detected handrail isn't clean
# State = 2
# If undetected handrail isn't cleaned
# State = 1
# If state = 4
# SLAM.FindNearestWall
# HardwareController.MoveTowardWall(current position, wall position)
# If squared up with wall
#HardwareController.AdjustWallGrip
# State = 1
# If state = 5
# HardwareController.CleanHandrail()
# State = 1