Core lifecycle¶
RSIAPI is the entry point: it owns the client, the network process and the namespaces on the other API pages.
Usage¶
api = RSIAPI(
config_file=context("joints"), # required: a shipped context, or the path to your own config
rsi_mode="relative", # "absolute" or "relative" -- must match KRL
max_cartesian_rate=0.5, # Max mm/cycle for RKorr (0 = unlimited)
max_joint_rate=0.1, # Max deg/cycle for AKorr (0 = unlimited)
cycle_time=0.004 # 0.004 = 4ms/250Hz, 0.012 = 12ms/83Hz
)
api.start() # Start UDP listener in background thread
api.wait_for_connection(10.0) # Block until first robot packet (returns bool)
api.is_running() # Check if communication is active
api.stop() # Graceful shutdown
api.reconnect() # Restart network with fresh resources
Reference¶
RSIAPI
¶
RSIAPI(config_file: str, rsi_mode: str = 'relative', max_cartesian_rate: float = 0.0, max_joint_rate: float = 0.0, cycle_time: float = 0.004, rsi_limits_file: Optional[str] = None, enable_auto_reconnect: bool = False, auto_reconnect_retries: int = 5, auto_reconnect_delay: float = 5.0)
High-level API orchestrator for KUKA RSI robot control.
Supports context manager usage for safe cleanup
with RSIAPI('RSI_EthernetConfig.xml') as api: ... api.start() ... api.motion.update_cartesian(X=10)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_file
|
str
|
Path to the RSI Ethernet config XML. Required, and it must be the SAME file the controller's ETHERNET object loads — the two ends have to agree on the telegram structure. There is deliberately no default: a relative one would resolve against the working directory and could silently pick up a config that does not match the robot. |
required |
rsi_mode
|
str
|
'absolute' or 'relative' — must match KRL RSI_MOVECORR() mode |
'relative'
|
max_cartesian_rate
|
float
|
Max mm/cycle for RKorr corrections (0 = no limit) |
0.0
|
max_joint_rate
|
float
|
Max degrees/cycle for AKorr corrections (0 = no limit) |
0.0
|
cycle_time
|
float
|
Expected RSI cycle time in seconds (0.004 = 4ms/250Hz, 0.012 = 12ms/83Hz) |
0.004
|
rsi_limits_file
|
Optional[str]
|
Optional path to .rsi.xml safety limits file |
None
|
enable_auto_reconnect
|
bool
|
Enable automatic reconnection on communication loss |
False
|
auto_reconnect_retries
|
int
|
Maximum reconnection attempts (0 = unlimited) |
5
|
auto_reconnect_delay
|
float
|
Base delay between retries in seconds |
5.0
|
start
¶
Start RSI communication in a background thread.
Raises whatever the client raised if it failed to start, rather than reporting success and leaving the caller to discover it much later. A bad config, a busy UDP port or a bad state transition all surface here; without this, wait_for_connection() would sit for its full timeout and then blame the robot for a fault on this side.
wait_for_connection
¶
Block until the robot's first packet is received.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float
|
Maximum time to wait in seconds |
10.0
|
Returns:
| Type | Description |
|---|---|
bool
|
True if connected, False if timeout |