DP-Series Step Motor Controller
The DPSeriesMotorController class implements a base driver class for Anaheim-Automation DP Series stepper motor controllers. There are many controllers sold in this series, all of which implement the same core command set. Some controllers, like the DPY50601, implement additional functionality that is not included in this driver. If these additional features are desired, they should be implemented in a subclass.
- class pymeasure.instruments.anaheimautomation.DPSeriesMotorController(adapter, name='Anaheim Automation Stepper Motor Controller', address=0, encoder_enabled=False, **kwargs)
Bases:
Instrument
Base class to interface with Anaheim Automation DP series stepper motor controllers.
This driver has been tested with the DPY50601 and DPE25601 motor controllers.
- property absolute_position
Float property representing the value of the motor position measured in absolute units. Note that in DP series motor controller instrument manuals, ‘absolute position’ refers to the
step_position
property rather than this property. Also note that use of this property relies onsteps_to_absolute()
andabsolute_to_steps()
being implemented in a subclass. In this way, the user can define the conversion from a motor step position into any desired absolute unit. Absolute units could be the position in meters of a linear stage or the angular position of a gimbal mount, etc. This property can be set.
- absolute_to_steps(pos)
Convert an absolute position to a number of steps to move. This must be implemented in subclasses.
- Parameters
pos – Absolute position in the units determined by the subclassed
absolute_to_steps()
method.
- property address
Integer property representing the address that the motor controller uses for serial communications.
- property basespeed
Integer property that represents the motor controller’s starting/homing speed. This property can be set.
- property busy
Query to see if the controller is currently moving a motor.
- check_errors()
Method to read the error codes register and log when an error is detected.
- Return error_code
one byte with the error codes register contents
- property direction
A string property that represents the direction in which the stepper motor will rotate upon subsequent step commands. This property can be set. ‘CW’ corresponds to clockwise rotation and ‘CCW’ corresponds to counter-clockwise rotation.
- property encoder_autocorrect
A boolean property to enable or disable the encoder auto correct function. This property can be set.
- property encoder_delay
An integer property that represents the wait time in ms. after a move is finished before the encoder is read for a potential encoder auto-correct action to take place. This property can be set.
- property encoder_enabled
A boolean property to represent whether an external encoder is connected and should be used to set the
step_position
property.
- property encoder_motor_ratio
An integer property that represents the ratio of the number of encoder pulses per motor step. This property can be set.
- property encoder_retries
An integer property that represents the number of times the motor controller will try the encoder auto correct function before setting an error flag. This property can be set.
- property encoder_window
An integer property that represents the allowable error in encoder pulses from the desired position before the encoder auto-correct function runs. This property can be set.
- property error_reg
Reads the current value of the error codes register.
- home(home_mode)
Send command to the motor controller to ‘home’ the motor.
- Parameters
home_mode –
0
or1
specifying which homing mode to run.0 will perform a homing operation where the controller moves the motor until a soft limit is reached, then will ramp down to base speed and continue motion until a home limit is reached.
In mode 1, the controller will move the motor until a limit is reached, then will ramp down to base speed, change direction, and run until the limit is released.
- property maxspeed
Integer property that represents the motor controller’s maximum (running) speed. This property can be set.
- move(direction)
Move the stepper motor continuously in the given direction until a stop command is sent or a limit switch is reached. This method corresponds to the ‘slew’ command in the DP series instrument manuals.
- Parameters
direction – value to set on the direction property before moving the motor.
- reset_position()
Reset position as counted by the motor controller and an externally connected encoder to 0.
- property step_position
Integer property representing the value of the motor position measured in steps counted by the motor controller or, if
encoder_enabled
is set, the steps counted by an externally connected encoder. Note that in the DP series motor controller instrument manuals, this property would be referred to as the ‘absolute position’ while this driver implements a conversion between steps and absolute units for theabsolute_position
property. This property can be set.
- steps_to_absolute(steps)
Convert a position measured in steps to an absolute position.
- Parameters
steps – Position in steps to be converted to an absolute position.
- stop()
Method that stops all motion on the motor controller.
- wait_for_completion(interval=0.5)
Block until the controller is not “busy” (i.e. block until the motor is no longer moving.)
- Parameters
interval – (float) seconds between queries to the “busy” flag.
- Returns
None
- write(command)
Override the instrument base write method to add the motor controller’s address to the command string.
- Parameters
command – command string to be sent to the motor controller.