Echo server¶
The emulated controller used by the tests, the examples' dry runs and offline development. How to run it: Testing offline.
Reference¶
EchoServer
¶
EchoServer(config_file, delay_ms=4, mode='relative', rsi_file=None, timeout_packets=None, onlysend=None)
Emulates a KUKA RSI controller for offline testing.
Behaves like the robot side of the link
- Owns the IPOC clock: it increments IPOC itself every cycle and never adopts a value supplied by the client.
- Validates every
reply (IPOC echo + SENTYPE) and drops the corrections carried by invalid packets. - Counts late/invalid packets, reports them via DEF_Delay, and "breaks off" RSI once the ETHERNET Timeout budget is exceeded.
Initialise the echo server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_file
|
str
|
Path to RSI EthernetConfig.xml. |
required |
delay_ms
|
int
|
Interpolation cycle in milliseconds (4 or 12 on a real controller). Doubles as the IPOC increment per cycle. |
4
|
mode
|
str
|
Correction mode ("relative" or "absolute"). |
'relative'
|
rsi_file
|
str
|
Optional path to a .rsi / .rsi.xml signal-flow file. Its ETHERNET object's Timeout parameter is used as the faulty-packet budget. |
None
|
timeout_packets
|
int
|
Explicit faulty-packet budget; overrides rsi_file. |
None
|
onlysend
|
bool
|
ONLYSEND mode - stream |
None
|
receive_and_process
¶
Reads one incoming UDP datagram (if any) and hands it to process_reply().
process_reply
¶
Parse, validate and (only if valid) apply one
Rejected packets increment the faulty counter and their corrections and state updates are discarded in full.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xml_string
|
str
|
Raw |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the packet was accepted and applied, False otherwise. |
generate_message
¶
Creates a reply XML message based on current state. Format matches KUKA RSI's expected response structure. Iterates over all state variables from the config's send_variables.
send_once
¶
Transmits one
Returns:
| Type | Description |
|---|---|
str
|
The XML that was transmitted. |
send_message
¶
Main loop to receive input, update state, and send reply. Runs in a background thread until stopped.