Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functions to C library wrapper #23

Merged
merged 11 commits into from
Nov 18, 2023
12 changes: 12 additions & 0 deletions acspy/acsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ def setJerk(hcomm, axis: int, jerk: double, wait=SYNCHRONOUS):
call_acsc(acs.acsc_SetJerk, hcomm, axis, double(jerk), wait)


def setRPosition(hcomm, axis: int, rpos: double, wait=SYNCHRONOUS):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hints for these should be Python types, since we convert to ctypes internally

Suggested change
def setRPosition(hcomm, axis: int, rpos: double, wait=SYNCHRONOUS):
def setRPosition(hcomm, axis: int, rpos: float, wait=SYNCHRONOUS):

"""Asigns a current value of reference position."""
call_acsc(acs.acsc_SetRPosition, hcomm, axis, double(rpos), wait)


def getMotorEnabled(hcomm, axis: int, wait=SYNCHRONOUS):
"""Checks if motor is enabled."""
state = ctypes.c_int()
Expand Down Expand Up @@ -272,6 +277,13 @@ def getAxisState(hcomm, axis: int, wait=SYNCHRONOUS):
return ast


def getFPosition(hcomm, axis:int, wait=SYNCHRONOUS):
"""Retrieves an instant value of the motor feedback position."""
fposition = ctypes.c_double()
call_acsc(acs.acsc_GetFPosition, hcomm, axis, byref(fposition), wait)
fposition = fposition.value
return fposition

def registerEmergencyStop():
"""Register the software emergency stop."""
call_acsc(acs.acsc_RegisterEmergencyStop)
Expand Down