pycertifspec.Motor #
Motor Objects #
class Motor(object)
SPEC motor
position #
Get the motor position in user units (setting a value will NOT move the motor but change the position offset)
dial_position #
Get motor position in dial units (setting a value will NOT move the motor)
offset #
The current user offset in dial units
step_size #
Steps-per-unit (read-only)
sign #
Sign of user dial parameter (read-only)
move_done #
True if done, False if busy (read-only). WARNING: The original value from SPEC is inverted
high_lim_hit #
nonzero if the high-limit switch has been hit (read-only)
low_lim_hit #
nonzero if the low-limit switch has been hit (read-only)
emergency_stop #
nonzero if an emergency-stop switch or condition has been activated (read-only)
motor_fault #
Returns nonzero if a motor-fault condition has been activated (read-only)
high_limit #
the high limit in dial units
low_limit #
the low limit in dial units
unusable #
Returns nonzero if the motor is unusable (read-only)
base_rate #
base_rate
slew_rate #
slew_rate
acceleration #
acceleration
backlash #
backlash
get #
| get(prop_name: str) -> SpecMessage
Get a motor property.
Attributes:
prop_namestring - The name of the property
Returns:
(SpecMessage)- None if property doesn’t exist
set #
| set(prop_name: str, value: Any, wait_for_error: float = 0)
Set a motor property.
You shouldn’t really have to use this method since most properties automatically broadcast changes to SPEC when modified
Attributes:
prop_namestring - The name of the propertyvalue- The value (will be converted to string before sending)wait_for_errorfloat - SPEC only sends a message back if the property doesn’t exist. Set the number of seconds to wait for an error message (if there is one)
Returns:
False if property doesn’t exist, else True
moveto #
| moveto(value: float, blocking: bool = True, callback: Callable = None)
Move motor to position
Arguments:
valuefloat - The position to move toblockingboolean - Wait for move to finish before returningcallbackCallable - If blocking=False, this function will be called on completion
move #
| move(value: float, blocking: bool = True, callback: Callable = None)
Move motor relative to current position
Arguments:
valuefloat - The distance to moveblockingboolean - Wait for move to finish before returningcallbackCallable - If blocking=False, this function will be called on completion
subscribe #
| subscribe(prop: str, callback: Callable, nowait: bool = False, timeout: float = 1.0) -> bool
Subscribe to changes in a motor property.
Arguments:
propstring - The property to listen tocallbackfunction - The function to be called when the event is receivednowaitboolean - By default the function waits for the first event after registering to see if an error occurred. To skip that set Truetimeoutfloat - The timeout to wait for a response after subscribing. Function returns False when it runs out
Returns:
True if successful, False when an error occurred or timeout reached
unsubscribe #
| unsubscribe(prop: str, callback: Callable) -> bool
Unsubscribe from changes.
Arguments:
propstring - The property to stop listening tocallbackCallable - The callback function
Returns:
(boolean)- True if the callback was removed, False if it didn’t exist anyways