Motor

pycertifspec.Motor #

[view_source]

Motor Objects #

class Motor(object)

[view_source]

SPEC motor

position #

[view_source]

Get the motor position in user units (setting a value will NOT move the motor but change the position offset)

dial_position #

[view_source]

Get motor position in dial units (setting a value will NOT move the motor)

offset #

[view_source]

The current user offset in dial units

step_size #

[view_source]

Steps-per-unit (read-only)

sign #

[view_source]

Sign of user dial parameter (read-only)

move_done #

[view_source]

True if done, False if busy (read-only). WARNING: The original value from SPEC is inverted

high_lim_hit #

[view_source]

nonzero if the high-limit switch has been hit (read-only)

low_lim_hit #

[view_source]

nonzero if the low-limit switch has been hit (read-only)

emergency_stop #

[view_source]

nonzero if an emergency-stop switch or condition has been activated (read-only)

motor_fault #

[view_source]

Returns nonzero if a motor-fault condition has been activated (read-only)

high_limit #

[view_source]

the high limit in dial units

low_limit #

[view_source]

the low limit in dial units

unusable #

[view_source]

Returns nonzero if the motor is unusable (read-only)

base_rate #

[view_source]

base_rate

slew_rate #

[view_source]

slew_rate

acceleration #

[view_source]

acceleration

backlash #

[view_source]

backlash

get #

 | get(prop_name: str) -> SpecMessage

[view_source]

Get a motor property.

Attributes:

  • prop_name string - 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)

[view_source]

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_name string - The name of the property
  • value - The value (will be converted to string before sending)
  • wait_for_error float - 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)

[view_source]

Move motor to position

Arguments:

  • value float - The position to move to
  • blocking boolean - Wait for move to finish before returning
  • callback Callable - If blocking=False, this function will be called on completion

move #

 | move(value: float, blocking: bool = True, callback: Callable = None)

[view_source]

Move motor relative to current position

Arguments:

  • value float - The distance to move
  • blocking boolean - Wait for move to finish before returning
  • callback Callable - If blocking=False, this function will be called on completion

subscribe #

 | subscribe(prop: str, callback: Callable, nowait: bool = False, timeout: float = 1.0) -> bool

[view_source]

Subscribe to changes in a motor property.

Arguments:

  • prop string - The property to listen to
  • callback function - The function to be called when the event is received
  • nowait boolean - By default the function waits for the first event after registering to see if an error occurred. To skip that set True
  • timeout float - 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

[view_source]

Unsubscribe from changes.

Arguments:

  • prop string - The property to stop listening to
  • callback Callable - The callback function

Returns:

  • (boolean) - True if the callback was removed, False if it didn’t exist anyways