Control System Update

This commit is contained in:
RyandPark2006 2022-01-23 21:46:29 +00:00
parent 7cd3555b4b
commit 86219c72e8
5 changed files with 81 additions and 71 deletions

View File

@ -132,78 +132,78 @@ class Propioception:
return 1 return 1
# Test # # Test
stuff = Propioception( # stuff = Propioception(
left_hip_pitch= 0, # left_hip_pitch= 0,
left_hip_yaw= 0, # left_hip_yaw= 0,
left_hip_roll= 0, # left_hip_roll= 0,
left_knee_pitch= 0, # left_knee_pitch= 0,
left_ankle_pitch= 0, # left_ankle_pitch= 0,
left_ankle_yaw= 0, # left_ankle_yaw= 0,
left_ankle_roll= 0, # left_ankle_roll= 0,
right_hip_pitch= 0, # right_hip_pitch= 0,
right_hip_yaw= 0, # right_hip_yaw= 0,
right_hip_roll= 0, # right_hip_roll= 0,
right_knee_pitch= 0, # right_knee_pitch= 0,
right_ankle_pitch= 0, # right_ankle_pitch= 0,
right_ankle_yaw= 0, # right_ankle_yaw= 0,
right_ankle_roll= 0, # right_ankle_roll= 0,
left_shoulder_pitch= 0, # left_shoulder_pitch= 0,
left_shoulder_yaw= 0, # left_shoulder_yaw= 0,
left_shoulder_roll= 0, # left_shoulder_roll= 0,
left_elbow_pitch= 0, # left_elbow_pitch= 0,
right_shoulder_pitch= 0, # right_shoulder_pitch= 0,
right_shoulder_yaw= 0, # right_shoulder_yaw= 0,
right_shoulder_roll= 0, # right_shoulder_roll= 0,
right_elbow_pitch= 0, # right_elbow_pitch= 0,
torso_pitch= 0, # torso_pitch= 0,
torso_yaw= 0, # torso_yaw= 0,
torso_roll= 0, # torso_roll= 0,
neck_pitch= 0, # neck_pitch= 0,
neck_yaw= 0, # neck_yaw= 0,
neck_roll= 0 # neck_roll= 0
) # )
"""Update cases""" # """Update cases"""
# Success case # # Success case
print(stuff.data['neck_roll']) # print(stuff.data['neck_roll'])
stuff.update({'neck_roll': 21}) # stuff.update({'neck_roll': 21})
print(stuff.data['neck_roll']) # print(stuff.data['neck_roll'])
# -1 case # # -1 case
print(stuff.update(None)) # print(stuff.update(None))
# -2 case
print(stuff.update([]))
# -3 case
print(stuff.update({'test': 21}))
"""Remove cases"""
# Success case
print(stuff.data['neck_roll'])
print(stuff.remove(['neck_roll']))
# -1 case
print(stuff.remove(None))
# # -2 case # # -2 case
print(stuff.remove({})) # print(stuff.update([]))
# -3 case # # -3 case
print(stuff.remove(['test'])) # print(stuff.update({'test': 21}))
"""Add cases""" # """Remove cases"""
# Success case # # Success case
print('test' in stuff.data.keys()) # print(stuff.data['neck_roll'])
stuff.add({'test': 21}) # print(stuff.remove(['neck_roll']))
print(stuff.data['test'])
# -1 case # # -1 case
print(stuff.add(None)) # print(stuff.remove(None))
# -2 case # # # -2 case
print(stuff.add([])) # print(stuff.remove({}))
# -3 case # # -3 case
print(stuff.add({'test': 21})) # print(stuff.remove(['test']))
# """Add cases"""
# # Success case
# print('test' in stuff.data.keys())
# stuff.add({'test': 21})
# print(stuff.data['test'])
# # -1 case
# print(stuff.add(None))
# # -2 case
# print(stuff.add([]))
# # -3 case
# print(stuff.add({'test': 21}))

Binary file not shown.

View File

@ -4,6 +4,9 @@
# 1 for reading sensor data # 1 for reading sensor data
# Updates sensor data through wifi and propiosense system # Updates sensor data through wifi and propiosense system
# 1 for executing the first action in the priority queue # 1 for executing the first action in the priority queue
from Propioception import *
import threading import threading
import socket import socket
import heapq import heapq
@ -54,16 +57,14 @@ class Receiver:
print("Inside execute",self.actions) print("Inside execute",self.actions)
def sensorData(self): def sensorData(self):
print("Test") # Test
# Read from Arduinos to know what motors and sensors there are
def runSimul(self): def runSimul(self):
threading.Thread(target=self.priorityQueue).start() threading.Thread(target=self.priorityQueue).start()
threading.Thread(target=self.execute()).start() threading.Thread(target=self.execute()).start()
threading.Thread(target=self.sensorData()).start() threading.Thread(target=self.sensorData()).start()
def main(): def startBoot():
simulation = Receiver('10.235.1.127',12345) simulation = Receiver('10.235.1.127',12345)
simulation.runSimul() simulation.runSimul()
if __name__ == "__main__":
main()

View File

@ -1,3 +1,4 @@
# Use methods online to dehash data packages/ instructions # Use methods online to dehash data packages/ instructions
# Add instruction to priority queue # Add instruction to priority queue
def readInstruction

8
Control System/main.py Normal file
View File

@ -0,0 +1,8 @@
import sys
from bootup import *
def main():
startBoot() # when Olympian is booted up for first time
if __name__ == "__main__":
main()