Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 40 additions & 38 deletions src/state_machine/src/main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,44 +151,46 @@ def approachnavigation(self):
def sendtextdata(self):
text = self.textEdit.toPlainText()
print(text, self.which_callback)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this for debugging, can be removed as well

if not text.isnumeric():
print("Invalid input!")
elif int(text) > 100:
print("Invalid input!")
else:
# publish this to the pod server or state machine
if self.which_callback == 0:
#pickup
print('this is what i should be pub')
self.StateUpdate.StateTransitionCond = int(text)
self.StateUpdate.TransState = 0
self.StateUpdate.OperationMode = 1

elif self.which_callback == 1:
#dropoff
self.StateUpdate.StateTransitionCond = int(text)
self.StateUpdate.TransState = 0
self.StateUpdate.OperationMode = 2

elif self.which_callback == 2:
#podunlock
self.StateUpdate.StateTransitionCond = 0
self.StateUpdate.TransState = 0
self.StateUpdate.OperationMode = 2

elif self.which_callback == 3:
#podlocksuccess
self.StateUpdate.StateTransitionCond = 1
self.StateUpdate.TransState = 0
self.StateUpdate.OperationMode = 0

elif self.which_callback == 4:
#approach
self.StateUpdate.StateTransitionCond = int(text)
self.StateUpdate.TransState = 0
self.StateUpdate.OperationMode = 3

self.cmd_pub.publish(self.StateUpdate)
if self.which_callback == 0 or self.which_callback == 1 or self.which_callback == 4:
if not text.isnumeric():
print("Invalid input!")
return
elif int(text) > 100:
print("Invalid input!")
return

# publish this to the pod server or state machine
if self.which_callback == 0:
#pickup
self.StateUpdate.StateTransitionCond = int(text)
self.StateUpdate.TransState = 0
self.StateUpdate.OperationMode = 1

elif self.which_callback == 1:
#dropoff
self.StateUpdate.StateTransitionCond = int(text)
self.StateUpdate.TransState = 0
self.StateUpdate.OperationMode = 2

elif self.which_callback == 2:
#podunlock
self.StateUpdate.StateTransitionCond = 0
self.StateUpdate.TransState = 0
self.StateUpdate.OperationMode = 2

elif self.which_callback == 3:
#podlocksuccess
self.StateUpdate.StateTransitionCond = 1
self.StateUpdate.TransState = 0
self.StateUpdate.OperationMode = 0

elif self.which_callback == 4:
#approach
self.StateUpdate.StateTransitionCond = int(text)
self.StateUpdate.TransState = 0
self.StateUpdate.OperationMode = 3

self.cmd_pub.publish(self.StateUpdate)


if __name__ == '__main__':
Expand Down