Skip to content

Commit 45c3d4c

Browse files
Juliana MashonJuliana Mashon
Juliana Mashon
authored and
Juliana Mashon
committed
Working e_stop and unlock
1 parent 9c4a851 commit 45c3d4c

File tree

1 file changed

+47
-22
lines changed

1 file changed

+47
-22
lines changed

broker_functions.py

+47-22
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def read_sensor(self, id):
6060
}]
6161
}
6262

63-
def message(self, message, type=None, channel=None):
63+
def message(self, message, type=None):
6464
# Send new log message via broker
6565
# No inherent return value
6666
message_message = {
@@ -70,12 +70,6 @@ def message(self, message, type=None, channel=None):
7070
"args": {
7171
"message": message,
7272
"message_type": type
73-
},
74-
"body": {
75-
"kind": "channel",
76-
"args": {
77-
"channel_name": channel
78-
}
7973
}
8074
}
8175
}
@@ -111,29 +105,60 @@ def wait(self, duration):
111105
def e_stop(self):
112106
# Tell bot to emergency stop
113107
# No inherent return value
114-
e_stop_message = {
115-
**RPC_REQUEST,
116-
"body": {
117-
"kind": "emergency_lock",
118-
"args": {}
119-
}
120-
}
121108

122-
self.broker_connect.publish(e_stop_message)
109+
new_message = {
110+
"kind": "rpc_request",
111+
"args": {
112+
"label": "",
113+
"priority": 9000
114+
},
115+
"body": [
116+
{
117+
"kind": "emergency_lock",
118+
"args": {}
119+
}
120+
]
121+
}
122+
# e_stop_message = {
123+
# **RPC_REQUEST,
124+
# "body": {
125+
# "kind": "emergency_lock",
126+
# "args": {}
127+
# }
128+
# }
129+
130+
# self.broker_connect.publish(e_stop_message)
131+
self.broker_connect.publish(new_message)
123132
return print("Triggered device emergency stop.")
124133

125134
def unlock(self):
126135
# Tell bot to unlock
127136
# No inherent return value
128-
unlock_message = {
129-
**RPC_REQUEST,
130-
"body": {
131-
"kind": "emergency_unlock",
132-
"args": {}
133-
}
137+
138+
# unlock_message = {
139+
# **RPC_REQUEST,
140+
# "body": {
141+
# "kind": "emergency_unlock",
142+
# "args": {}
143+
# }
144+
# }
145+
146+
new_unlock = {
147+
"kind": "rpc_request",
148+
"args": {
149+
"label": "",
150+
"priority": 9000
151+
},
152+
"body": [
153+
{
154+
"kind": "emergency_unlock",
155+
"args": {}
156+
}
157+
]
134158
}
159+
self.broker_connect.publish(new_unlock)
135160

136-
self.broker_connect.publish(unlock_message)
161+
# self.broker_connect.publish(unlock_message)
137162
return print("Triggered device unlock.")
138163

139164
def reboot(self):

0 commit comments

Comments
 (0)