devices.nanotec:NanotecPD4
Nanotec PD4 stepper motor with integrated controller.
Usage
devices.nanotec:NanotecPD4(
interface,
steps_per_deg=1,
zero_offset=-150,
steps_lower_limit=-150,
steps_upper_limit=-21900,
pos_mode="abs",
status_enable=False,
**kwargs,
)Methods
| Name | Description |
|---|---|
| __init__() | Initialize the Nanotec PD4 controller. |
| getCurrentRecordParams() | Readout the current record write parameter set in dictionary. |
| getErrorStatus() | Read if the motor has a position error. |
| getLastReferenceTime() | Get the time of the last reference run in local time. |
| getMovingStatus() | Read if the motor is still moving. |
| getPosDeg() | Get current position in degrees. |
| getPosMode() | Get active positioning mode. |
| getRotDir() | Get the rotation direction. |
| id() | Get the device identifier. |
| move() | Halbach function to move the motor. |
| moveClip() | Move the motor with position clipping. |
| moveClipWait() | Move the motor with position clipping and wait for completion. |
| moveWait() | Halbach function to move the motor and wait for completion. |
| readInitSpeed() | Read the current minimum step frequency. |
| readMoves() | Read the current position in steps. |
| referenceRun() | Perform a reference run and set positioning mode to absolute. |
| resetMoves() | Reset the position of the motor to 0. |
| resetPosError() | Reset the position error. |
| setPosMode() | Set the positioning mode to either relative or absolute. |
| setPosition() | Set the position to a given number of steps. |
| setRotDir() | Set the rotation direction based on the sign of direction. |
| setRotDirBin() | Set the rotation direction using binary values. |
| startRecord() | Start the active record / start the motor. |
| stopRecord() | Stop the motor. |
__init__()
Initialize the Nanotec PD4 controller.
Usage
__init__(
interface,
steps_per_deg=1,
zero_offset=-150,
steps_lower_limit=-150,
steps_upper_limit=-21900,
pos_mode="abs",
status_enable=False,
**kwargs,
)Parameters
interface: str-
Communication interface identifier
steps_per_deg: int = 1-
Steps per degree of rotation, by default 1
zero_offset: int = -150-
Internal zero offset in steps, by default -150
steps_lower_limit: int = -150-
Lower limit in steps, defined as the smallest distance to the reference point, by default -150
steps_upper_limit: int = -21900-
Upper limit in steps, defined as the greatest distance to the reference point, by default -21900
pos_mode: str = "abs"-
Initial positioning mode, either “abs” or “rel”, by default “abs”
status_enable: bool = False-
Enable status responses, by default False
**kwargs- Additional arguments passed to VisaDevice
getCurrentRecordParams()
Readout the current record write parameter set in dictionary.
Usage
getCurrentRecordParams(param)Parameters
param: str-
Parameter to retrieve, options include:
- p: Position mode
- s: Travel distance
- u: Initial step frequency
- o: Maximum step frequency
- n: Second maximum step frequency
- b: Acceleration and braking ramp
- d: Direction of rotation
- t: Reversal in direction of rotation for repeat records
- w: Repetitions
- P: Pause between repetitions and continuation records
- N: Record number of continuation record
Returns
int- Value of the requested parameter
getErrorStatus()
Read if the motor has a position error.
Usage
getErrorStatus()Returns
bool- True if there is a position error, False otherwise
getLastReferenceTime()
Get the time of the last reference run in local time.
Usage
getLastReferenceTime()Returns
str- Time of run formatted as “YYYY-MM-DD hh:mm:ss”
getMovingStatus()
Read if the motor is still moving.
Usage
getMovingStatus()Returns
bool- True if the motor is moving, False otherwise
getPosDeg()
Get current position in degrees.
Usage
getPosDeg()Returns
float- Current position in degrees
getPosMode()
Get active positioning mode.
Usage
getPosMode()Returns
str- Positioning mode (“rel”, “abs”, or “error”)
getRotDir()
Get the rotation direction.
Usage
getRotDir()Returns
int- Rotation direction (0: Left, 1: Right)
id()
Get the device identifier.
Usage
id()Returns
str- Device identifier string
move()
Halbach function to move the motor.
Usage
move(
moves,
position,
speed,
)Moves the motor by a given amount of steps (rel) or to a given position (abs) depending on the current positioning mode. In relative positioning mode, moves has to be a positive integer.
Parameters
moves: int-
Number of steps to move or target position (positive in rel pos mode)
position: int-
Current position
speed: float- Movement speed
Returns
None
moveClip()
Move the motor with position clipping.
Usage
moveClip(
pos,
unit,
)Move the motor by a given distance (rel) or to a given position (abs) in the specified unit, depending on active positioning mode. Suitable for absolute and relative movement as well as degrees (if calibrated) or steps.
Parameters
pos: float-
Position or distance to move
unit: str- Unit of position (“deg” or “steps”)
Returns
None
moveClipWait()
Move the motor with position clipping and wait for completion.
Usage
moveClipWait(
posDeg,
unit,
)Move the motor by a given distance (rel) or to a given position (abs) in the specified unit, depending on active positioning mode. Wait for move to finish. Suitable for absolute and relative movement as well as degrees (if calibrated) or steps.
Parameters
posDeg: float-
Position or distance to move
unit: str- Unit of position (“deg” or “steps”)
Returns
None
moveWait()
Halbach function to move the motor and wait for completion.
Usage
moveWait(
moves,
position,
speed,
)Parameters
moves: int-
Number of steps to move or target position
position: int-
Current position
speed: float- Movement speed
Returns
None
readInitSpeed()
Read the current minimum step frequency.
Usage
readInitSpeed()Returns
int- Minimum step frequency in steps/s
readMoves()
Read the current position in steps.
Usage
readMoves()Returns
int- Current position in steps
referenceRun()
Perform a reference run and set positioning mode to absolute.
Usage
referenceRun(wait=600000.0)Recommended to use when the position of the magnet isn’t defined.
Parameters
wait: float = 600000.0- Timeout value for the reference run in milliseconds, by default 600e3
Returns
None
resetMoves()
Reset the position of the motor to 0.
Usage
resetMoves()Returns
None
resetPosError()
Reset the position error.
Usage
resetPosError()Useful when running into limits.
Returns
None
setPosMode()
Set the positioning mode to either relative or absolute.
Usage
setPosMode(mode)Parameters
mode: str- Positioning mode (“rel” or “abs”)
Returns
None
setPosition()
Set the position to a given number of steps.
Usage
setPosition(moves)Parameters
moves: int- Number of steps to set as the position
Returns
None
setRotDir()
Set the rotation direction based on the sign of direction.
Usage
setRotDir(direction)Parameters
direction: int- Direction value (-1 -> 0 -> Left; 1 -> 1 -> Right)
Returns
None
setRotDirBin()
Set the rotation direction using binary values.
Usage
setRotDirBin(direction)Parameters
direction: int- Direction value (0 -> Left; 1 -> Right)
Returns
None
startRecord()
Start the active record / start the motor.
Usage
startRecord()Returns
None
stopRecord()
Stop the motor.
Usage
stopRecord()Returns
None