Example #1
0
def subsystem_operations():
    content=request.json
    if request.method == 'PUT':
        index = content['index']
        temp = content['temperature']
        subsystems[index].set_temp(temp)
        return 'Updated'

    if request.method == 'GET':
        return jsonify([s.serialize() for s in subsystems])

    if request.method == 'POST':
        new_temp = content['temperature']
        new_subsystem = Subsystem(monitor, len(subsystems))
        subsystem.set_temp(new_temp)
        subsystems.append(new_subsystem)
        return "Succesfully created subsystem ", len(fans)-1
Example #2
0
 def onChanged(self, obj, prop):
     Subsystem.onChanged(self, obj, prop)
     SubsystemLong.onChanged(self, obj, prop)
     SubsystemStructural.onChanged(self, obj, prop)
Example #3
0
 def __init__(self, obj, component):
     Subsystem.__init__(self, obj, component)
     SubsystemBend.__init__(self, obj)
     SubsystemStructural.__init__(self, obj)
Example #4
0
 def execute(self, obj):
     Subsystem.execute(self, obj)
     SubsystemBend.execute(self, obj)
     SubsystemStructural.execute(self, obj)
Example #5
0
 def onChanged(self, obj, prop):
     Subsystem.onChanged(self, obj, prop)
     SubsystemBend.onChanged(self, obj, prop)
     SubsystemStructural.onChanged(self, obj, prop)
Example #6
0
from adafruit_servokit import ServoKit 
from Subsystem import Subsystem
import time

kit = ServoKit(channels=16)

leftAnkle = Subsystem(4)
rightAnkle = Subsystem(8)

leftKnee = Subsystem(5)
rightKnee  = Subsystem(9)

leftThigh = Subsystem(6)
rightThigh = Subsystem(10)

class Humanoid():

    def stand(self):
        leftAnkle.rotateTo(100)   #L ANKLE
        leftKnee.rotateTo(120)   #L KNEE
        leftThigh.rotateTo(120)   #L HIP
        rightAnkle.rotateTo(100)  #R ANKLE
        rightKnee.rotateTo(100)   #R KNEE
        rightThigh.rotateTo(100) #R HIP
        print('standing')

    def walkForward(self):
        rightAnkle.rotateTo(80)   #L ANKLE
        leftAnkle.rotateTo(70)   #L ANKLE

        time.sleep(0.25)
Example #7
0
from adafruit_servokit import ServoKit
from Subsystem import Subsystem
import time

kit = ServoKit(channels=16)

leftAnkle = Subsystem(4)
rightAnkle = Subsystem(8)

leftKnee = Subsystem(5)
rightKnee = Subsystem(9)

leftThigh = Subsystem(6)
rightThigh = Subsystem(10)

leftShoulder = Subsystem(13)
rightShoulder = Subsystem(15)

leftElbow = Subsystem(12)
rightElbow = Subsystem(14)

leftWrist = Subsystem(0)
rightWrist = Subsystem(2)

leftHand = Subsystem(3)
rightHand = Subsystem(1)

delay = 0.4


class Humanoid():
Example #8
0
logging.basicConfig(filename='info.log', level=logging.INFO)
logger = logging.getLogger("monitoring_system")
logger.setLevel(logging.INFO)
filehandle = logging.FileHandler('system.log')
formatter = logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
filehandle.setFormatter(formatter)
logger.addHandler(filehandle)

logger.info("Sample log")

if fan_upper_bound < no_fan or subsystem_upper_bound<no_subsystem:
    logger.error("Server startup fail: Limit exceeds the upper bound")
    print("System can not start: Check log file")
    exit()
for i in range(no_subsystem):
    subsystem=Subsystem(monitor, i)
    subsystems.append(subsystem)

for i in range(no_fan):
    fan=Fan(monitor, i, 130)
    fans.append(fan)

app=Flask(__name__)


@app.route('/fan',methods=['GET','POST','PUT'])
def fan_operations():
    content=request.json 
    if request.method == 'PUT':
        index = content['index']
        max_speed = content['max_speed']
Example #9
0
 def __init__(self, obj, component):
     Subsystem.__init__(self, obj, component)
     SubsystemLong.__init__(self, obj)
     SubsystemCavity.__init__(self, obj)
Example #10
0
 def __init__(self, obj, component):
     Subsystem.__init__(self, obj, component)
     SubsystemLong.__init__(self, obj)
     SubsystemCavity.__init__(self, obj)
Example #11
0
 def execute(self, obj):
     Subsystem.execute(self, obj)
     SubsystemLong.execute(self, obj)
     SubsystemCavity.execute(self, obj)
Example #12
0
 def onChanged(self, obj, prop):
     Subsystem.onChanged(self, obj, prop)
     SubsystemLong.onChanged(self, obj, prop)
     SubsystemCavity.onChanged(self, obj, prop)
Example #13
0
 def execute(self, obj):
     Subsystem.execute(self, obj)
     SubsystemLong.execute(self, obj)
     SubsystemStructural.execute(self, obj)
Example #14
0
 def execute(self, obj):
     Subsystem.execute(self, obj)
     SubsystemBend.execute(self, obj)
     SubsystemStructural.execute(self, obj)
Example #15
0
 def execute(self, obj):
     Subsystem.execute(self, obj)
     SubsystemLong.execute(self, obj)
     SubsystemStructural.execute(self, obj)
Example #16
0
 def __init__(self, obj, component):
     Subsystem.__init__(self, obj, component)
     SubsystemLong.__init__(self, obj)
     SubsystemStructural.__init__(self, obj)
Example #17
0
 def onChanged(self, obj, prop):
     Subsystem.onChanged(self, obj, prop)
     SubsystemLong.onChanged(self, obj, prop)
     SubsystemCavity.onChanged(self, obj, prop)
Example #18
0
 def execute(self, obj):
     Subsystem.execute(self, obj)
     SubsystemLong.execute(self, obj)
     SubsystemCavity.execute(self, obj)
     
Example #19
0
 def execute(self, obj):
     Subsystem.execute(self, obj)
     SubsystemShear.execute(self, obj)
     SubsystemStructural.execute(self, obj)