-
Notifications
You must be signed in to change notification settings - Fork 0
Initialization functions
__init__(self, serialPort:str, moduleDebugLevel:bool=False, communicationDebugLevel:bool=False, logFiles:bool=True)
Class initialization
This class is used for interacting with the Theia MCR motor control boards.
Initialize the MCR board (this class) before any commands can be sent. Motor initialization (focusInit, zoomInit, irisInit) must be called separately for each motor. The controllerClass subclass is automatically initialized creating a MCRBoard = MCRControl.controllerClass instance.
Successful initialization is confirmed by receiving the board firmware version from the board. This can be checked with the MCRControl.MCRInitialized variable.
This is the top level class for all interactions with the MCR600 series boards
input
- serial_port: the serial port name of the board (e.g. "com21" or "/dev/ttyAMA0").
- moduleDebugLevel (optional boolean: False): Set true to set the level to DEBUG for the console stream instead of the default of INFO
- communicationDebugLevel (optional boolean: False): Set true to print the serial port communication to the console (and all debug level logs). This is not recommended for production use.
- logFiles (optional boolean: True): Set true to create log files for the MCR board. The log files will be created in the user directory.
class variables
- MCRInitialized: set when the board is successfully initialized (not the motors)
Sub-classes
- motor
- controllerClass
Motors must be initialized. Initializing the focus motor will create a MCRControl.focus instance which has movement and other commands such as MCRControl.focus.moveAbs(). See motor movements for more information.
focusInit(self, steps:int, pi:int, move:bool=True, accel:int=0) -> bool
Initialize the parameters of the motor. This must be called after the board is initialized.
input
- steps: maximum number of steps
- pi: photo interrupter limit switch (pi) location in step number
- move: (optional, True) move motor to home position or (False) initialize without moving.
- accel: (optional, 0) motor acceleration steps (check motor control documentation to see if this variable is supported in firmware)
return [True | False] motor initialization successful
zoomInit(self, steps:int, pi:int, move:bool=True, accel:int=0) -> bool
Initialize the parameters of the motor. This must be called after the board is initialized.
input
- steps: maximum number of steps
- pi: pi location in step number
- move: (optional, True) move motor to home position or (False) initialize without moving.
- accel: (optional, 0) motor acceleration steps (check motor control documentation to see if this variable is supported in firmware)
return [True | False] motor initialization successful
irisInit(self, steps:int, move:bool=True) -> bool
Initialize the parameters of the motor. This must be called after the board is initialized.
input
- steps: maximum number of steps
- move: (optional, True) move motor to home position or (False) initialize without moving.
return [True | False] motor initialization successful
IRCInit(self) -> bool
Initialize the parameters of the IRC motor.
For the IRC switch motor: maximum 1000 steps allows 1 second activation time (at speed 1000pps). The activation
time is set by the number of steps (1 step = 1 ms). See the motor control documentation for more info.
return [True | False] motor initialization successful
The communication path can be changed from USB to I2C or UART communication. For the electrical wire connection, both these paths go through the J2 connector. See the driver instructions in the "specifications and instructions" folder at Theia's shared Dropbox folder (TheiaTech.com/mcr).
First communication with the board should be done using the USB cable. The setCommunicationPath() command can be sent to change the communication path after board initialization is completed.
import TheiaMCR as mcr
import time
comport = 'com4'
# create the motor control board instance
MCR = mcr.MCRControl(comport)
# New path ('USB' | 1, 'UART' | 2, 'I2C' | 0)
MCR.MCRBoard.setCommunicationPath('USB')
# Wait >700ms for reboot
time.sleep(1)
input
- path: new communication path to set as string or integer ('USB' | 1, 'UART' | 2, 'I2C' | 0)
return [success] If the new path was successfully set, the board will reboot (allow >700ms before sending new commands). Commands will not be available on the previous (USB) communication path.