Newport#

class phobos.classes.pupil_mask.Newport(session)[source]#

Bases: object

Class to control the Newport motor (wheel).

Warning

If the command sent to the Newport motor doesn’t work but no error is raised, ensure the Newport knows its home position by running the home_search() method first.

__init__(session)[source]#

Initialize the Newport motor.

Parameters:

session (serial.Serial) – Serial connection to the Newport motor.

Move the motor to the home position.

Returns:

Response from the motor after moving to home position.

Return type:

str

wait() None[source]#

Wait for the motor to reach the target position.

send_command(command)[source]#

Send a command to the motor and return the response.

Parameters:

command (str) – Command to send to the motor.

Returns:

Response from the motor.

Return type:

str

get() float[source]#

Get the current angular position of the motor (in degrees).

Returns:

Current angular position (in degrees) of the motor in degrees.

Return type:

float

move_abs(pos: float) str[source]#

Rotate the motor to an absolute angular position (in degrees).

Parameters:

pos (int) – Target angular position in degrees.

Returns:

Response from the motor after moving to the target position.

Return type:

str

move_rel(pos: int) str[source]#

Rotate the motor by a relative angle.

Parameters:

pos (int) – Angle to rotate in degrees.

Returns:

Response from the motor after moving to the target position.

Return type:

str