Exemplo n.º 1
0
 def elementsandVarsTest(self):
     """test method, for experimental composition of nodes: this creates all the elements for a basic 
     reprap type node"""
     
     """CARTESIAN BOT DEFINITION"""
     """3d Position"""
     pos=Variable(self,"position",Vector(['x','y','z']),"vector","mm",None,"memory",3,True,['x','y','z'])     
     """all the motors/actors controlling the 3d Position"""
     mot1=Actor(type="StepperMotor",name="x_motor",tool="cartesianBot",boundVariable=pos,variableChannel='x')
     mot2=Actor(type="StepperMotor",name="y_motor",tool="cartesianBot",boundVariable=pos,variableChannel='y')
     mot3=Actor(type="StepperMotor",name="z_motor",tool="cartesianBot",boundVariable=pos,variableChannel='z')
     """all the sensors giving feedback on  the 3d Position"""
     endStop1=Sensor(type="end_sensor",name="x_startSensor",tool="cartesianBot",boundVariable=pos,variableChannel='x')
     endStop2=Sensor(type="end_sensor",name="x_endSensor",tool="cartesianBot",boundVariable=pos,variableChannel='x')
     endStop3=Sensor(type="end_sensor",name="y_startSensor",tool="cartesianBot",boundVariable=pos,variableChannel='y')
     endStop4=Sensor(type="end_sensor",name="y_endSensor",tool="cartesianBot",boundVariable=pos,variableChannel='y')
     endStop5=Sensor(type="end_sensor",name="z_startSensor",tool="cartesianBot",boundVariable=pos,variableChannel='z')
     endStop6=Sensor(type="end_sensor",name="z_endSensor",tool="cartesianBot",boundVariable=pos,variableChannel='z')
     """add all these to the current node"""
     self.add_variable(pos)
     self.add_elements([mot1,mot2,mot3,endStop1,endStop2,endStop3,endStop4,endStop5,endStop6])
     pos.attach_sensors([(endStop1,endStop1.channel),(endStop2,endStop2.channel),(endStop3,endStop3.channel),
                         (endStop4,endStop4.channel),(endStop5,endStop5.channel),(endStop6,endStop6.channel)])
     pos.attach_actors([(mot1,mot1.channel),(mot2,mot2.channel),(mot3,mot3.channel)])
     
     """EXTRUDER 1 DEFINITION"""
     """two variables"""
     head_temp=Variable(self,"head_temp",0,"temperature","celcius")
     extrudate_lng=Variable(self,"filament_extrudate",Vector(['e']),"vector","mm")
     """all the actors controlling the extrusion of this print head"""
     extrudMot=Actor(type="StepperMotor",name="e_motor1",tool="PrintHead",boundVariable=extrudate_lng,variableChannel='e')
     head_heater=Actor(type="Heater",name="extruder1_heater",tool="PrintHead",boundVariable=head_temp)
     """all the sensors giving feedback on the extrusion of this print head"""
     head_tempSensor=Sensor(type="temperature_sensor",name="extruder1_temp_sensor",tool="PrintHead",boundVariable=head_temp)
  
     extrudate_lng.attach_actor(extrudMot,'e')
     head_temp.attach_both([(head_heater,None)],[(head_tempSensor,None)])
Exemplo n.º 2
0
    def elementsandVarsTest(self):
        """test method, for experimental composition of nodes: this creates all the elements for a basic 
        reprap type node"""
        """CARTESIAN BOT DEFINITION"""
        """3d Position"""
        pos = Variable(self, "position", Vector(['x', 'y', 'z']), "vector",
                       "mm", None, "memory", 3, True, ['x', 'y', 'z'])
        """all the motors/actors controlling the 3d Position"""
        mot1 = Actor(type="StepperMotor",
                     name="x_motor",
                     tool="cartesianBot",
                     boundVariable=pos,
                     variableChannel='x')
        mot2 = Actor(type="StepperMotor",
                     name="y_motor",
                     tool="cartesianBot",
                     boundVariable=pos,
                     variableChannel='y')
        mot3 = Actor(type="StepperMotor",
                     name="z_motor",
                     tool="cartesianBot",
                     boundVariable=pos,
                     variableChannel='z')
        """all the sensors giving feedback on  the 3d Position"""
        endStop1 = Sensor(type="end_sensor",
                          name="x_startSensor",
                          tool="cartesianBot",
                          boundVariable=pos,
                          variableChannel='x')
        endStop2 = Sensor(type="end_sensor",
                          name="x_endSensor",
                          tool="cartesianBot",
                          boundVariable=pos,
                          variableChannel='x')
        endStop3 = Sensor(type="end_sensor",
                          name="y_startSensor",
                          tool="cartesianBot",
                          boundVariable=pos,
                          variableChannel='y')
        endStop4 = Sensor(type="end_sensor",
                          name="y_endSensor",
                          tool="cartesianBot",
                          boundVariable=pos,
                          variableChannel='y')
        endStop5 = Sensor(type="end_sensor",
                          name="z_startSensor",
                          tool="cartesianBot",
                          boundVariable=pos,
                          variableChannel='z')
        endStop6 = Sensor(type="end_sensor",
                          name="z_endSensor",
                          tool="cartesianBot",
                          boundVariable=pos,
                          variableChannel='z')
        """add all these to the current node"""
        self.add_variable(pos)
        self.add_elements([
            mot1, mot2, mot3, endStop1, endStop2, endStop3, endStop4, endStop5,
            endStop6
        ])
        pos.attach_sensors([(endStop1, endStop1.channel),
                            (endStop2, endStop2.channel),
                            (endStop3, endStop3.channel),
                            (endStop4, endStop4.channel),
                            (endStop5, endStop5.channel),
                            (endStop6, endStop6.channel)])
        pos.attach_actors([(mot1, mot1.channel), (mot2, mot2.channel),
                           (mot3, mot3.channel)])
        """EXTRUDER 1 DEFINITION"""
        """two variables"""
        head_temp = Variable(self, "head_temp", 0, "temperature", "celcius")
        extrudate_lng = Variable(self, "filament_extrudate", Vector(['e']),
                                 "vector", "mm")
        """all the actors controlling the extrusion of this print head"""
        extrudMot = Actor(type="StepperMotor",
                          name="e_motor1",
                          tool="PrintHead",
                          boundVariable=extrudate_lng,
                          variableChannel='e')
        head_heater = Actor(type="Heater",
                            name="extruder1_heater",
                            tool="PrintHead",
                            boundVariable=head_temp)
        """all the sensors giving feedback on the extrusion of this print head"""
        head_tempSensor = Sensor(type="temperature_sensor",
                                 name="extruder1_temp_sensor",
                                 tool="PrintHead",
                                 boundVariable=head_temp)

        extrudate_lng.attach_actor(extrudMot, 'e')
        head_temp.attach_both([(head_heater, None)], [(head_tempSensor, None)])