Esempio n. 1
0
 def move(self, angle, speed = None, acc = None):
     dt = 0.06
     if speed == None:
         speed = self.speed
     if acc == None:
         acc = self.acc
     speed = speed * dt
     acc = acc * dt
     ramp = RampProfile(self.angle, angle, speed, acc)
     while True:
         pos = ramp.next()
         if not pos:
             break
         self.angle = pos
         time.sleep(dt)
Esempio n. 2
0
 def move(self, angle, speed=None, acc=None):
     dt = 0.06
     if speed == None:
         speed = self.speed
     if acc == None:
         acc = self.acc
     speed = speed * dt
     acc = acc * dt
     ramp = RampProfile(self.angle, angle, speed, acc)
     while True:
         pos = ramp.next()
         if not pos:
             break
         self.angle = pos
         time.sleep(dt)
Esempio n. 3
0
 def moveMonitor(self, target, speed = None, acc = None):
     with open("/tmp/toto", "w") as f:
         dt = 0.04
         if speed == None:
             speed_up = self.speed_up
             speed_clamp = self.speed_clamp
         else:
             speed_up = speed
             speed_clamp = speed
         if acc == None:
             acc = self.acc
         speed_d = speed_clamp * dt
         speed_g = speed_clamp * dt
         speed_h = speed_up * dt
         acc = acc * dt
         d,g,h = self.pos
         rampD = RampProfile(d, target[0], speed_d, acc)
         rampG = RampProfile(g, target[1], speed_g, acc)
         rampH = RampProfile(h, target[2], speed_h, acc)
         
         while True:
             d = rampD.next()
             g = rampG.next()
             h = rampH.next()
             if not any([d, g, h]):
                 break
             if d == None: d = target[0]
             if g == None: g = target[1]
             if h == None: h = target[2]
 
             self.target = (d, g, h)
             for i in range(5):
                 pd,pg,ph = self.pos
                 f.write("%f %f %f %f %f %f\n" % (d,g,h,pd,pg,ph))
                 time.sleep(dt/5)
Esempio n. 4
0
    def move(self, target, speed = None, acc = None):
        dt = 0.04
        if speed == None:
            speed_up = self.speed_up
            speed_clamp = self.speed_clamp
        else:
            speed_up = speed
            speed_clamp = speed
        if acc == None:
            acc = self.acc
        speed_d = speed_clamp * dt
        speed_g = speed_clamp * dt
        speed_h = speed_up * dt
        acc = acc * dt
        d,g,h = self.pos
        rampD = RampProfile(d, target[0], speed_d, acc)
        rampG = RampProfile(g, target[1], speed_g, acc)
        rampH = RampProfile(h, target[2], speed_h, acc)
        
        while self.abort == False:
            d = rampD.next()
            g = rampG.next()
            h = rampH.next()
            if not any([d, g, h]):
                break
            if d == None: d = target[0]
            if g == None: g = target[1]
            if h == None: h = target[2]

            self.target = (d, g, h)
            time.sleep(dt)