applied_motion
applied_motion
Gantry
Gantry(
axes: AxisMap | None = None,
concurrent_axes: AxisMap | None = None,
*,
config: dict | str | Path | None = None,
name: str = "gantry_1",
_backend: GantryBackend | None = None,
)
Coordinate multiple axis objects as a single gantry.
Dispatches sequential or concurrent move commands to the individual axes and provides convenience methods for homing, status queries, and position readback.
Attributes:
| Name | Type | Description |
|---|---|---|
axes |
Mapping of axis name → axis instance for all registered axes. |
|
concurrent_axes |
Optional mapping of axes that may move simultaneously.
When |
Initialise the gantry with the provided axis mapping.
When config is provided, this constructor selects the correct
backend (Modbus or FPosBAPI) and creates axes automatically from a JSON
configuration dict or file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axes
|
AxisMap | None
|
None
|
|
concurrent_axes
|
AxisMap | None
|
Optional dict of axes that are allowed to move
simultaneously. Pass |
None
|
config
|
dict | str | Path | None
|
Optional configuration dict or JSON file path. When
provided, the gantry builds axes and backend from config and
ignores |
None
|
name
|
str
|
Gantry component name to load from |
'gantry_1'
|
_backend
|
GantryBackend | None
|
Internal backend strategy object that owns backend- specific gantry behavior. |
None
|
Source code in src/applied_motion/applied_motion.py
from_config
classmethod
Instantiate a Gantry from a configuration dict or JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict | str | Path
|
Parsed configuration mapping or JSON file path. |
required |
name
|
str
|
Component name to load from config. |
'gantry_1'
|
Returns:
| Type | Description |
|---|---|
Gantry
|
Initialised |
Source code in src/applied_motion/applied_motion.py
move_to
Dispatch a queue of movements to the gantry axes.
Processes each movement dict in movements, dispatching them either
sequentially or concurrently according to concurrent and the
gantry's concurrent_axes configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
movements
|
MovementBatch
|
A |
required |
timeout
|
int | None
|
Optional per-move time limit in seconds. Passed through
to each |
None
|
concurrent
|
bool
|
When |
False
|
Notes
Axis references are validated before dispatch. Malformed movement entries or entries for unknown axes are logged and skipped.
Source code in src/applied_motion/applied_motion.py
home
Home all registered axes.
For the FPosBAPI backend, sends a single HOME command to the
CECC-X PLC which homes all axes in a coordinated sequence.
For the Modbus backend, iterates over every axis in insertion
order and calls Axis.home on each one sequentially.
Source code in src/applied_motion/applied_motion.py
close
supports_teach
Return whether PLC teaching commands are supported by this backend.
teach_pos
Teach current location into PLC position slot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pos_id
|
int
|
PLC position slot ID. |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If backend does not support PLC teaching. |
Source code in src/applied_motion/applied_motion.py
teach_tray
Teach current location into PLC tray slot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tray_id
|
int
|
Tray ID. |
required |
tray_pos
|
int
|
Position index within tray. |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If backend does not support PLC teaching. |
Source code in src/applied_motion/applied_motion.py
list_commands
get_status
Return a comprehensive status snapshot for the gantry.
The returned mapping combines per-axis health, aggregate summary booleans, and (when available) controller-level diagnostics exposed by the backend's shared client.
Returns:
| Type | Description |
|---|---|
GantryStatus
|
A dict with keys: |
GantryStatus
|
|
GantryStatus
|
|
GantryStatus
|
|
GantryStatus
|
|
GantryStatus
|
|
Source code in src/applied_motion/applied_motion.py
get_location
Return the current position of every axis in millimetres.
Calls EdconAxis.get_current_axis_position for each registered
axis and returns the results as a dict keyed by axis name.
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Mapping of axis name → current position in mm. |
Source code in src/applied_motion/applied_motion.py
is_stopped
Return True when every registered axis has stopped moving.
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in src/applied_motion/applied_motion.py
is_ready_for_motion
Return True when every registered axis is ready to accept a move command.
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in src/applied_motion/applied_motion.py
MovementError
Bases: Exception
Raised when a gantry or axis movement fails.
AxisNotFoundError
Bases: MovementError
Raised when an axis name referenced in a movement command does not exist.
Axis
Bases: Protocol
Structural interface for a single controllable axis.
Both EdconAxis (Modbus/festo-edcon backend) and
FPosBAxis (FPosBAPI backend)
satisfy this protocol structurally — no explicit inheritance required.
All position values are in millimetres (mm). All velocity values are in mm/s.
move
Move the axis to position at velocity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
float
|
Target position in mm (absolute or relative depending on
|
required |
velocity
|
float
|
Move speed in mm/s. |
required |
**kwargs
|
Backend-specific options (e.g. |
{}
|
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in src/applied_motion/backends/axis_protocol.py
home
get_current_axis_position
Return the current axis position in mm.
Returns:
| Type | Description |
|---|---|
float
|
Current position in mm. |
is_homed
Return whether this axis reports a valid homed/reference state.
Returns:
| Type | Description |
|---|---|
bool
|
|
stopped
Return True when the axis is not currently in motion.
Returns:
| Type | Description |
|---|---|
bool
|
|
acknowledge_faults
enable_powerstage
Turn on torque to motor controlling this axis.
Source code in src/applied_motion/backends/axis_protocol.py
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 the axis according to backend-specific jog semantics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jog_positive
|
bool
|
When |
True
|
jog_negative
|
bool
|
When |
False
|
incremental
|
bool
|
Backend-specific incremental jog mode flag. |
False
|
duration
|
float
|
Optional jog duration in seconds. A value of |
0.0
|
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in src/applied_motion/backends/axis_protocol.py
ready_for_motion
Return True when the axis is ready to accept a move command.
Returns:
| Type | Description |
|---|---|
bool
|
|
FPosBAPIClient
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 |
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
|
timeout
|
float | None
|
Socket timeout in seconds. Applied to both |
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
send_command
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. |
required |
*params
|
Zero or more positional parameters appended to the frame. |
()
|
|
timeout
|
float | None | _Unset
|
Per-call socket timeout in seconds. Pass |
_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 |
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
try_command
Send a command; raise on communication failure, return bool for PLC result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
FPosBAPI command string, e.g. |
required |
*params
|
Zero or more positional parameters. |
()
|
|
timeout
|
float | None | _Unset
|
Per-call socket timeout forwarded to |
_UNSET
|
Returns:
| Type | Description |
|---|---|
bool
|
|
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
get_veab
Get the pressure set value of the VEAB.
Source code in src/applied_motion/backends/fposbapi_client.py
set_veab
list_commands
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 | |
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. |
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
enable
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
disable
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
home
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
move_pos
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
|
retract_z
|
int
|
|
0
|
slow_app
|
int
|
|
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
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
|
move_typ
|
int
|
|
0
|
retract_z
|
int
|
|
0
|
slow_app
|
int
|
|
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
move_path
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
halt
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
resume
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
abort
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
reset_err
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
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
|
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
read_pos
Read the stored absolute position for pos_id via READ_POS.
Response layout::
1 | |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pos_id
|
int
|
Position record ID (1-100). |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float, float]
|
Tuple of |
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
teach_pos
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
write_pos
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
mod_pos
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
write_path
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
read_path
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 |
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
sys_status
Return the system status string via SYS_STATUS.
Response layout::
1 | |
Returns:
| Type | Description |
|---|---|
str
|
Status string reported by the PLC (e.g. |
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
is_error
Return whether the gantry is in an error state via IS_ERROR.
Response layout::
1 | |
Returns:
| Type | Description |
|---|---|
bool
|
|
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
fpb_error
Return the fieldbus error state via FPB_ERROR.
Response layout::
1 | |
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
read_err
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
err_log
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
com_log
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
err_desc
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
get_io
Return the value of an I/O channel via GET_IO.
Response layout::
1 | |
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
set_io
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
get_par
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 | |
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
set_par
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
teach_tray
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
write_tray
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
read_tray
Read the stored coordinates of a tray position via READ_TRAY.
Response layout::
1 | |
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 |
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
mod_tray
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
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
|
retract_z
|
int
|
|
0
|
slow_app
|
int
|
|
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
init_sys
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
close
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
FPosBAPIClientError
Bases: Exception
Raised when the FPosBAPI server returns an error response or the connection is lost.
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. |
Source code in src/applied_motion/backends/fposbapi_axis.py
EdconAxis
EdconAxis(
name: str,
ip: str,
run_referencing: bool = False,
max_position: float = inf,
min_position: float = -inf,
)
Bases: MotionHandler
Modbus TCP axis: direct festo-edcon MotionHandler connection to one drive.
Wraps low-level Modbus communication and position/velocity unit conversion behind a millimetre-based public API. All position values accepted and returned by the public methods use millimetres (mm) as their unit.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
Human-readable label for this axis (e.g. |
|
ip |
IPv4 address of the drive's Modbus TCP endpoint. |
|
com |
Active |
|
max_speed |
float
|
Maximum achievable speed in drive velocity units. |
max_position |
float
|
Maximum achievable position in mm. |
min_position |
float
|
Minimum achievable position in mm. |
Initialise the axis and establish a Modbus connection.
Creates the ComModbus connection,
initialises the parent MotionHandler,
reads the software-limit PNUs, and optionally triggers homing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Human-readable axis label used in log messages and equality checks. Axis labels are unique within a gantry. |
required |
ip
|
str
|
IPv4 address of the Festo drive's Modbus TCP interface. |
required |
run_referencing
|
bool
|
When |
False
|
max_position
|
float
|
Optional max position limitation, if the drive is restricted more than the internal SW limit position check. This avoids an issue where traversing toward the actual endstop is interrupted because the interia of the motion causes the drive to overshoot the limit position, throwing an error and interrupting the power stage on state. |
inf
|
min_position
|
float
|
Optional min position limitation, if the drive is restricted more than the internal SW limit position check. This avoids an issue where traversing toward the actual endstop is interrupted because the interia of the motion causes the drive to overshoot the limit position, throwing an error and interrupting the power stage on state. |
-inf
|
Source code in src/applied_motion/backends/edcon_axis.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
max_speed
property
Return largest allowed speed magnitude for this axis in mm/s.
This derives from configured signed velocity bounds and returns absolute maximum magnitude, independent of direction.
Returns:
| Type | Description |
|---|---|
float
|
Maximum absolute velocity limit in mm/s. |
home
Home the axis by running a referencing task.
Acknowledges any faults, enables the power stage, and then executes a blocking referencing task to establish the axis zero point.
Source code in src/applied_motion/backends/edcon_axis.py
is_homed
Checks whether drive has been homed and has a valid frame of reference.
Thin wrapper for interface consistency around MotionHandler.referenced().
current_position
Transparent wrapper around MotionHandler.current_position.
TODO: is this necessary?
Returns the raw position value in the drive's internal unit system
(drive units, whose scale is determined by PNU 11724 and varies by
firmware/configuration — typically 0.001 mm per unit). Use
get_current_axis_position when you need the position in a
consistent, human-readable unit (mm).
Source code in src/applied_motion/backends/edcon_axis.py
get_current_axis_position
Return the current axis position in the library's canonical output unit (mm).
Reads the raw drive-unit position from MotionHandler.current_position,
then converts it to mm via _valid_position with invert=True.
The drive's own PNU-reported position-unit scale is used for the
conversion, so the result is always consistent regardless of how the
drive was configured.
Internal methods (_check_overshoot, unit converters) continue to
use super().current_position() directly so their drive-unit arithmetic
is unaffected.
Source code in src/applied_motion/backends/edcon_axis.py
move
Move the axis to a specified position with a given velocity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
int | float
|
Target position in millimetres (mm). Converted internally to drive units before the motion command is issued. |
required |
velocity
|
int | float
|
Move velocity in mm/s. Converted internally to drive units. |
required |
timeout
|
int | None
|
Optional time limit in seconds for the move. When provided,
the motion is launched in a background thread and a stop command
is issued if the thread has not finished by the deadline. When
|
None
|
**kwargs
|
Optional keyword overrides. Recognised keys:
|
{}
|
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in src/applied_motion/backends/edcon_axis.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | |