Exemplo n.º 1
0
        def calculate_and_move_trap(self):
            import math
            import phase_algorithms
            import numpy as np
            import transducer_placment
            global phase_index

            phi_focus = phase_algorithms.phase_find(rt, x, y, z)
            phi = phase_algorithms.add_twin_signature(rt, phi_focus, 90)
            for transducer in range(0, ntrans):
                phase_index[transducer] = int(2500 - phi[transducer] /
                                              ((2 * math.pi) / 1250))
            print(" ")
            print("Moved!")
            print("Phase index is ", phase_index)
            print("New Position: ", "x = "
                  "%.3f" % x, "y = "
                  "%.3f" % y, "z = "
                  "%.3f" % z)  #tester

            from connect import Controller
            with Controller() as ctl:
                ctl.setOutputDACPower(256)
                ctl.setOutputDACDivisor(100)
                for i in range(ctl.outputs):
                    ctl.setOffset(i, phase_index[i])
                ctl.loadOffsets()
Exemplo n.º 2
0
 def turn_on_board_click(self):
     from connect import Controller
     with Controller() as ctl:
         ctl.setOutputDACPower(256)
         ctl.setOutputDACDivisor(100)
         for i in range(ctl.outputs):
             ctl.setOffset(i, phase_index[i])
         ctl.loadOffsets()
Exemplo n.º 3
0
 def calculate_and_move_trap_no_print(self):
     
     from connect import Controller
     with Controller() as ctl:
         ctl.setOutputDACPower(256)
         ctl.setOutputDACDivisor(100)
         for i in range(ctl.outputs):
             ctl.setOffset(i,phase_index[i])
         ctl.setOutputDACFreq(200)
         ctl.loadOffsets()
Exemplo n.º 4
0

choose = input("Please choose haptic as (h) or pattern as (p) or moving as (m) or GUI controled movment as (GUI): ")


## --------------------------- Haptic feedback --------------------------- ##
    
if choose == ("h"):
    print ("Haptic mode selected")
    phase_index = np.zeros((ntrans),dtype=int)
    phi_focus = phase_algorithms.phase_find( rt, 0, 0, 0.08 ) #  (x , y , z) (z = up)
    for transducer in range(0,ntrans):
        phase_index[transducer] = int(2500-phi_focus[transducer]/((2*math.pi)/1250))
        
    from connect import Controller 
    with Controller() as ctl:
        
        while True:          # Turns the pattern off and on as fast as possible
            
            for i in range(ctl.outputs):
                ctl.setOffset(i,phase_index[i])
            ctl.loadOffsets()
    
            for i in range(ctl.outputs):
                ctl.disableOutput(i)
# -------------------------------------------------------------------------- #
    


## -------------------------- Focused traps ------------------------------- ##  
Exemplo n.º 5
0
 def turn_off_board_click(self):
     from connect import Controller
     with Controller() as ctl:
         for i in range(ctl.outputs):
             ctl.disableOutput(i)
         ctl.loadOffsets()