OpenScan-org / OpenScan2

an improved firmware for the OpenScan devices, featuring many more cameras and a greatly improved overall usability
GNU General Public License v3.0
241 stars 27 forks source link

Feature Request: Add support for a new kinematic system (corexy but for polar coordinates) #64

Closed OpenScanEu closed 1 year ago

OpenScanEu commented 1 year ago

How to run the following build with the OpenScan firmware image

OpenScanEu commented 1 year ago

Since both motors are running at the same time, the motor parameters have to be the same for the turntable/rotor. Please adjust the settings as shown: image

Running the motors can be achieved relatively easily with the following code snipped:

from OpenScan import motorrun as motorrun2, load_int
from time import sleep, time
import threading

def turntable():
    motorrun2('tt',angle_tt)

def rotor():
   motorrun2('rotor',angle_rotor)

def motorrun(motor,angle):
    global angle_rotor
    global angle_tt
    if motor == 'tt':
        angle_tt = int(angle*8.7)
        angle_rotor = int(angle*8.7)
    elif motor == 'rotor':
        angle_tt = angle
        angle_rotor = -angle

    t1 = threading.Thread(target=turntable)
    t2 = threading.Thread(target=rotor)
    t1.start()
    t2.start()
    while t1.is_alive() or t2.is_alive():
        sleep(0.01)

#motorrun('rotor',angle)
#motorrun('tt',angle)

When you want to use the full capabilities of the OpenScan firmware (calculate positions, trigger camera ...) you will have to modify the source code of the following five nodes (open the editor via http://openscan/editor): image

You can simply insert the above code into the top of each node, which should look something like this (for the "routine" node) image