Skip to content

fposbapi_client

fposbapi_client

Thread-safe ASCII TCP socket client for the Festo FPosBAPI server.

The FPosBAPI server runs on the Festo CECC-X PLC (CoDeSys) and listens on TCP port 1234. It speaks a line-oriented ASCII protocol::

1
2
Request:  MSG_ID, COMMAND[, PARAM, ...]\r\n
Response: MSG_ID, COMMAND[, ECHO_PARAMS..., RETURN_VALS...], ERR_ID, ERR_TYPE, ERR_MSG\r\n

On success the last three comma-delimited fields are 0, NULL, SUCCESS. On error the last three fields carry a non-zero error id, type string, and message string.

A single FPosBAPIClient instance should be shared across all FPosBAxis objects belonging to the same gantry, and is owned by Gantry. All send/receive operations are serialised through an internal threading.Lock.

FPosBAPIClientError

Bases: Exception

Raised when the FPosBAPI server returns an error response or the connection is lost.

FPosBAPICommunicationError

Bases: FPosBAPIClientError

Raised when a transport or protocol-level failure occurs (socket, framing, ID mismatch).

FPosBAPICommandError

Bases: FPosBAPIClientError

Raised when the PLC returns a structurally valid but non-SUCCESS response.

FPosBAPIClient

FPosBAPIClient(
    ip: str, port: int = 1234, timeout: float | None = None
)

Thread-safe TCP socket client for the Festo FPosBAPI ASCII protocol.

Connects to the CECC-X PLC on ip:port and wraps the request/response cycle in send_command. A threading.Lock serialises all socket I/O so multiple FPosBAxis objects sharing the same client do not interleave their frames.

Attributes:

Name Type Description
ip

IPv4 address of the CECC-X TCP server.

port

TCP port of the FPosBAPI server (default 1234).

Connect to the FPosBAPI server.

Parameters:

Name Type Description Default
ip str

IPv4 address of the CECC-X PLC.

required
port int

TCP port the FPosBAPI server is listening on. Defaults to 1234.

1234
timeout float | None

Socket timeout in seconds. Applied to both connect and recv operations. None (default) means blocking with no timeout.

None

Raises:

Type Description
OSError

If the TCP connection cannot be established within timeout seconds.

Source code in src/applied_motion/backends/fposbapi_client.py
def __init__(self, ip: str, port: int = 1234, timeout: float | None = None) -> None:
    """Connect to the FPosBAPI server.

    Args:
        ip: IPv4 address of the CECC-X PLC.
        port: TCP port the FPosBAPI server is listening on.  Defaults to
            ``1234``.
        timeout: Socket timeout in seconds.  Applied to both ``connect``
            and ``recv`` operations.  ``None`` (default) means blocking
            with no timeout.

    Raises:
        OSError: If the TCP connection cannot be established within
            *timeout* seconds.
    """
    self.ip = ip
    self.port = port
    self._timeout = timeout
    self._lock = threading.Lock()
    self._msg_id = 0
    self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    self._keepalive_idle = 15_000
    self._keepalive_interval = 5_000
    self._keepalive_count = 10
    logger.info("FPosBAPIClient attempting to connect to %s:%d", ip, port)
    self._connect()
    logger.info("FPosBAPIClient connected to %s:%d", ip, port)

send_command

send_command(
    command: str,
    *params,
    timeout: float | None | _Unset = _UNSET,
) -> list[str]

Send a command to the FPosBAPI server and return all response lines.

Acquires the internal lock, increments the message ID, formats the ASCII request frame, sends it, then reads lines via _collect_response until the terminal (non-ACK) line arrives. The terminal (last) line is validated for correct MSG_ID echo, CMD echo, and SUCCESS status before returning.

Parameters:

Name Type Description Default
command str

FPosBAPI command string, e.g. "ENABLE", "MOVE_AXIS".

required
*params

Zero or more positional parameters appended to the frame.

()
timeout float | None | _Unset

Per-call socket timeout in seconds. Pass None for blocking mode (no timeout), e.g. for long-running motion commands. Omit to use the client's configured defaults.

_UNSET

Returns:

Type Description
list[str]

All response lines received before the empty terminator, in arrival

list[str]

order. The last element is always the terminal status line echoing

list[str]

the command and carrying SUCCESS.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error status, the echoed MSG_ID or command name does not match what was sent, the response is empty, or the connection is closed.

Source code in src/applied_motion/backends/fposbapi_client.py
def send_command(self, command: str, *params, timeout: float | None | _Unset = _UNSET) -> list[str]:
    """Send a command to the FPosBAPI server and return all response lines.

    Acquires the internal lock, increments the message ID, formats the
    ASCII request frame, sends it, then reads lines via
    `_collect_response` until the terminal (non-``ACK``) line
    arrives.  The terminal (last) line is validated for correct MSG_ID
    echo, CMD echo, and ``SUCCESS`` status before returning.

    Args:
        command: FPosBAPI command string, e.g. ``"ENABLE"``, ``"MOVE_AXIS"``.
        *params: Zero or more positional parameters appended to the frame.
        timeout: Per-call socket timeout in seconds.  Pass ``None`` for
            blocking mode (no timeout), e.g. for long-running motion
            commands.  Omit to use the client's configured defaults.

    Returns:
        All response lines received before the empty terminator, in arrival
        order.  The last element is always the terminal status line echoing
        the command and carrying ``SUCCESS``.

    Raises:
        FPosBAPIClientError: If the server returns an error status, the
            echoed MSG_ID or command name does not match what was sent, the
            response is empty, or the connection is closed.
    """
    with self._lock:
        if not isinstance(timeout, _Unset):
            self._sock.settimeout(timeout)
        msg_id = self._next_id()
        raw = self._build_frame(msg_id, command, params)
        logger.debug("FPosBAPIClient tx: %s", raw.strip())
        self._send_frame(raw, command, timeout)
        try:
            lines = self._collect_response()
        finally:
            if not isinstance(timeout, _Unset):
                self._sock.settimeout(self._timeout)
        logger.debug("FPosBAPIClient rx: %s", ", ".join(lines))
        self._validate_terminal(lines, msg_id, command)
    return lines

try_command

try_command(
    command: str,
    *params,
    timeout: float | None | _Unset = _UNSET,
) -> bool

Send a command; raise on communication failure, return bool for PLC result.

Parameters:

Name Type Description Default
command str

FPosBAPI command string, e.g. "HOME", "MOVE_AXIS".

required
*params

Zero or more positional parameters.

()
timeout float | None | _Unset

Per-call socket timeout forwarded to send_command. Pass None for blocking mode on long-running motion commands.

_UNSET

Returns:

Type Description
bool

True when the PLC reports SUCCESS; False when the PLC

bool

returns a valid but non-SUCCESS response.

Raises:

Type Description
FPosBAPICommunicationError

If a transport or protocol-level failure occurs.

Source code in src/applied_motion/backends/fposbapi_client.py
def try_command(self, command: str, *params, timeout: float | None | _Unset = _UNSET) -> bool:
    """Send a command; raise on communication failure, return bool for PLC result.

    Args:
        command: FPosBAPI command string, e.g. ``"HOME"``, ``"MOVE_AXIS"``.
        *params: Zero or more positional parameters.
        timeout: Per-call socket timeout forwarded to [`send_command`][applied_motion.backends.fposbapi_client.FPosBAPIClient.send_command].
            Pass ``None`` for blocking mode on long-running motion commands.

    Returns:
        ``True`` when the PLC reports ``SUCCESS``; ``False`` when the PLC
        returns a valid but non-SUCCESS response.

    Raises:
        FPosBAPICommunicationError: If a transport or protocol-level failure occurs.
    """
    try:
        self.send_command(command, *params, timeout=timeout)
        return True
    except FPosBAPICommandError:
        logger.warning("FPosBAPIClient: command %r rejected by PLC", command)
        return False

get_veab

get_veab() -> int

Get the pressure set value of the VEAB.

Source code in src/applied_motion/backends/fposbapi_client.py
def get_veab(self) -> int:
    """Get the pressure set value of the VEAB."""
    # TODO: This __REALLY__ needs to be contingent on the config and how it is passed in
    # TODO: The ideal would be a PressureControl() class that shares the intantiated gantry and can take it in as input parameter. All of these classes would benefit from that bc of necessary shared socket on CECC-X

    lines = self.send_command("GET_VEAB")
    terminal = lines[-1]
    fields = [f.strip() for f in terminal.split(",")]

    return int(fields[2])

set_veab

set_veab(set_value: int) -> None

Set the pressure value of the VEAB.

Source code in src/applied_motion/backends/fposbapi_client.py
def set_veab(self, set_value: int) -> None:
    """Set the pressure value of the VEAB."""
    self.send_command("SET_VEAB", set_value)

list_commands

list_commands() -> list[str]

Query the server for its supported command set via CMD_LIST.

Sends CMD_LIST and parses the response to extract the command names the connected FPosBAPI server advertises. The set varies between firmware versions, so callers can use this to feature-detect before issuing optional commands (e.g. IS_HOME, SYS_STATUS).

Response layout assumed::

1
MSG_ID, CMD_LIST, CMD_1, CMD_2, ..., CMD_N, ERR_ID, ERR_TYPE, ERR_MSG

The first two fields (MSG_ID and CMD_LIST) and the last three (error fields ending with SUCCESS) are stripped; the remaining fields are returned as a list of command name strings.

Returns:

Type Description
list[str]

List of command name strings advertised by the server,

list[str]

e.g. ["ENABLE", "DISABLE", "HOME", "MOVE_AXIS", ...].

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def list_commands(self) -> list[str]:
    """Query the server for its supported command set via ``CMD_LIST``.

    Sends ``CMD_LIST`` and parses the response to extract the command
    names the connected FPosBAPI server advertises.  The set varies
    between firmware versions, so callers can use this to feature-detect
    before issuing optional commands (e.g. ``IS_HOME``, ``SYS_STATUS``).

    Response layout assumed::

        MSG_ID, CMD_LIST, CMD_1, CMD_2, ..., CMD_N, ERR_ID, ERR_TYPE, ERR_MSG

    The first two fields (``MSG_ID`` and ``CMD_LIST``) and the last
    three (error fields ending with ``SUCCESS``) are stripped; the
    remaining fields are returned as a list of command name strings.

    Returns:
        List of command name strings advertised by the server,
        e.g. ``["ENABLE", "DISABLE", "HOME", "MOVE_AXIS", ...]``.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    lines = self.send_command("CMD_LIST")
    # The server sends one bare command name per intermediate line.
    # lines[0] is the ACK, lines[1:-1] are the bare command names,
    # lines[-1] is the terminal SUCCESS line.
    commands = [line.strip() for line in lines[1:-1] if line.strip()]
    logger.debug("FPosBAPIClient: CMD_LIST returned %d command(s): %s", len(commands), commands)
    return commands

enable

enable() -> None

Enable the gantry drives via ENABLE.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def enable(self) -> None:
    """Enable the gantry drives via ``ENABLE``.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("ENABLE")
    logger.info("FPosBAPIClient: drives enabled")

disable

disable() -> None

Disable the gantry drives via DISABLE.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def disable(self) -> None:
    """Disable the gantry drives via ``DISABLE``.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("DISABLE")
    logger.info("FPosBAPIClient: drives disabled")

home

home() -> None

Home all axes via HOME.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def home(self) -> None:
    """Home all axes via ``HOME``.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("HOME")
    logger.info("FPosBAPIClient: homing complete")

move_pos

move_pos(
    pos_id: int,
    tool_id: int = 0,
    retract_z: int = 0,
    slow_app: int = 0,
) -> None

Execute a motion sequence to a stored position via MOVE_POS.

Parameters:

Name Type Description Default
pos_id int

Position record ID (1-100).

required
tool_id int

Tool index to apply. 0 selects no tool.

0
retract_z int

1 to retract Z before moving, 0 to skip.

0
slow_app int

1 to slow approach the target position, 0 for full speed.

0

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def move_pos(
    self,
    pos_id: int,
    tool_id: int = 0,
    retract_z: int = 0,
    slow_app: int = 0,
) -> None:
    """Execute a motion sequence to a stored position via ``MOVE_POS``.

    Args:
        pos_id: Position record ID (1-100).
        tool_id: Tool index to apply.  ``0`` selects no tool.
        retract_z: ``1`` to retract Z before moving, ``0`` to skip.
        slow_app: ``1`` to slow approach the target position, ``0`` for
            full speed.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("MOVE_POS", pos_id, tool_id, retract_z, slow_app)
    logger.info("FPosBAPIClient: MOVE_POS complete (pos_id=%d, tool_id=%d)", pos_id, tool_id)

move_loc

move_loc(
    a1: float,
    a2: float,
    a3: float,
    tool_id: int = 0,
    move_typ: int = 0,
    retract_z: int = 0,
    slow_app: int = 0,
) -> None

Execute a coordinated 3-axis move to explicit coordinates via MOVE_LOC.

Parameters:

Name Type Description Default
a1 float

Target X-axis position in mm.

required
a2 float

Target Y-axis position in mm.

required
a3 float

Target Z-axis position in mm.

required
tool_id int

Tool offset to apply. 0 selects no tool.

0
move_typ int

0 for absolute, 1 for relative.

0
retract_z int

1 to retract Z before moving, 0 to skip.

0
slow_app int

1 to slow approach the target position, 0 for full speed.

0

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def move_loc(
    self,
    a1: float,
    a2: float,
    a3: float,
    tool_id: int = 0,
    move_typ: int = 0,
    retract_z: int = 0,
    slow_app: int = 0,
) -> None:
    """Execute a coordinated 3-axis move to explicit coordinates via ``MOVE_LOC``.

    Args:
        a1: Target X-axis position in mm.
        a2: Target Y-axis position in mm.
        a3: Target Z-axis position in mm.
        tool_id: Tool offset to apply.  ``0`` selects no tool.
        move_typ: ``0`` for absolute, ``1`` for relative.
        retract_z: ``1`` to retract Z before moving, ``0`` to skip.
        slow_app: ``1`` to slow approach the target position, ``0`` for
            full speed.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("MOVE_LOC", a1, a2, a3, tool_id, move_typ, retract_z, slow_app)
    logger.info("FPosBAPIClient: MOVE_LOC complete (a1=%s, a2=%s, a3=%s mm)", a1, a2, a3)

move_path

move_path() -> None

Execute the programmed motion path via MOVE_PATH.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def move_path(self) -> None:
    """Execute the programmed motion path via ``MOVE_PATH``.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    # TODO: Needs WRITE_PATH?
    self.send_command("MOVE_PATH")
    logger.info("FPosBAPIClient: MOVE_PATH complete")

halt

halt() -> None

Halt the current motion via HALT.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def halt(self) -> None:
    """Halt the current motion via ``HALT``.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("HALT")
    logger.info("FPosBAPIClient: HALT issued")

resume

resume() -> None

Resume a halted motion via RESUME.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def resume(self) -> None:
    """Resume a halted motion via ``RESUME``.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("RESUME")
    logger.info("FPosBAPIClient: RESUME issued")

abort

abort() -> None

Abort the current motion via ABORT.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def abort(self) -> None:
    """Abort the current motion via ``ABORT``.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("ABORT")
    logger.info("FPosBAPIClient: ABORT issued")

reset_err

reset_err() -> None

Reset the active error via RESET_ERR.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def reset_err(self) -> None:
    """Reset the active error via ``RESET_ERR``.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("RESET_ERR")
    logger.info("FPosBAPIClient: error reset")

open_valve

open_valve(
    v1_time: int = 0,
    v2_time: int = 0,
    v3_time: int = 0,
    v4_time: int = 0,
    v5_time: int = 0,
    v6_time: int = 0,
    v7_time: int = 0,
    v8_time: int = 0,
) -> None

Open one or more valves for the specified durations via OPEN_VALVE.

Parameters:

Name Type Description Default
v1_time int

Valve 1 open duration in ms. 0 keeps the valve closed.

0
v2_time int

Valve 2 open duration in ms.

0
v3_time int

Valve 3 open duration in ms.

0
v4_time int

Valve 4 open duration in ms.

0
v5_time int

Valve 5 open duration in ms.

0
v6_time int

Valve 6 open duration in ms.

0
v7_time int

Valve 7 open duration in ms.

0
v8_time int

Valve 8 open duration in ms.

0

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def open_valve(
    self,
    v1_time: int = 0,
    v2_time: int = 0,
    v3_time: int = 0,
    v4_time: int = 0,
    v5_time: int = 0,
    v6_time: int = 0,
    v7_time: int = 0,
    v8_time: int = 0,
) -> None:
    """Open one or more valves for the specified durations via ``OPEN_VALVE``.

    Args:
        v1_time: Valve 1 open duration in ms.  ``0`` keeps the valve closed.
        v2_time: Valve 2 open duration in ms.
        v3_time: Valve 3 open duration in ms.
        v4_time: Valve 4 open duration in ms.
        v5_time: Valve 5 open duration in ms.
        v6_time: Valve 6 open duration in ms.
        v7_time: Valve 7 open duration in ms.
        v8_time: Valve 8 open duration in ms.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command(
        "OPEN_VALVE",
        v1_time,
        v2_time,
        v3_time,
        v4_time,
        v5_time,
        v6_time,
        v7_time,
        v8_time,
    )
    logger.info("FPosBAPIClient: OPEN_VALVE complete")

read_pos

read_pos(pos_id: int) -> tuple[float, float, float]

Read the stored absolute position for pos_id via READ_POS.

Response layout::

1
MSG_ID, READ_POS, POS_ID, ABS_A1, ABS_A2, ABS_A3, 0, NULL, SUCCESS

Parameters:

Name Type Description Default
pos_id int

Position record ID (1-100).

required

Returns:

Type Description
tuple[float, float, float]

Tuple of (abs_a1, abs_a2, abs_a3) in mm.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

RuntimeError

If the response cannot be parsed.

Source code in src/applied_motion/backends/fposbapi_client.py
def read_pos(self, pos_id: int) -> tuple[float, float, float]:
    """Read the stored absolute position for *pos_id* via ``READ_POS``.

    Response layout::

        MSG_ID, READ_POS, POS_ID, ABS_A1, ABS_A2, ABS_A3, 0, NULL, SUCCESS

    Args:
        pos_id: Position record ID (1-100).

    Returns:
        Tuple of ``(abs_a1, abs_a2, abs_a3)`` in mm.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
        RuntimeError: If the response cannot be parsed.
    """
    lines = self.send_command("READ_POS", pos_id)
    fields = [f.strip() for f in lines[-1].split(",")]
    # fields: msg_id, READ_POS, pos_id, abs_a1, abs_a2, abs_a3, 0, NULL, SUCCESS
    try:
        result = float(fields[3]), float(fields[4]), float(fields[5])
    except (IndexError, ValueError) as exc:
        raise RuntimeError(f"Failed to parse READ_POS response for pos_id={pos_id}: {lines!r}") from exc
    logger.debug("FPosBAPIClient: READ_POS pos_id=%d → %s", pos_id, result)
    return result

teach_pos

teach_pos(pos_id: int, tool_id: int = 1) -> None

Save the current axis positions to pos_id via TEACH_POS.

Parameters:

Name Type Description Default
pos_id int

Position record ID to write (1-100).

required
tool_id int

Tool offset to associate with this position.

1

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def teach_pos(self, pos_id: int, tool_id: int = 1) -> None:
    """Save the current axis positions to *pos_id* via ``TEACH_POS``.

    Args:
        pos_id: Position record ID to write (1-100).
        tool_id: Tool offset to associate with this position.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("TEACH_POS", pos_id, tool_id)
    logger.info("FPosBAPIClient: TEACH_POS complete (pos_id=%d)", pos_id)

write_pos

write_pos(
    pos_id: int, abs_a1: float, abs_a2: float, abs_a3: float
) -> None

Write absolute axis coordinates to pos_id via WRITE_POS.

Parameters:

Name Type Description Default
pos_id int

Position record ID to write (1-100).

required
abs_a1 float

Absolute X-axis position in mm.

required
abs_a2 float

Absolute Y-axis position in mm.

required
abs_a3 float

Absolute Z-axis position in mm.

required

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def write_pos(
    self,
    pos_id: int,
    abs_a1: float,
    abs_a2: float,
    abs_a3: float,
) -> None:
    """Write absolute axis coordinates to *pos_id* via ``WRITE_POS``.

    Args:
        pos_id: Position record ID to write (1-100).
        abs_a1: Absolute X-axis position in mm.
        abs_a2: Absolute Y-axis position in mm.
        abs_a3: Absolute Z-axis position in mm.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("WRITE_POS", pos_id, abs_a1, abs_a2, abs_a3)
    logger.info(
        "FPosBAPIClient: WRITE_POS complete (pos_id=%d, a1=%s, a2=%s, a3=%s mm)",
        pos_id,
        abs_a1,
        abs_a2,
        abs_a3,
    )

mod_pos

mod_pos(
    pos_id: int, rel_a1: float, rel_a2: float, rel_a3: float
) -> None

Modify a stored position by relative offsets via MOD_POS.

Parameters:

Name Type Description Default
pos_id int

Position record ID to modify (1-100).

required
rel_a1 float

Relative X-axis offset in mm.

required
rel_a2 float

Relative Y-axis offset in mm.

required
rel_a3 float

Relative Z-axis offset in mm.

required

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def mod_pos(
    self,
    pos_id: int,
    rel_a1: float,
    rel_a2: float,
    rel_a3: float,
) -> None:
    """Modify a stored position by relative offsets via ``MOD_POS``.

    Args:
        pos_id: Position record ID to modify (1-100).
        rel_a1: Relative X-axis offset in mm.
        rel_a2: Relative Y-axis offset in mm.
        rel_a3: Relative Z-axis offset in mm.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("MOD_POS", pos_id, rel_a1, rel_a2, rel_a3)
    logger.info("FPosBAPIClient: MOD_POS complete (pos_id=%d)", pos_id)

write_path

write_path(
    pa_pos_id: int,
    abs_a1: float,
    abs_a2: float,
    abs_a3: float,
) -> None

Write one waypoint along the motion path via WRITE_PATH.

Parameters:

Name Type Description Default
pa_pos_id int

Path position index (1-10).

required
abs_a1 float

Absolute X-axis position in mm.

required
abs_a2 float

Absolute Y-axis position in mm.

required
abs_a3 float

Absolute Z-axis position in mm.

required

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def write_path(
    self,
    pa_pos_id: int,
    abs_a1: float,
    abs_a2: float,
    abs_a3: float,
) -> None:
    """Write one waypoint along the motion path via ``WRITE_PATH``.

    Args:
        pa_pos_id: Path position index (1-10).
        abs_a1: Absolute X-axis position in mm.
        abs_a2: Absolute Y-axis position in mm.
        abs_a3: Absolute Z-axis position in mm.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("WRITE_PATH", pa_pos_id, abs_a1, abs_a2, abs_a3)
    logger.info("FPosBAPIClient: WRITE_PATH complete (pa_pos_id=%d)", pa_pos_id)

read_path

read_path(pa_pos_id: int) -> tuple[float, float, float]

Read one waypoint from the motion path via READ_PATH.

Parameters:

Name Type Description Default
pa_pos_id int

Path position index (1-10).

required

Returns:

Type Description
tuple[float, float, float]

Tuple of (abs_a1, abs_a2, abs_a3) in mm.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

RuntimeError

If the response cannot be parsed.

Source code in src/applied_motion/backends/fposbapi_client.py
def read_path(self, pa_pos_id: int) -> tuple[float, float, float]:
    """Read one waypoint from the motion path via ``READ_PATH``.

    Args:
        pa_pos_id: Path position index (1-10).

    Returns:
        Tuple of ``(abs_a1, abs_a2, abs_a3)`` in mm.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
        RuntimeError: If the response cannot be parsed.
    """
    lines = self.send_command("READ_PATH", pa_pos_id)
    fields = [f.strip() for f in lines[-1].split(",")]
    # fields: msg_id, READ_PATH, pa_pos_id, abs_a1, abs_a2, abs_a3, 0, NULL, SUCCESS
    try:
        result = float(fields[3]), float(fields[4]), float(fields[5])
    except (IndexError, ValueError) as exc:
        raise RuntimeError(f"Failed to parse READ_PATH response for pa_pos_id={pa_pos_id}: {lines!r}") from exc
    logger.debug("FPosBAPIClient: READ_PATH pa_pos_id=%d → %s", pa_pos_id, result)
    return result

sys_status

sys_status() -> str

Return the system status string via SYS_STATUS.

Response layout::

1
MSG_ID, SYS_STATUS, STATUS, 0, NULL, SUCCESS

Returns:

Type Description
str

Status string reported by the PLC (e.g. "IDLE").

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

RuntimeError

If the response cannot be parsed.

Source code in src/applied_motion/backends/fposbapi_client.py
def sys_status(self) -> str:
    """Return the system status string via ``SYS_STATUS``.

    Response layout::

        MSG_ID, SYS_STATUS, STATUS, 0, NULL, SUCCESS

    Returns:
        Status string reported by the PLC (e.g. ``"IDLE"``).

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
        RuntimeError: If the response cannot be parsed.
    """
    lines = self.send_command("SYS_STATUS")
    fields = [f.strip() for f in lines[-1].split(",")]
    # fields: msg_id, SYS_STATUS, status, 0, NULL, SUCCESS
    try:
        status = fields[2]
    except IndexError as exc:
        raise RuntimeError(f"Failed to parse SYS_STATUS response: {lines!r}") from exc
    logger.debug("FPosBAPIClient: SYS_STATUS → %r", status)
    return status

is_error

is_error() -> bool

Return whether the gantry is in an error state via IS_ERROR.

Response layout::

1
MSG_ID, IS_ERROR, FLAG, 0, NULL, SUCCESS

Returns:

Type Description
bool

True if the PLC reports an active error; False otherwise.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

RuntimeError

If the response cannot be parsed.

Source code in src/applied_motion/backends/fposbapi_client.py
def is_error(self) -> bool:
    """Return whether the gantry is in an error state via ``IS_ERROR``.

    Response layout::

        MSG_ID, IS_ERROR, FLAG, 0, NULL, SUCCESS

    Returns:
        ``True`` if the PLC reports an active error; ``False`` otherwise.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
        RuntimeError: If the response cannot be parsed.
    """
    lines = self.send_command("IS_ERROR")
    fields = [f.strip() for f in lines[-1].split(",")]
    # fields: msg_id, IS_ERROR, flag, 0, NULL, SUCCESS
    try:
        result = bool(int(fields[2]))
    except (IndexError, ValueError) as exc:
        raise RuntimeError(f"Failed to parse IS_ERROR response: {lines!r}") from exc
    logger.debug("FPosBAPIClient: IS_ERROR → %s", result)
    return result

fpb_error

fpb_error() -> str

Return the fieldbus error state via FPB_ERROR.

Response layout::

1
MSG_ID, FPB_ERROR, STATUS, 0, NULL, SUCCESS

Returns:

Type Description
str

Raw status string from the terminal response field.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def fpb_error(self) -> str:
    """Return the fieldbus error state via ``FPB_ERROR``.

    Response layout::

        MSG_ID, FPB_ERROR, STATUS, 0, NULL, SUCCESS

    Returns:
        Raw status string from the terminal response field.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    lines = self.send_command("FPB_ERROR")
    fields = [f.strip() for f in lines[-1].split(",")]
    status = fields[2] if len(fields) > 2 else ""
    logger.debug("FPosBAPIClient: FPB_ERROR → %r", status)
    return status

read_err

read_err() -> str

Return the current error description via READ_ERR.

Returns:

Type Description
str

The raw terminal response line from the server.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def read_err(self) -> str:
    """Return the current error description via ``READ_ERR``.

    Returns:
        The raw terminal response line from the server.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    lines = self.send_command("READ_ERR")
    logger.debug("FPosBAPIClient: READ_ERR → %r", lines[-1])
    return lines[-1]

err_log

err_log() -> list[str]

Return the error log entries via ERR_LOG.

The server may return multiple intermediate lines before the terminal SUCCESS line. All non-terminal lines are returned as the log.

Returns:

Type Description
list[str]

List of error log strings (all lines except the terminal status).

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def err_log(self) -> list[str]:
    """Return the error log entries via ``ERR_LOG``.

    The server may return multiple intermediate lines before the terminal
    SUCCESS line.  All non-terminal lines are returned as the log.

    Returns:
        List of error log strings (all lines except the terminal status).

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    lines = self.send_command("ERR_LOG")
    log = lines[:-1]  # strip terminal SUCCESS line
    logger.debug("FPosBAPIClient: ERR_LOG returned %d line(s)", len(log))
    return log

com_log

com_log() -> list[str]

Return the communication log entries via COM_LOG.

The server may return multiple intermediate lines before the terminal SUCCESS line. All non-terminal lines are returned as the log.

Returns:

Type Description
list[str]

List of communication log strings (all lines except the terminal status).

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def com_log(self) -> list[str]:
    """Return the communication log entries via ``COM_LOG``.

    The server may return multiple intermediate lines before the terminal
    SUCCESS line.  All non-terminal lines are returned as the log.

    Returns:
        List of communication log strings (all lines except the terminal status).

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    lines = self.send_command("COM_LOG")
    log = lines[:-1]  # strip terminal SUCCESS line
    logger.debug("FPosBAPIClient: COM_LOG returned %d line(s)", len(log))
    return log

err_desc

err_desc() -> str

Return the error description via ERR_DESC.

Returns:

Type Description
str

Raw terminal response line from the server.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def err_desc(self) -> str:
    """Return the error description via ``ERR_DESC``.

    Returns:
        Raw terminal response line from the server.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    lines = self.send_command("ERR_DESC")
    logger.debug("FPosBAPIClient: ERR_DESC → %r", lines[-1])
    return lines[-1]

get_io

get_io(io_id: int) -> float

Return the value of an I/O channel via GET_IO.

Response layout::

1
MSG_ID, GET_IO, IO_ID, VALUE, 0, NULL, SUCCESS

Parameters:

Name Type Description Default
io_id int

I/O channel ID.

required

Returns:

Type Description
float

Current value of the I/O channel.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

RuntimeError

If the response cannot be parsed.

Source code in src/applied_motion/backends/fposbapi_client.py
def get_io(self, io_id: int) -> float:
    """Return the value of an I/O channel via ``GET_IO``.

    Response layout::

        MSG_ID, GET_IO, IO_ID, VALUE, 0, NULL, SUCCESS

    Args:
        io_id: I/O channel ID.

    Returns:
        Current value of the I/O channel.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
        RuntimeError: If the response cannot be parsed.
    """
    lines = self.send_command("GET_IO", io_id)
    fields = [f.strip() for f in lines[-1].split(",")]
    # fields: msg_id, GET_IO, io_id, value, 0, NULL, SUCCESS
    try:
        value = float(fields[3])
    except (IndexError, ValueError) as exc:
        raise RuntimeError(f"Failed to parse GET_IO response for io_id={io_id}: {lines!r}") from exc
    logger.debug("FPosBAPIClient: GET_IO io_id=%d → %s", io_id, value)
    return value

set_io

set_io(io_id: int, value: float) -> None

Set the value of an I/O channel via SET_IO.

Parameters:

Name Type Description Default
io_id int

I/O channel ID.

required
value float

Value to write to the I/O channel.

required

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def set_io(self, io_id: int, value: float) -> None:
    """Set the value of an I/O channel via ``SET_IO``.

    Args:
        io_id: I/O channel ID.
        value: Value to write to the I/O channel.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("SET_IO", io_id, value)
    logger.info("FPosBAPIClient: SET_IO io_id=%d value=%s", io_id, value)

get_par

get_par(par_id: int) -> list[float]

Return parameter values for par_id via GET_PAR.

The FPosBAPI server returns up to four value fields per parameter (e.g. tray parameters include column count, column offset, row count, and row offset). Fields that are absent or non-numeric are omitted from the returned list.

Response layout::

1
MSG_ID, GET_PAR, PAR_ID, VALUE, VALUE, VALUE, VALUE, 0, NULL, SUCCESS

Parameters:

Name Type Description Default
par_id int

Parameter ID (see API Rev 5 Parameter ID sheet).

required

Returns:

Type Description
list[float]

List of up to four float values for the requested parameter.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def get_par(self, par_id: int) -> list[float]:
    """Return parameter values for *par_id* via ``GET_PAR``.

    The FPosBAPI server returns up to four value fields per parameter
    (e.g. tray parameters include column count, column offset, row count,
    and row offset).  Fields that are absent or non-numeric are omitted
    from the returned list.

    Response layout::

        MSG_ID, GET_PAR, PAR_ID, VALUE, VALUE, VALUE, VALUE, 0, NULL, SUCCESS

    Args:
        par_id: Parameter ID (see API Rev 5 Parameter ID sheet).

    Returns:
        List of up to four float values for the requested parameter.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    lines = self.send_command("GET_PAR", par_id)
    fields = [f.strip() for f in lines[-1].split(",")]
    # fields: msg_id, GET_PAR, par_id, v1, v2, v3, v4, 0, NULL, SUCCESS
    # Value fields are at indices 3-6; trailing error triplet at -3 to -1.
    value_fields = fields[3:-3]
    values: list[float] = []
    for f in value_fields:
        try:
            values.append(float(f))
        except ValueError:
            break
    logger.debug("FPosBAPIClient: GET_PAR par_id=%d → %s", par_id, values)
    return values

set_par

set_par(par_id: int, *values: float) -> None

Write one or more values to parameter par_id via SET_PAR.

Parameters:

Name Type Description Default
par_id int

Parameter ID (see API Rev 5 Parameter ID sheet).

required
*values float

Up to four values to write to the parameter.

()

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def set_par(self, par_id: int, *values: float) -> None:
    """Write one or more values to parameter *par_id* via ``SET_PAR``.

    Args:
        par_id: Parameter ID (see API Rev 5 Parameter ID sheet).
        *values: Up to four values to write to the parameter.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("SET_PAR", par_id, *values)
    logger.info("FPosBAPIClient: SET_PAR par_id=%d values=%s", par_id, values)

teach_tray

teach_tray(
    tray_id: int, tray_pos: int, tool_id: int = 0
) -> None

Save the current axis positions as a tray position via TEACH_TRAY.

Parameters:

Name Type Description Default
tray_id int

Tray ID (1-20).

required
tray_pos int

Position within the tray to teach.

required
tool_id int

Tool offset to associate with this position.

0

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def teach_tray(self, tray_id: int, tray_pos: int, tool_id: int = 0) -> None:
    """Save the current axis positions as a tray position via ``TEACH_TRAY``.

    Args:
        tray_id: Tray ID (1-20).
        tray_pos: Position within the tray to teach.
        tool_id: Tool offset to associate with this position.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("TEACH_TRAY", tray_id, tray_pos, tool_id)
    logger.info("FPosBAPIClient: TEACH_TRAY complete (tray_id=%d, tray_pos=%d)", tray_id, tray_pos)

write_tray

write_tray(
    tray_id: int,
    tray_pos: int,
    abs_a1: float,
    abs_a2: float,
    abs_a3: float,
) -> None

Write absolute coordinates to a tray position via WRITE_TRAY.

Parameters:

Name Type Description Default
tray_id int

Tray ID (1-20).

required
tray_pos int

Position index within the tray.

required
abs_a1 float

Absolute X-axis position in mm.

required
abs_a2 float

Absolute Y-axis position in mm.

required
abs_a3 float

Absolute Z-axis position in mm.

required

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def write_tray(
    self,
    tray_id: int,
    tray_pos: int,
    abs_a1: float,
    abs_a2: float,
    abs_a3: float,
) -> None:
    """Write absolute coordinates to a tray position via ``WRITE_TRAY``.

    Args:
        tray_id: Tray ID (1-20).
        tray_pos: Position index within the tray.
        abs_a1: Absolute X-axis position in mm.
        abs_a2: Absolute Y-axis position in mm.
        abs_a3: Absolute Z-axis position in mm.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("WRITE_TRAY", tray_id, tray_pos, abs_a1, abs_a2, abs_a3)
    logger.info("FPosBAPIClient: WRITE_TRAY complete (tray_id=%d, tray_pos=%d)", tray_id, tray_pos)

read_tray

read_tray(
    tray_id: int, tray_pos: int
) -> tuple[float, float, float]

Read the stored coordinates of a tray position via READ_TRAY.

Response layout::

1
MSG_ID, READ_TRAY, TRAY_ID, TRAY_POS, ABS_A1, ABS_A2, ABS_A3, 0, NULL, SUCCESS

Parameters:

Name Type Description Default
tray_id int

Tray ID (1-20).

required
tray_pos int

Position index within the tray.

required

Returns:

Type Description
tuple[float, float, float]

Tuple of (abs_a1, abs_a2, abs_a3) in mm.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

RuntimeError

If the response cannot be parsed.

Source code in src/applied_motion/backends/fposbapi_client.py
def read_tray(self, tray_id: int, tray_pos: int) -> tuple[float, float, float]:
    """Read the stored coordinates of a tray position via ``READ_TRAY``.

    Response layout::

        MSG_ID, READ_TRAY, TRAY_ID, TRAY_POS, ABS_A1, ABS_A2, ABS_A3, 0, NULL, SUCCESS

    Args:
        tray_id: Tray ID (1-20).
        tray_pos: Position index within the tray.

    Returns:
        Tuple of ``(abs_a1, abs_a2, abs_a3)`` in mm.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
        RuntimeError: If the response cannot be parsed.
    """
    lines = self.send_command("READ_TRAY", tray_id, tray_pos)
    fields = [f.strip() for f in lines[-1].split(",")]
    # fields: msg_id, READ_TRAY, tray_id, tray_pos, abs_a1, abs_a2, abs_a3, 0, NULL, SUCCESS
    try:
        result = float(fields[4]), float(fields[5]), float(fields[6])
    except (IndexError, ValueError) as exc:
        raise RuntimeError(
            f"Failed to parse READ_TRAY response for tray_id={tray_id}, tray_pos={tray_pos}: {lines!r}"
        ) from exc
    logger.debug("FPosBAPIClient: READ_TRAY tray_id=%d tray_pos=%d → %s", tray_id, tray_pos, result)
    return result

mod_tray

mod_tray(
    tray_id: int,
    tray_pos: int,
    rel_a1: float,
    rel_a2: float,
    rel_a3: float,
) -> None

Modify a stored tray position by relative offsets via MOD_TRAY.

Parameters:

Name Type Description Default
tray_id int

Tray ID (1-20).

required
tray_pos int

Position index within the tray.

required
rel_a1 float

Relative X-axis offset in mm.

required
rel_a2 float

Relative Y-axis offset in mm.

required
rel_a3 float

Relative Z-axis offset in mm.

required

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def mod_tray(
    self,
    tray_id: int,
    tray_pos: int,
    rel_a1: float,
    rel_a2: float,
    rel_a3: float,
) -> None:
    """Modify a stored tray position by relative offsets via ``MOD_TRAY``.

    Args:
        tray_id: Tray ID (1-20).
        tray_pos: Position index within the tray.
        rel_a1: Relative X-axis offset in mm.
        rel_a2: Relative Y-axis offset in mm.
        rel_a3: Relative Z-axis offset in mm.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("MOD_TRAY", tray_id, tray_pos, rel_a1, rel_a2, rel_a3)
    logger.info("FPosBAPIClient: MOD_TRAY complete (tray_id=%d, tray_pos=%d)", tray_id, tray_pos)

move_tray

move_tray(
    tray_id: int,
    tray_col: int,
    tray_row: int,
    tool_id: int = 0,
    retract_z: int = 0,
    slow_app: int = 0,
) -> None

Move the gantry to a tray location via MOVE_TRAY.

Parameters:

Name Type Description Default
tray_id int

Tray ID (1-20).

required
tray_col int

Target column within the tray.

required
tray_row int

Target row within the tray.

required
tool_id int

Tool offset to apply. 0 selects no tool.

0
retract_z int

1 to retract Z before moving, 0 to skip.

0
slow_app int

1 to slow approach the target position, 0 for full speed.

0

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def move_tray(
    self,
    tray_id: int,
    tray_col: int,
    tray_row: int,
    tool_id: int = 0,
    retract_z: int = 0,
    slow_app: int = 0,
) -> None:
    """Move the gantry to a tray location via ``MOVE_TRAY``.

    Args:
        tray_id: Tray ID (1-20).
        tray_col: Target column within the tray.
        tray_row: Target row within the tray.
        tool_id: Tool offset to apply.  ``0`` selects no tool.
        retract_z: ``1`` to retract Z before moving, ``0`` to skip.
        slow_app: ``1`` to slow approach the target position, ``0`` for
            full speed.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("MOVE_TRAY", tray_id, tray_col, tray_row, tool_id, retract_z, slow_app)
    logger.info(
        "FPosBAPIClient: MOVE_TRAY complete (tray_id=%d, col=%d, row=%d)",
        tray_id,
        tray_col,
        tray_row,
    )

init_sys

init_sys() -> None

Initialize system parameters via INIT_SYS.

Raises:

Type Description
FPosBAPIClientError

If the server returns an error response or the connection is lost.

Source code in src/applied_motion/backends/fposbapi_client.py
def init_sys(self) -> None:
    """Initialize system parameters via ``INIT_SYS``.

    Raises:
        FPosBAPIClientError: If the server returns an error response or
            the connection is lost.
    """
    self.send_command("INIT_SYS")
    logger.info("FPosBAPIClient: system initialized")

close

close() -> None

Close the underlying TCP socket.

Safe to call more than once; subsequent calls are no-ops because the OS will already have released the socket descriptor.

Source code in src/applied_motion/backends/fposbapi_client.py
def close(self) -> None:
    """Close the underlying TCP socket.

    Safe to call more than once; subsequent calls are no-ops because the
    OS will already have released the socket descriptor.
    """
    self._sock.close()
    logger.info("FPosBAPIClient disconnected from %s:%d", self.ip, self.port)