A significant regression between SDK versions that affects production Python applications controlling Fairino robots.
The problem
In v3.7.6 SDK: a Python script could automatically reconnect after the controller was power-cycled (e.g. after E-stop Category 0). The workflow was:
- E-stop pressed → controller powers off
- Controller restarts → comes back online
- Python script detects disconnect, reloads the SDK module, reconnects
- Production resumes without restarting the entire Python application
In v3.9.x SDK: this no longer works. After a power cycle:
- Calling
RPC.close()is not sufficient to clean up the connection - Internal threads and sockets from the previous session are stuck
- The Python module cannot be cleanly reset without killing the entire process
- Attempting to create a new Robot() instance fails or connects to a stale session
Root cause
The newer SDK creates background threads for keepalive, state monitoring, and position feedback (port 9998) that don't have proper cleanup/shutdown methods. In the old SDK, a simple close + re-initialize was enough because the connection was simpler.
Workarounds
Option 1: Stay on v3.7.6 SDK (if possible)
If auto-reconnect is critical for your application, use the older SDK version. But remember: SDK version must match firmware version — you'd need to keep the robot on v3.7.6 firmware too.
Option 2: Subprocess isolation
Run your robot control logic as a separate subprocess that gets killed and restarted after each E-stop cycle:
import subprocess, time
while True:
proc = subprocess.Popen(["python", "robot_control.py"])
proc.wait() # Blocks until the subprocess exits
print("Robot control exited, restarting in 5s...")
time.sleep(5)
This ensures a completely fresh Python process with no leftover state.
Option 3: importlib.reload() (fragile)
import importlib
import fairino
importlib.reload(fairino)
robot = fairino.Robot("192.168.58.2")
This sometimes works but is not guaranteed to clean up all threads and socket connections. Use with caution.
SDK + firmware version matching
This bears repeating: the SDK version must match the firmware version on the robot. Mismatched versions lead to:
- Functions that partially work then fail silently
- Changed function signatures (e.g.
PointTableUpdateLua()takes 2 args in v3.8.7 but only 1 in v3.9.2) - Different return value formats
- Extremely time-consuming debugging
Python version
The Fairino Python SDK requires Python 3.12.0. Higher versions may not be compatible. The SDK ships as compiled .pyd files (Windows DLLs) so you cannot inspect or modify the source code.
SDK downloads
- Official GitHub: github.com/FAIR-INNOVATION
- Alternative: frtech.fr/DOWNLOAD2