Skip to content

Commit 69df457

Browse files
Juliana MashonJuliana Mashon
Juliana Mashon
authored and
Juliana Mashon
committed
Updated function comments
1 parent ac88a47 commit 69df457

File tree

2 files changed

+7
-107
lines changed

2 files changed

+7
-107
lines changed

broker_connect.py

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ def __init__(self):
1212

1313
self.last_message = None
1414

15-
## ERROR HANDLING
16-
1715
## FUNCTIONS -- SENDING MESSAGES
1816

1917
def connect(self):

broker_functions.py

+7-105
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(self):
3535

3636
self.client = None
3737

38-
def read_status(self): #########################################
38+
def read_status(self):
3939
# Get device status tree
4040
message = {
4141
"kind": "rpc_request",
@@ -59,7 +59,7 @@ def read_status(self): #########################################
5959
# Return status as json object: status[""]
6060
return status_tree
6161

62-
def read_sensor(self, id): #########################################
62+
def read_sensor(self, id):
6363
# Get sensor data
6464
peripheral_str = self.api.get_info('peripherals', id)
6565
mode = peripheral_str['mode']
@@ -177,7 +177,7 @@ def unlock(self):
177177
# No inherent return value
178178
return print("Triggered device unlock.")
179179

180-
def reboot(self): #########################################
180+
def reboot(self):
181181
# Tell bot to reboot
182182
# No inherent return value
183183
reboot_message = {
@@ -193,7 +193,7 @@ def reboot(self): #########################################
193193
self.broker_connect.publish(reboot_message)
194194
return print("Triggered device reboot.")
195195

196-
def shutdown(self): #########################################
196+
def shutdown(self):
197197
# Tell bot to shutdown
198198
# No inherent return value
199199
shutdown_message = {
@@ -398,72 +398,7 @@ def off(self, id):
398398
self.control_peripheral(id, 0)
399399

400400
# TODO: sort_points(points, method)
401-
# Order group of points with method
402-
# Return ???
403-
404-
# TODO: sort(points, method) --> API? --> order group of points according to chosen method
405-
406-
# def sort(tray, tray_cell):
407-
# cell = tray_cell.upper()
408-
# seeder_needle_offset = 17.5
409-
# cell_spacing = 12.5
410-
411-
# cells = {
412-
# "A1": {"label": "A1", "x": 0, "y": 0},
413-
# "A2": {"label": "A2", "x": 0, "y": 1},
414-
# "A3": {"label": "A3", "x": 0, "y": 2},
415-
# "A4": {"label": "A4", "x": 0, "y": 3},
416-
# "B1": {"label": "B1", "x": -1, "y": 0},
417-
# "B2": {"label": "B2", "x": -1, "y": 1},
418-
# "B3": {"label": "B3", "x": -1, "y": 2},
419-
# "B4": {"label": "B4", "x": -1, "y": 3},
420-
# "C1": {"label": "C1", "x": -2, "y": 0},
421-
# "C2": {"label": "C2", "x": -2, "y": 1},
422-
# "C3": {"label": "C3", "x": -2, "y": 2},
423-
# "C4": {"label": "C4", "x": -2, "y": 3},
424-
# "D1": {"label": "D1", "x": -3, "y": 0},
425-
# "D2": {"label": "D2", "x": -3, "y": 1},
426-
# "D3": {"label": "D3", "x": -3, "y": 2},
427-
# "D4": {"label": "D4", "x": -3, "y": 3}
428-
# }
429-
430-
# # Checks
431-
# if tray["pointer_type"] != "ToolSlot":
432-
# print("Error: Seed Tray variable must be a seed tray in a slot")
433-
# return
434-
# elif cell not in cells:
435-
# print("Error: Seed Tray Cell must be one of **A1** through **D4**")
436-
# return
437-
438-
# # Flip X offsets depending on pullout direction
439-
# flip = 1
440-
# if tray["pullout_direction"] == 1:
441-
# flip = 1
442-
# elif tray["pullout_direction"] == 2:
443-
# flip = -1
444-
# else:
445-
# print("Error: Seed Tray **SLOT DIRECTION** must be `Positive X` or `Negative X`")
446-
# return
447-
448-
# # A1 coordinates
449-
# A1 = {
450-
# "x": tray["x"] - seeder_needle_offset + (1.5 * cell_spacing * flip),
451-
# "y": tray["y"] - (1.5 * cell_spacing * flip),
452-
# "z": tray["z"]
453-
# }
454-
455-
# # Cell offset from A1
456-
# offset = {
457-
# "x": cell_spacing * cells[cell]["x"] * flip,
458-
# "y": cell_spacing * cells[cell]["y"] * flip
459-
# }
460-
461-
# # Return cell coordinates
462-
# return {
463-
# "x": A1["x"] + offset["x"],
464-
# "y": A1["y"] + offset["y"],
465-
# "z": A1["z"]
466-
# }
401+
# TODO: sort(points, method)
467402

468403
def soil_height(self):
469404
# Execute soil height scripts
@@ -495,42 +430,9 @@ def detect_weeds(self):
495430

496431
self.broker_connect.publish(detect_weeds_message)
497432

498-
def calibrate_camera(self): # TODO: fix "sequence_id"
499-
# Execute calibrate camera script
500-
# No inherent return value
501-
calibrate_message = {
502-
**RPC_REQUEST,
503-
"body": {
504-
"kind": "execute_script",
505-
"args": {
506-
"label": "camera-calibration"
507-
},
508-
"body": {
509-
"kind": "pair",
510-
"args": {
511-
"label": "CAMERA_CALIBRATION_easy_calibration",
512-
"value": "\"TRUE\""
513-
}
514-
}
515-
}
516-
}
517-
518-
self.broker_connect.publish(calibrate_message)
519-
520-
def photo_grid(self): # TODO: fix "sequence_id"
521-
# Execute photo grid script
522-
# No inherent return value
523-
photo_grid_message = {
524-
**RPC_REQUEST,
525-
"body": {
526-
"kind": "execute",
527-
"args": {
528-
"sequence_id": 24372
529-
}
530-
}
531-
}
532433

533-
self.broker_connect.publish(photo_grid_message)
434+
# TODO: calibrate_camera()
435+
# TODO: photo_grid()
534436

535437
def take_photo(self):
536438
# Take single photo

0 commit comments

Comments
 (0)