Skip to content

Tools

Low-level variable access, config and variable listings, reports.

Usage

# Low-level variable access
api.tools.update_variable("RKorr.X", 10.0)
api.tools.show_variables()     # Print all available variables
api.tools.show_config()        # Network settings + variable structure
api.tools.reset_variables()    # Zero out corrections

# Reports and comparison
api.tools.generate_report("logs/test.csv", "pdf")
diffs = api.tools.compare_runs("run1.csv", "run2.csv")

Reference

ToolsAPI

ToolsAPI(client: RSIClient)

Utility tools interface for KUKA RSI robot control.

Provides debugging, inspection, data comparison, and reporting utilities for analyzing RSI performance and robot behavior.

Initialize ToolsAPI namespace.

Parameters:

Name Type Description Default
client RSIClient

RSIClient instance for variable access

required

update_variable

update_variable(name: str, value: Union[float, int, str, bool]) -> str

Low-level variable update with safety validation.

Direct access to send_variables for advanced users. Most users should use higher-level methods like api.motion.update_cartesian() instead.

The new value's type is coerced to match the existing value's type (bool / str / int / float) rather than always being forced to float: this preserves booleans (DiO-style flags), leaves strings alone (e.g. EStr), and keeps ints as ints. Safety limit validation (which is float-only) is applied for numeric types and skipped for strings.

Parameters:

Name Type Description Default
name str

Variable name (e.g., 'IPOC', 'RKorr.X', 'Tech.C11')

required
value Union[float, int, str, bool]

New value to set

required

Returns:

Type Description
str

Status message

Raises:

Type Description
RSIVariableError

If variable not found

RSISafetyViolation

If value violates safety limits

Example

api.tools.update_variable('RKorr.X', 10.0) 'Updated RKorr.X to 10.0' api.tools.update_variable('Tech.C11', 42) 'Updated Tech.C11 to 42' api.tools.update_variable('EStr', 'homing done') 'Updated EStr to homing done'

Note

This bypasses higher-level abstractions and directly modifies send_variables. Use with caution and prefer namespace-specific methods when available.

show_variables

show_variables() -> None

Print available send/receive variables to console.

Displays a formatted list of all configured RSI variables with their nested structure. Useful for debugging and discovering available data.

Example

api.tools.show_variables() Send Variables: - IPOC - RKorr: X, Y, Z, A, B, C - AKorr: A1, A2, A3, A4, A5, A6 - Tech: C11, C12, C13, ... T11, T12, ...

Receive Variables: - IPOC - RIst: X, Y, Z, A, B, C - RSol: X, Y, Z, A, B, C - ASPos: A1, A2, A3, A4, A5, A6 - MaCur: A1, A2, A3, A4, A5, A6

show_config

show_config() -> Dict[str, Any]

Retrieve configuration information.

Returns network settings and current variable structure from the active RSI configuration.

Returns:

Type Description
Dictionary containing
- Network: IP, port, sentype, onlysend settings
- Send variables: Current send variable structure
- Receive variables: Current receive variable structure
Example

config = api.tools.show_config() print(config['Network']) {'ip': '192.168.1.100', 'port': 49152, 'sentype': 'ImFree', 'onlysend': False} print(config['Send variables'].keys()) dict_keys(['IPOC', 'RKorr', 'AKorr', 'Tech'])

reset_variables

reset_variables() -> str

Reset receive variables (our corrections) to default values.

Writes the default values from the parsed config (self.client.config_parser.receive_variables) back into the live self.client.receive_variables, restoring correction values (RKorr, AKorr, Tech, etc.) to their configured defaults.

Returns:

Type Description
str

Status message

Example

api.tools.reset_variables() 'Receive variables reset to default values'

Note

This typically resets correction values (RKorr, AKorr) to zero and restores default Tech variable values. IPOC is not affected.

generate_report staticmethod

generate_report(filename: str, format_type: str = 'csv') -> str

Generate statistical report from CSV log file.

Analyzes recorded RSI data and produces summary statistics for position, velocity, and other metrics.

Parameters:

Name Type Description Default
filename str

Path to CSV log file (with or without .csv extension)

required
format_type str

Output format - 'csv', 'json', or 'pdf'

'csv'

Returns:

Type Description
str

Path to generated report file

Raises:

Type Description
FileNotFoundError

If CSV file doesn't exist

ValueError

If format_type is unsupported or CSV has no position data

Example

api.tools.generate_report('logs/test_run.csv', 'pdf') 'Report saved as logs/test_run_report.pdf' (Reads position columns from 'Send.RIst.*' - robot state.)

Note

PDF reports include bar charts of max/mean position values. CSV and JSON formats provide tabular statistical data.

compare_runs staticmethod

compare_runs(file1: str, file2: str) -> Dict[str, Dict[str, float]]

Compare two test run CSV files.

Calculates mean and max deviation between corresponding position columns in two log files. Useful for repeatability analysis.

Parameters:

Name Type Description Default
file1 str

Path to first CSV log file

required
file2 str

Path to second CSV log file

required

Returns:

Type Description
Dictionary mapping column names to deviation statistics
- mean_diff: Average absolute difference
- max_diff: Maximum absolute difference

Raises:

Type Description
FileNotFoundError

If either file doesn't exist

ValueError

If no shared 'Send.RIst' position columns are found between the two files

Example

diffs = api.tools.compare_runs('run1.csv', 'run2.csv') for col, stats in diffs.items(): ... print(f"{col}: mean={stats['mean_diff']:.3f}, max={stats['max_diff']:.3f}") Send.RIst.X: mean=0.234, max=1.456 Send.RIst.Y: mean=0.178, max=0.892 Send.RIst.Z: mean=0.312, max=1.023

Note

Only compares columns present in both files. Typically used for comparing repeatability of the same motion program. Robot state (RIst) is logged with the 'Send.' prefix - send_variables is what the ROBOT sends to us.