Esempio n. 1
0
 def __init__ (self, table, robot_position, lower_clamp_motor,
         lower_clamp_cylinders, lower_clamp_sensors, lower_clamp_zero,
         upper_clamp_up_down_cylinder, upper_clamp_in_out_cylinder,
         upper_clamp_open_cylinder, door_cylinder):
     Observable.__init__ (self)
     self.table = table
     self.robot_position = robot_position
     self.lower_clamp_motor = lower_clamp_motor
     self.lower_clamp_cylinders = lower_clamp_cylinders
     self.lower_clamp_sensors = lower_clamp_sensors
     self.lower_clamp_zero = lower_clamp_zero
     self.lower_clamp_clamping = [ None, None ]
     self.lower_clamp_content = [ [ ], [ ] ]
     self.upper_clamp_up_down_cylinder = upper_clamp_up_down_cylinder
     self.upper_clamp_in_out_cylinder = upper_clamp_in_out_cylinder
     self.upper_clamp_open_cylinder = upper_clamp_open_cylinder
     self.upper_clamp_content = [ ]
     self.door_cylinder = door_cylinder
     self.load = [ ]
     self.lower_clamp_motor.register (self.__lower_clamp_notified)
     for c in self.lower_clamp_cylinders:
         c.register (self.__lower_clamp_notified)
     self.upper_clamp_up_down_cylinder.register (self.__upper_clamp_notified)
     self.upper_clamp_in_out_cylinder.register (self.__upper_clamp_notified)
     self.upper_clamp_open_cylinder.register (self.__upper_clamp_notified)
     self.door_cylinder.register (self.__door_notified)
     self.robot_position.register (self.__robot_position_notified)
Esempio n. 2
0
 def __init__ (self, link_in, link_out, scheduler,
         pos_in, pos_out, speed_in, speed_out, init_pos,
         switch_in = None, switch_out = None):
     """Cylinder parameters:
      - link_in, link_out: output conected to valve, if one is none, use
        simple effect.
      - pos_in, pos_out: maximum position in each direction (minimum and
        maximum length) (mm).
      - speed_in, speed_out: linear speed (mm/s).
      - init_pos: initial position (mm).
      - switch_in, switch_out: limit switch models if present."""
     Observable.__init__ (self)
     self.link_in, self.link_out = link_in, link_out
     self.scheduler = scheduler
     self.pos_in, self.pos_out = pos_in, pos_out
     self.speed_in, self.speed_out = speed_in, speed_out
     self.switch_in, self.switch_out = switch_in, switch_out
     self.last_update = self.scheduler.date
     self.speed = 0
     self.pos = init_pos
     if self.link_in:
         self.link_in.register (self.__notified)
     if self.link_out:
         self.link_out.register (self.__notified)
     self.__timed_update ()
     self.__update (init = True)
Esempio n. 3
0
 def __init__ (self, node, instance, index):
     Observable.__init__ (self)
     self.value = 0
     self.__node = node
     self.__mtype = node.reserve (instance + ':adc')
     self.__index = index
     self.register (self.__notified)
Esempio n. 4
0
 def __init__ (self, pack, index):
     Observable.__init__ (self)
     self.pack = pack
     self.index = index
     self.min = None
     self.max = None
     self.register (self.__notified)
Esempio n. 5
0
 def __init__ (self, pack, name):
     Observable.__init__ (self)
     self.pack = pack
     assert name not in self.pack.channels
     self.pack.channels[name] = self
     self.name = name
     self.value = 0.0
     self.register (self.__notified)
Esempio n. 6
0
 def __init__ (self, link, scheduler, table, pos, angle, into = None,
         level = 0, exclude = exclude):
     Observable.__init__ (self)
     DistanceSensor.__init__ (self, table, pos, angle, self.RANGE, into,
             level, exclude)
     self.link = link
     self.scheduler = scheduler
     self.value = None
     self.register (self.__update)
     self.evaluate ()
Esempio n. 7
0
 def __init__ (self, pack, name):
     Observable.__init__ (self)
     self.pack = pack
     assert name not in self.pack.gpios
     self.pack.gpios[name] = self
     self.name = name
     self.direction = 'input'
     self.output_state = None
     self.input_state = None
     self.state = self.input_state
     self.register (self.__notified)
Esempio n. 8
0
 def __init__ (self, *points, **kwargs):
     Observable.__init__ (self)
     self.pos = None
     self.angle = 0
     self.points = points
     self.level = 0
     for i in kwargs:
         if i == 'level':
             self.level = kwargs[i]
         else:
             raise TypeError ("unexpected keyword argument")
Esempio n. 9
0
 def __init__ (self, onto, pos, angle, range):
     Drawable.__init__ (self, onto)
     Observable.__init__ (self)
     self.onto = onto
     self.pos = pos
     self.angle = angle
     self.range = range
     self.target = (pos[0] + cos (angle) * range,
             pos[1] + sin (angle) * range)
     self.obstacles = [ ]
     self.distance = None
     self.hide = False
Esempio n. 10
0
 def __init__ (self, table, robot_position,
         arm_cyl, clamp_cyl, contacts, pot):
     Observable.__init__ (self)
     self.table = table
     self.robot_position = robot_position
     self.arm_cyl = arm_cyl
     self.clamp_cyl = clamp_cyl
     self.contacts = contacts
     self.pot = pot
     self.plate = None
     self.cherries = [ ]
     self.robot_position.register (self.__robot_position_notified)
     self.arm_cyl.register (self.__arm_notified)
     self.clamp_cyl.register (self.__arm_notified)
     self.pot.register (self.__pot_notified)
Esempio n. 11
0
 def __init__ (self, table, robot_position, arm_cyl, far_cyl, near_cyl,
         arm_out_contact, arm_in_contact):
     Observable.__init__ (self)
     self.table = table
     self.robot_position = robot_position
     self.arm_cyl = arm_cyl
     self.far_cyl = far_cyl
     self.near_cyl = near_cyl
     self.arm_out_contact = arm_out_contact
     self.arm_in_contact = arm_in_contact
     self.far_pushed = False
     self.near_pushed = False
     self.arm_cyl.register (self.__arm_notified)
     self.far_cyl.register (self.__push_notified)
     self.near_cyl.register (self.__push_notified)
     self.robot_position.register (self.__robot_position_notified)
Esempio n. 12
0
 def __init__ (self, link, scheduler,
         speed, min_stop = None, max_stop = None):
     """Motor parameters:
      - speed: rad/s for a 1.0 value.
      - min_stop, max_stop: rad, mechanical stops."""
     Observable.__init__ (self)
     self.scheduler = scheduler
     self.speed = speed
     self.min_stop = min_stop
     self.max_stop = max_stop
     self.angle = 0
     self.link = link
     self.value = None
     self.last_update = self.scheduler.date
     self.link.register (self.__notified)
     self.__timed_update ()
 def __init__ (self, link, scheduler, table, pos, angle, into = None,
         level = 0, exclude = None, factor = 1):
     Observable.__init__ (self)
     self.rays = [ ]
     range = self.RANGE * self.QUALITY
     self.rays.append (DistanceSensorSensopartRay (table, pos, angle,
         range, into, level, exclude))
     for s in self.SECONDARY:
         for i in (-1, 1):
             self.rays.append (DistanceSensorSensopartRay (table, pos,
                 angle + s[0] * i, range * s[1], into, level, exclude))
     self.factor = factor
     self.link = link
     self.scheduler = scheduler
     self.value = None
     self.evaluate ()
     self.register (self.__update)
Esempio n. 14
0
 def __init__ (self, table, robot_position, elevation_motor,
         rotation_motor, clamping_motor, door_motors, slot_contacts,
         codebars):
     Observable.__init__ (self)
     self.table = table
     self.robot_position = robot_position
     self.elevation_motor = elevation_motor
     self.rotation_motor = rotation_motor
     self.clamping_motor = clamping_motor
     self.rotation_motor.limits.min = 0
     self.rotation_motor.limits.notify ()
     self.door_motors = (door_motors[0], None, door_motors[1],
             door_motors[2], None, door_motors[3], None)
     self.slots = (
             Slot (self.BAY_OFFSET, 0, 0 * self.BAY_ZOFFSET, 0,
                 door_motors[0], slot_contacts[0], codebars[0]),
             Slot (self.BAY_OFFSET, 0, 1 * self.BAY_ZOFFSET, 0,
                 None, slot_contacts[1]),
             Slot (self.BAY_OFFSET, 0, 2 * self.BAY_ZOFFSET, 0,
                 door_motors[1], slot_contacts[2]),
             Slot (-self.BAY_OFFSET, 0, 0 * self.BAY_ZOFFSET, 1,
                 door_motors[2], slot_contacts[3], codebars[1]),
             Slot (-self.BAY_OFFSET, 0, 1 * self.BAY_ZOFFSET, 1,
                 None, slot_contacts[4]),
             Slot (-self.BAY_OFFSET, 0, 2 * self.BAY_ZOFFSET, 1,
                 door_motors[3], slot_contacts[5]),
             Slot (0, self.BAY_OFFSET, 2 * self.BAY_ZOFFSET, None,
                 None, slot_contacts[6]))
     self.front_slots = (
             self.slots[self.SLOT_FRONT_BOTTOM],
             self.slots[self.SLOT_FRONT_MIDDLE],
             self.slots[self.SLOT_FRONT_TOP])
     self.back_slots = (
             self.slots[self.SLOT_BACK_BOTTOM],
             self.slots[self.SLOT_BACK_MIDDLE],
             self.slots[self.SLOT_BACK_TOP])
     self.load = None
     self.robot_position.register (self.__robot_position_notified)
     self.elevation_motor.register (self.__elevation_notified)
     self.rotation_motor.register (self.__rotation_notified)
     self.clamping_motor.register (self.__clamping_notified)
Esempio n. 15
0
 def __init__ (self, table, robot_position, left_clamp_link, right_clamp_link,
         elevator_link, gate_link, element_contacts):
     Observable.__init__ (self)
     self.table = table
     self.robot_position = robot_position
     self.clamp_link = (left_clamp_link, right_clamp_link)
     self.elevator_link = elevator_link
     self.gate_link = gate_link
     self.element_contacts = element_contacts
     self.element_contacts[1].state = True
     self.element_contacts[1].notify ()
     self.clamp_load = [ ]
     self.load = [ ]
     self.front_elements = [ ]
     self.tickness = None
     self.clamp_pos = [ None, None ]
     self.robot_position.register (self.__robot_position_notified)
     self.clamp_link[0].register (self.__left_clamp_notified)
     self.clamp_link[1].register (self.__right_clamp_notified)
     self.elevator_link.register (self.__elevator_notified)
     self.gate_link.register (self.__gate_notified)
Esempio n. 16
0
 def __init__ (self, table,
         arm_motor_link, cylinder_puck_contact,
         servo_links, bridge_puck_contact,
         elevator_motor_link, elevator_door_model, elevator_door_contact,
         into = None):
     Observable.__init__ (self)
     self.table = table
     self.into = into or ()
     self.arm_slot = [ None, None, None ]
     self.bridge_slot = [ None, None ]
     self.elevator_slot = [ ]
     self.lost = [ ]
     self.arm_motor_link = arm_motor_link
     self.arm_motor_link.register (self.__arm_motor_notified)
     self.cylinder_puck_contact = cylinder_puck_contact
     self.servo_links = servo_links
     self.bridge_puck_contact = bridge_puck_contact
     self.servo_links[0].register (self.__bridge_door_servo_notified)
     self.servo_links[1].register (self.__bridge_finger_servo_notified)
     self.elevator_motor_link = elevator_motor_link
     self.elevator_motor_link.register (self.__elevator_motor_notified)
     self.elevator_door = elevator_door_model
     self.elevator_door_contact = elevator_door_contact
     self.elevator_door.register (self.__elevator_door_notified)
Esempio n. 17
0
 def __init__ (self, dim, level = 0):
     Observable.__init__ (self)
     self.pos = None
     self.angle = 0
     self.dim = dim
     self.level = level
Esempio n. 18
0
 def __init__(self, radius, level=0):
     Observable.__init__(self)
     self.pos = None
     self.radius = radius
     self.level = level
Esempio n. 19
0
 def __init__ (self, node, instance):
     Observable.__init__ (self)
     self.pos = { }
     node.register (instance + ':pos-report', self.__handle)
Esempio n. 20
0
 def __init__ (self, motor_link):
     Observable.__init__ (self)
     self.motor_link = motor_link
     self.motor_link.register (self.__motor_notified)
Esempio n. 21
0
 def __init__ (self, node, mtype):
     Observable.__init__ (self)
     self.__node = node
     self.state = None
     node.register (mtype, self.__handle)
Esempio n. 22
0
 def __init__(self):
     Observable.__init__(self)
     self.pos = None
     self.angle = None
Esempio n. 23
0
 def __init__ (self, node, instance):
     Observable.__init__ (self)
     self.path = [ ]
     node.register (instance + ':path', self.__handle)
Esempio n. 24
0
 def __init__ (self):
     Observable.__init__ (self)
     self.value = None
Esempio n. 25
0
 def __init__ (self, link, obstacles = None):
     Observable.__init__ (self)
     self.link = link
     self.obstacles = obstacles or [ ]
     self.link.register (self.__notified)
Esempio n. 26
0
 def __init__ (self):
     Observable.__init__ (self)
     self.cherries = [ ]
Esempio n. 27
0
 def __init__ (self, link):
     Observable.__init__ (self)
     self.link = link
     self.link.register (self.__notified)
Esempio n. 28
0
 def __init__ (self, link, invert = False):
     Observable.__init__ (self)
     self.link = link
     self.state = None
     self.invert = invert
     self.register (self.__update)
 def __init__ (self, *args):
     Observable.__init__ (self)
     DistanceSensor.__init__ (self, *args)
Esempio n. 30
0
 def __init__ (self, table, robot_position, arm_cyl):
     Observable.__init__ (self)
     self.table = table
     self.robot_position = robot_position
     self.arm_cyl = arm_cyl
     self.arm_cyl.register (self.__arm_notified)