Skip to content

Initialization functions

cliquot22 edited this page Jan 31, 2024 · 19 revisions

Class initialization

__init__(self, com:str)

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 = Class.controllerClass instance.
Successful initialization is confirmed by receiving the board firmware version from the board.

This is the top level class for all interactions with the MCR600 series boards

input

  • com: the com port name of the board (e.g. "com21"). The com port name is formatted for Windows.

class variables

  • MCRInitialized: set when the board is successfully initialized (not the motors)

Sub-classes

  • motor
  • board

Motor initialization

Motors must be initialized. Initializing the focus motor will create a Class.focus instance which has movement and other commands such as Class.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

Board communication

The communication path can be changed 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.

Clone this wiki locally