Example #1
0
 def EmumDevice(self):
     pymotor.enum_device()
     print('\nemum complete!\n')
     self.device_name, self.dev_count, self.friend_name = pymotor.enum_device(
     )
     self.device = numpy.empty(5, dtype=object)
     if self.dev_count == 0:
         print("\nNo finding of device.")
         print("\nUse the vitual device:\n")
         self.device_name = ["testxmotor", "testymotor", "testzmotor"]
         self.i = 0
         for self.str_device in self.device_name:
             print('str_device:' + self.str_device)
             self.device[self.i] = vitual_dev.VitualDevice(
                 self.device_name[self.i])
             print('device[]' + str(self.device[self.i]))
             #self.testmotor = pymotor.Motor(vitual_dev.VitualDevice(self.str_device).open_name)
             #self.testmotor.move(10)
             self.i = self.i + 1
     else:
         for self.dev_ind in range(0, self.dev_count):
             if 'Axis 1' in repr(self.friend_name[self.dev_ind]):
                 self.device[0] = pymotor.Motor(
                     self.device_name[self.dev_ind])
             if 'Axis 2' in repr(self.friend_name[self.dev_ind]):
                 self.device[1] = pymotor.Motor(
                     self.device_name[self.dev_ind])
             if 'Axis 3' in repr(self.friend_name[self.dev_ind]):
                 self.device[2] = pymotor.Motor(
                     self.device_name[self.dev_ind])
Example #2
0
    def __init__(self, parent, Title, Device, uiFile):
        super(Axis, self).__init__(parent)

        self.ui = uic.loadUi(uiFile)

        #Declaring Device
        if tctEnable:
            self.axis = pymotor.Motor(Device)

        #Jogging Plus
        self.ui.JogPlus.pressed.connect(self.JogPlus)
        self.ui.JogPlus.released.connect(self.Stop)

        #Jogging Minus
        self.ui.JogMinus.pressed.connect(self.JogMinus)
        self.ui.JogMinus.released.connect(self.Stop)

        #Home
        self.ui.Home.clicked.connect(self.Home)

        #Move
        self.ui.MoveAB.clicked.connect(self.MoveAB)
        self.ui.MoveRE.clicked.connect(self.MoveRE)

        ##Stop
        self.ui.Stop.clicked.connect(self.Stop)

        ##Limits
        self.ui.Limits.clicked.connect(self.Limits)

        #Scroll
        self.ui.Scroll.valueChanged[int].connect(self.UpdateDesiredPosScroll)

        #Updating State - Position
        self.timer = QtCore.QTimer()
        self.timer.start(100)
        self.timer.timeout.connect(self.UpdateState)
        self.timer.timeout.connect(self.CurrentPosition)

        #####################
        # Initializing Widget
        self.UpdateDesiredPos()
        self.ui.setWindowTitle(Title)

        # Var
        self.currentPos = 0
        self.Title = Title
        self.lenght = self.ui.DesirePos.maximum()
Example #3
0
 def InitEmum(self):
     pymotor.enum_device()
     print('\nemum complete!\n')
     self.devenum, self.dev_count = pymotor.enum_device()
     self.device = numpy.empty(5, dtype=object)
     if self.dev_count == 0:
         print("\nNo finding of device.")
         print("\nUse the vitual device:\n")
         self.device_name = ["testxmotor", "testymotor", "testzmotor"]
         self.i = 0
         for self.str_device in self.device_name:
             print('str_device:' + self.str_device)
             self.device[self.i] = vitual_dev.VitualDevice(
                 self.device_name[self.i])
             print('device[]' + str(self.device[self.i]))
             #self.testmotor = pymotor.Motor(vitual_dev.VitualDevice(self.str_device).open_name)
             # self.testmotor.move(10)
             self.i = self.i + 1
     else:
         for self.dev_ind in range(0, self.dev_count):
             self.device[self.dev_count] = pymotor.Motor(
                 pymotor.Motor.get_name(self, self.devenum, self.dev_ind))
Example #4
0
        pm.rpm(600),
        pm.rpm(900),
        pm.rpm(1200),
        pm.rpm(1500),
        pm.rpm(1800),
    ]

    curve_tau = [
        2.5,
        2.2,
        1.3,
        0.9,
        0.7,
        0.6,
        0.5,
    ]

    motor = pm.Motor(curve_hz=curve_hz, curve_tau=curve_tau, j=pm.gcm2(460))
    motor.plot()

    coupler = pm.Coupler(j=pm.gcm2(5))
    gear = pm.Gear(ratio=2, j_in=pm.gcm2(10), j_out=pm.gcm2(15))
    screw = pm.Screw(lead=pm.inch(.05), j=pm.gcm2(20))

    at = pm.AngularTorque(lf,
                          motor=motor,
                          coupler=coupler,
                          gear=gear,
                          drivetrain=screw)
    at.plot()