Ejemplo n.º 1
0
    def __init__(self, robot):
        LoopPrimitive.__init__(self, robot, 1)

        self.freq = 0.1

        self.sinus = [
            Sinus(self.robot,
                  50, [self.robot.shoulder_pitch],
                  amp=30,
                  freq=self.freq,
                  offset=15),
            Sinus(self.robot,
                  50, [self.robot.shoulder_roll],
                  amp=30,
                  freq=self.freq,
                  offset=30),
            Sinus(self.robot,
                  50, [self.robot.elbow_pitch],
                  amp=30,
                  freq=self.freq,
                  offset=30),
            Sinus(self.robot,
                  50, [self.robot.arm_yaw],
                  amp=30,
                  freq=self.freq,
                  offset=40),
        ]
Ejemplo n.º 2
0
    def __init__(self, robot, freq, face_detector):
        LoopPrimitive.__init__(self, robot, freq)

        self.face_detector = face_detector

        self.dx, self.dy = 60, 50
        self._tracked_face = None
Ejemplo n.º 3
0
    def __init__(self, robot, move_file):
        LoopPrimitive.__init__(self, robot, 50)

        with open(move_file) as f:
            self.reader = csv.DictReader(f)
            self.data = [row for row in self.reader]
            self.i = 0
 def __init__(self, environment, freq, motors, mov, primitive_duration, log):
     LoopPrimitive.__init__(self, environment.robot, freq)
     self.motors = motors
     self.mov = mov
     self.primitive_duration = primitive_duration
     self.one_step_duration = primitive_duration / mov.shape[0]
     self.log = log
     self.env = environment
Ejemplo n.º 5
0
 def __init__(self, environment, freq, motors, mov, primitive_duration,
              log):
     LoopPrimitive.__init__(self, environment.robot, freq)
     self.motors = motors
     self.mov = mov
     self.primitive_duration = primitive_duration
     self.one_step_duration = primitive_duration / mov.shape[0]
     self.log = log
     self.env = environment
Ejemplo n.º 6
0
    def __init__(self, robot, freq=0.5, temp_limit=40,
                 time_reduce_torque=5, small_torque=20,
                 time_compliant=10, player='aplay', sound=None):

        LoopPrimitive.__init__(self, robot, freq)

        self.temp_limit = temp_limit
        self.time_reduce_torque = time_reduce_torque
        self.time_compliant = time_compliant
        self.small_torque = small_torque
        self.player = player
        self.sound = sound
        self._overheat_time = {}
Ejemplo n.º 7
0
    def __init__(self, robot, leg, refresh_freq=50):
        LoopPrimitive.__init__(self, robot, refresh_freq)
        # you should never access directly to the motors in a primitive, because this is the goal of the Primitives manager
        # to manage this acces for all the primitives : https://poppy-project.github.io/pypot/primitive.html
        fake_motors = getattr(self.robot, leg)
        self.knee = fake_motors[2]
        self.hip = fake_motors[1]
        self.hip_lateral = fake_motors[0]
        self.motors = fake_motors

        # size of segment's leg
        self.shin = 63
        self.thigh = 55
        self.pelvis = 38
Ejemplo n.º 8
0
 def __init__(self, robot, command_freq = 40):
     
     LoopPrimitive.__init__(self, robot, command_freq)
     
     self.legs = []
     self.all_leg_motors = []
     
     for i in range(4):
         leg_motors = getattr(self.robot, DiploTurnLeft.leg_names[i])
         self.legs.append(DiploLeg(leg_motors, DiploTurnLeft.is_front[i]))
         self.all_leg_motors.extend(leg_motors)
         
     self.command_freq = command_freq
     self.dt = 1. / command_freq
Ejemplo n.º 9
0
    def __init__(self, robot, distance, step_duration, frequency=50):
        LoopPrimitive.__init__(self, robot, frequency)

        self.step_length = 0.1
        self.step_height = 0.01
        self.pelvis_height = 0.098
        self.motors = dict([(m.name, self.get_mockup_motor(m))
                            for m in self.robot.motors])
        self.distance_left = distance
        self.step_duration = step_duration
        ssp_ratio = .75
        self.ssp_duration = ssp_ratio * step_duration
        self.dsp_duration = (1 - ssp_ratio) * step_duration
        self.dt = 1. / frequency
        self.pos = None
Ejemplo n.º 10
0
    def __init__(self, robot, freq, detector, tracked_id):
        LoopPrimitive.__init__(self, robot, freq)

        self.dx, self.dy = 60, 50

        def get_marker_pos():
            marker = [m.position for m in getattr(detector, 'markers')
                      if m.id == tracked_id]

            if len(marker) == 1:
                return marker[0]

            return None

        self.get_marker_pos = get_marker_pos
Ejemplo n.º 11
0
    def __init__(self, robot, freq, detector, tracked_id):
        LoopPrimitive.__init__(self, robot, freq)

        self.dx, self.dy = 60, 50

        def get_marker_pos():
            marker = [
                m.position for m in getattr(detector, 'markers')
                if m.id == tracked_id
            ]

            if len(marker) == 1:
                return marker[0]

            return None

        self.get_marker_pos = get_marker_pos
Ejemplo n.º 12
0
    def __init__(self,
                 robot,
                 freq=0.5,
                 temp_limit=40,
                 time_reduce_torque=5,
                 small_torque=20,
                 time_compliant=10,
                 player='aplay',
                 sound=None):

        LoopPrimitive.__init__(self, robot, freq)

        self.temp_limit = temp_limit
        self.time_reduce_torque = time_reduce_torque
        self.time_compliant = time_compliant
        self.small_torque = small_torque
        self.player = player
        self.sound = sound
        self._overheat_time = {}
Ejemplo n.º 13
0
 def __init__(self, robot, move):
     LoopPrimitive.__init__(self, robot, move.framerate)
     self.move = move
Ejemplo n.º 14
0
 def __init__(self, robot):
     LoopPrimitive.__init__(self, robot, 1.)
Ejemplo n.º 15
0
 def __init__(self, robot, refresh_freq):
     self.robot = robot
     LoopPrimitive.__init__(self, robot, refresh_freq)
Ejemplo n.º 16
0
    def __init__(self, robot, freq, tracked_motors):
        LoopPrimitive.__init__(self, robot, freq)
        self.freq = freq

        self.tracked_motors = map(self.get_mockup_motor, tracked_motors)
Ejemplo n.º 17
0
 def __init__(self, robot, move):
     LoopPrimitive.__init__(self, robot, move.framerate)
     self.positions = move.positions()
     self.motors = robot.motors
     self.maxPreviousPos = 10
     self.previousPoses = []
Ejemplo n.º 18
0
 def __init__(self, robot, freq=5):
     LoopPrimitive.__init__(self, robot, freq)
Ejemplo n.º 19
0
 def __init__(self, robot):
     LoopPrimitive.__init__(self, robot, 1.0)
Ejemplo n.º 20
0
 def __init__(self, robot):
     LoopPrimitive.__init__(self, robot, 50.0)
     self.motors = [self.robot.arm_yaw]
Ejemplo n.º 21
0
 def __init__(self, robot):
     LoopPrimitive.__init__(self, robot, 1)
     self.record_name = "demo_example"
Ejemplo n.º 22
0
 def __init__(self, robot, freq=5):
     LoopPrimitive.__init__(self, robot, freq)
Ejemplo n.º 23
0
 def __init__(self, robot, motors):
     LoopPrimitive.__init__(self, robot, 50)
     self.motors = motors