fposbapi_axis
fposbapi_axis
FPosBAPI axis proxy — represents one axis of a CECC-X controlled gantry.
FPosBAxis delegates all motion commands through a shared
FPosBAPIClient socket connection
to the CECC-X PLC. It satisfies the
Axis structural interface
and can be used anywhere a EdconAxis is accepted
by Gantry.
Axis index convention (matches CECC-X CoDeSys program default):
1— X axis2— Y axis3— Z axis
ROB_POS response field layout assumed by FPosBAxis.get_current_axis_position::
1 | |
Position at field index axis_index + 1 (1-based field 2 = X, 3 = Y, 4 = Z).
.. warning::
move issues a SET_PAR 103 (global speed) command immediately
before MOVE_AXIS. These two commands are serialised by the shared
FPosBAPIClient lock, but they
are not atomic — concurrent moves on different axes may interleave their
SET_PAR calls. Use Gantry.move_to
with a single-axis movement queue (not concurrent) when per-move velocity
accuracy matters.
FPosBAxis
FPosBAPI-backed representation of a single CECC-X gantry axis.
Wraps MOVE_AXIS, HOME, and ROB_POS FPosBAPI commands behind the
same public interface as EdconAxis. All
socket communication is performed via the shared client instance which
must be owned by the parent Gantry.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
Human-readable axis label, e.g. |
|
index |
1-based axis number sent to |
Initialise the axis proxy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Human-readable axis label used in log messages and equality checks. |
required |
index
|
int
|
1-based axis index for |
required |
client
|
FPosBAPIClient
|
Shared |
required |
Source code in src/applied_motion/backends/fposbapi_axis.py
move
Move this axis to position at velocity.
Sets the global gantry speed (parameter 103) to velocity before
issuing the MOVE_AXIS command. The call blocks until the PLC
reports SUCCESS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
float
|
Target position in mm. Interpreted as absolute by
default; pass |
required |
velocity
|
float
|
Move speed in mm/s. Written to PLC parameter 103 (global speed) before the move. |
required |
timeout
|
int | None
|
Optional per-command socket timeout in seconds for the
|
None
|
**kwargs
|
Optional keyword overrides. Recognised keys:
|
{}
|
Returns:
| Type | Description |
|---|---|
bool
|
|
bool
|
|
Raises:
| Type | Description |
|---|---|
~FPosBAPICommunicationError
|
If a communication or protocol failure occurs. |
Source code in src/applied_motion/backends/fposbapi_axis.py
home
Issue the HOME command, homing all axes together.
The FPosBAPI HOME command references every axis simultaneously —
there is no per-axis home. Calling this method on any individual
proxy triggers a full multi-axis homing sequence.
.. note::
Gantry.home sends a single
HOME command at the gantry level and does not call this method
on each proxy individually, avoiding duplicate HOME requests.
Returns:
| Type | Description |
|---|---|
bool
|
|
bool
|
if the PLC rejects it. |
Raises:
| Type | Description |
|---|---|
~FPosBAPICommunicationError
|
If a communication or protocol failure occurs. |
Source code in src/applied_motion/backends/fposbapi_axis.py
get_current_axis_position
Return this axis's current position in mm via ROB_POS.
Sends ROB_POS and extracts this axis's coordinate from the
response. Assumes the response layout::
1 | |
where the position field for axis n is at fields[n + 1]
(1-based field numbering after stripping the leading msg_id
and ROB_POS label fields).
Returns:
| Type | Description |
|---|---|
float
|
Current axis position in mm. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the response cannot be parsed. |
~FPosBAPIClientError
|
If the PLC returns an error response. |
Source code in src/applied_motion/backends/fposbapi_axis.py
is_homed
Return whether the gantry has been homed via IS_HOME.
Sends IS_HOME and interprets the response field that follows the
echoed command name. The PLC returns 1 when homing is complete
and 0 when it is not.
Returns:
| Type | Description |
|---|---|
bool
|
|
bool
|
otherwise. |
Raises:
| Type | Description |
|---|---|
~FPosBAPIClientError
|
If the PLC returns an error response. |
RuntimeError
|
If the response cannot be parsed. |
Source code in src/applied_motion/backends/fposbapi_axis.py
stopped
Return True; FPosBAPI moves are blocking so motion is always complete on return.
move blocks until the PLC emits a SUCCESS response,
meaning by the time Python regains control the axis has stopped.
This method always returns True to satisfy the
Axis interface.
Returns:
| Type | Description |
|---|---|
bool
|
Always |
Source code in src/applied_motion/backends/fposbapi_axis.py
acknowledge_faults
enable_powerstage
disable_powerstage
current_position
current_velocity
jog_task
jog_task(
jog_positive: bool = True,
jog_negative: bool = False,
incremental: bool = False,
duration: float = 0.0,
) -> bool
Jog axis.
Source code in src/applied_motion/backends/fposbapi_axis.py
ready_for_motion
Return whether the gantry drives are enabled via IS_ENBL.
Sends IS_ENBL and interprets the response. The PLC returns
1 when drives are enabled and ready to accept motion commands,
0 when they are disabled.
Returns:
| Type | Description |
|---|---|
bool
|
|
bool
|
otherwise. |
Raises:
| Type | Description |
|---|---|
~FPosBAPIClientError
|
If the PLC returns an error response. |
RuntimeError
|
If the response cannot be parsed. |