コード例 #1
0
 def move_motor (self, value):
     
     if (float (value) <= 265) & (float (value) >= 0):
         self.lineEdit.setText(value)
         self.value = convert (float(value), True)
         print ('moving to ', self.value)
         self.command = move_abs + (self.value).to_bytes(4, byteorder='big',signed=True)        
         send_motor.send_command(com_port_name, self.command)
コード例 #2
0
 def roll_motor (self, value):
     
     if (float (value) >= 0):
         print ('rolling right ', value)
         self.command = roll_right+roll_speed.to_bytes(4, byteorder='big',signed=True)        
         send_motor.send_command(com_port_name, self.command)
     else:
         print ('rolling left ', value)
         self.command = roll_left+roll_speed.to_bytes(4, byteorder='big',signed=True)         
         send_motor.send_command(com_port_name, self.command)
コード例 #3
0
 def shift_motor(self, flag, value):
     
     self.shift=float(value)
     if (self.shift <= 50) & (self.shift >= 0):
         if flag == -1:
             self.shift = (-1)*self.shift
         self.new_value = float(self.lineEdit_2.text())+self.shift
         self.lineEdit.setText(str(self.new_value))
         print (self.new_value)
         self.shift_steps = convert (self.new_value, True)
         print (self.shift_steps)
         self.command = move_abs + (self.shift_steps).to_bytes(4, byteorder='big',signed=True)
         send_motor.send_command(com_port_name, self.command)
コード例 #4
0
 def update_position (self):
     
     self.check = get_pos
     try:
         self.position = int (send_motor.send_command(com_port_name, self.check)) # in microsteps
         self.position_mm = convert(self.position, False)
         self.new_value_trigger.emit(self.position_mm)
     except:
         print ('can not get the position')
         pass
コード例 #5
0
 def stop_motor(self):
     
     self.command = motor_stop                                            # construct command
     send_motor.send_command(com_port_name, self.command)                   # senf command