rcp-sdk 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
rcp_sdk-0.1.0/LICENSE ADDED
@@ -0,0 +1,216 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
203
+
204
+ Copyright 2026 Robot.io
205
+
206
+ Licensed under the Apache License, Version 2.0 (the "License");
207
+ you may not use this file except in compliance with the License.
208
+ You may obtain a copy of the License at
209
+
210
+ http://www.apache.org/licenses/LICENSE-2.0
211
+
212
+ Unless required by applicable law or agreed to in writing, software
213
+ distributed under the License is distributed on an "AS IS" BASIS,
214
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
215
+ See the License for the specific language governing permissions and
216
+ limitations under the License.
rcp_sdk-0.1.0/NOTICE ADDED
@@ -0,0 +1,11 @@
1
+ RCP (Robot Context Protocol)
2
+ Copyright 2026 Robot.io
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ This product includes software developed at Robot.io
11
+ (https://robot.io/).
rcp_sdk-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,395 @@
1
+ Metadata-Version: 2.4
2
+ Name: rcp-sdk
3
+ Version: 0.1.0
4
+ Summary: RCP (Robot Context Protocol) — adapter SDK for AI-to-robot-controller communication
5
+ Author: Robot.io
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/robot-io-ai/rcp-protocol
8
+ Project-URL: Repository, https://github.com/robot-io-ai/rcp-protocol
9
+ Project-URL: Documentation, https://github.com/robot-io-ai/rcp-protocol/blob/main/docs/rcp-specification.md
10
+ Project-URL: Issues, https://github.com/robot-io-ai/rcp-protocol/issues
11
+ Keywords: robotics,rcp,robot-context-protocol,automation,ai,industrial-robots
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ License-File: NOTICE
25
+ Provides-Extra: server
26
+ Requires-Dist: websockets>=12.0; extra == "server"
27
+ Requires-Dist: zeroconf>=0.132; extra == "server"
28
+ Dynamic: license-file
29
+
30
+ # RCP SDK — Robot Context Protocol
31
+
32
+ RCP (Robot Context Protocol) is an open standard for AI-to-robot-controller communication. Think of it as MCP (Model Context Protocol), but for industrial robots. RCP defines a unified interface that lets AI assistants read robot state, validate programs, deploy code, and monitor I/O across any OEM controller — ABB, KUKA, FANUC, UR, and more — through a single adapter abstraction.
33
+
34
+ ## Install
35
+
36
+ ```bash
37
+ pip install rcp-sdk
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ Create a new adapter by subclassing `RCPAdapter` and implementing all abstract methods:
43
+
44
+ ```python
45
+ from rcp_sdk import (
46
+ RCPAdapter,
47
+ RobotIdentity, AdapterCapabilities, JointState, TCPPosition,
48
+ IOState, IOSignal, ProgramInfo, ToolData,
49
+ )
50
+
51
+
52
+ class MyRobotAdapter(RCPAdapter):
53
+ """Adapter for MyRobot controllers."""
54
+
55
+ def __init__(self):
56
+ self._connected = False
57
+ self._session = None
58
+
59
+ async def connect(self, config: dict) -> None:
60
+ host = config["host"]
61
+ port = config.get("port", 443)
62
+ # Establish connection to the controller
63
+ self._session = await my_robot_api.connect(host, port)
64
+ self._connected = True
65
+
66
+ async def disconnect(self) -> None:
67
+ if self._session:
68
+ await self._session.close()
69
+ self._connected = False
70
+
71
+ def is_connected(self) -> bool:
72
+ return self._connected
73
+
74
+ async def discover(self) -> RobotIdentity:
75
+ info = await self._session.get_system_info()
76
+ return RobotIdentity(
77
+ manufacturer="MyRobot",
78
+ model=info["model"],
79
+ controller=info["controller"],
80
+ firmware=info["firmware_version"],
81
+ serial=info["serial_number"],
82
+ joint_count=6,
83
+ payload_kg=info.get("payload", 0),
84
+ reach_mm=info.get("reach", 0),
85
+ )
86
+
87
+ def capabilities(self) -> AdapterCapabilities:
88
+ return AdapterCapabilities(
89
+ read=True,
90
+ validate=True,
91
+ deploy=True,
92
+ execute=False,
93
+ events=["io_changed", "program_state"],
94
+ streaming=True,
95
+ )
96
+
97
+ async def get_joints(self) -> list[JointState]:
98
+ raw = await self._session.read_joints()
99
+ return [
100
+ JointState(
101
+ name=f"J{i+1}",
102
+ position_deg=j["pos"],
103
+ min_deg=j["min"],
104
+ max_deg=j["max"],
105
+ max_speed_deg_s=j["max_speed"],
106
+ )
107
+ for i, j in enumerate(raw)
108
+ ]
109
+
110
+ async def get_tcp(self) -> TCPPosition:
111
+ pos = await self._session.read_tcp()
112
+ return TCPPosition(
113
+ x=pos["x"], y=pos["y"], z=pos["z"],
114
+ rx=pos["rx"], ry=pos["ry"], rz=pos["rz"],
115
+ )
116
+
117
+ async def get_io(self) -> IOState:
118
+ signals = await self._session.read_io()
119
+ return IOState(signals=[
120
+ IOSignal(
121
+ name=s["name"],
122
+ signal_type=s["type"], # "digital_input", "digital_output", etc.
123
+ value=s["value"],
124
+ )
125
+ for s in signals
126
+ ])
127
+
128
+ async def get_programs(self) -> list[ProgramInfo]:
129
+ progs = await self._session.list_programs()
130
+ return [
131
+ ProgramInfo(
132
+ name=p["name"],
133
+ loaded=p.get("loaded", False),
134
+ running=p.get("running", False),
135
+ paused=p.get("paused", False),
136
+ )
137
+ for p in progs
138
+ ]
139
+
140
+ async def get_tools(self) -> list[ToolData]:
141
+ tools = await self._session.read_tools()
142
+ return [
143
+ ToolData(
144
+ name=t["name"],
145
+ tcp_x=t["x"], tcp_y=t["y"], tcp_z=t["z"],
146
+ mass_kg=t["mass"],
147
+ )
148
+ for t in tools
149
+ ]
150
+ ```
151
+
152
+ ## Safety Model
153
+
154
+ Every RCP action has a fixed risk level. These are protocol-level constants that adapters cannot override.
155
+
156
+ | Risk Level | Gate | Actions |
157
+ |---|---|---|
158
+ | **SAFE** | None — auto-approved | `stop`, read resources, validate, capture position, diff program |
159
+ | **GUARDED** | User confirmation dialog | `upload_program`, `set_io` |
160
+ | **RESTRICTED** | User confirmation + safety interlock verification | `start_program`, `jog`, `move_to`, `home` |
161
+ | **PROHIBITED** | Protocol rejects — never implement | `override_safety`, `disable_estop`, `modify_safety_config` |
162
+
163
+ Rules:
164
+ - GUARDED and RESTRICTED actions are logged to an append-only audit trail.
165
+ - Approval tokens expire after 5 minutes.
166
+ - RESTRICTED actions call `verify_interlocks()` before execution.
167
+ - PROHIBITED actions are rejected at the protocol level. Do not implement them.
168
+
169
+ ```python
170
+ from rcp_sdk import ACTION_RISK, PROHIBITED_ACTIONS
171
+
172
+ # Check risk level for an action
173
+ risk = ACTION_RISK["upload_program"] # "GUARDED"
174
+ risk = ACTION_RISK["move_to"] # "RESTRICTED"
175
+
176
+ # These actions are always rejected
177
+ assert "override_safety" in PROHIBITED_ACTIONS
178
+ ```
179
+
180
+ ## API Reference
181
+
182
+ ### Abstract Methods (must implement)
183
+
184
+ | Method | Signature | Description |
185
+ |---|---|---|
186
+ | `connect` | `async def connect(self, config: dict) -> None` | Connect to the controller. Config contains `host`, `port`, credentials. |
187
+ | `disconnect` | `async def disconnect(self) -> None` | Disconnect from the controller. |
188
+ | `is_connected` | `def is_connected(self) -> bool` | Return `True` if currently connected. |
189
+ | `discover` | `async def discover(self) -> RobotIdentity` | Read the robot's identity (model, serial, firmware, joint limits). |
190
+ | `capabilities` | `def capabilities(self) -> AdapterCapabilities` | Declare what this adapter supports (read, validate, deploy, execute, events). |
191
+ | `get_joints` | `async def get_joints(self) -> list[JointState]` | Get current joint positions in degrees. |
192
+ | `get_tcp` | `async def get_tcp(self) -> TCPPosition` | Get current TCP (tool center point) position. |
193
+ | `get_io` | `async def get_io(self) -> IOState` | Get all I/O signal states. |
194
+ | `get_programs` | `async def get_programs(self) -> list[ProgramInfo]` | List programs on the controller. |
195
+ | `get_tools` | `async def get_tools(self) -> list[ToolData]` | Get configured tool definitions. |
196
+
197
+ ### Optional Methods (override as needed)
198
+
199
+ | Method | Signature | Risk Level | Description |
200
+ |---|---|---|---|
201
+ | `get_program_code` | `async def get_program_code(self, module: str) -> str` | SAFE | Get source code of a program module. Returns empty string if not supported. |
202
+ | `upload_program` | `async def upload_program(self, module: str, code: str) -> UploadResult` | GUARDED | Upload a program module to the controller. |
203
+ | `capture_position` | `async def capture_position(self) -> tuple[TCPPosition, list[JointState]]` | SAFE | Capture current position. Default calls `get_tcp()` + `get_joints()`. |
204
+ | `set_io` | `async def set_io(self, signal: str, value: float) -> None` | GUARDED | Set an I/O output signal value. |
205
+ | `verify_interlocks` | `async def verify_interlocks(self) -> tuple[bool, str]` | SAFE | Check safety interlocks. Returns `(ok, reason)`. Default always passes. |
206
+ | `move_to` | `async def move_to(self, position: TCPPosition) -> dict` | RESTRICTED | Move TCP to position. Returns `{"success": bool, "message": str}`. |
207
+ | `stop` | `async def stop(self) -> None` | SAFE | Immediately stop robot motion. |
208
+ | `get_context` | `async def get_context(self) -> RobotContext` | SAFE | Aggregate all state into a context block for AI injection. Has a default implementation. |
209
+
210
+ ## Type Reference
211
+
212
+ All types are Python `dataclass` instances from `rcp_sdk.models`.
213
+
214
+ ### `RobotIdentity`
215
+
216
+ Describes the connected robot.
217
+
218
+ | Field | Type | Description |
219
+ |---|---|---|
220
+ | `manufacturer` | `str` | OEM name (e.g., `"ABB"`, `"KUKA"`, `"FANUC"`) |
221
+ | `model` | `str` | Robot model (e.g., `"IRB 6700"`) |
222
+ | `controller` | `str` | Controller name (e.g., `"IRC5"`, `"KRC5"`) |
223
+ | `firmware` | `str` | Firmware version string |
224
+ | `serial` | `str` | Serial number |
225
+ | `joint_count` | `int` | Number of joints (default `6`) |
226
+ | `joint_limits` | `list[JointState]` | Joint limit definitions (default empty) |
227
+ | `payload_kg` | `float` | Max payload in kg (default `0.0`) |
228
+ | `reach_mm` | `float` | Max reach in mm (default `0.0`) |
229
+
230
+ ### `JointState`
231
+
232
+ A single joint's current state and limits.
233
+
234
+ | Field | Type | Description |
235
+ |---|---|---|
236
+ | `name` | `str` | Joint name (`"J1"`, `"J2"`, etc.) |
237
+ | `position_deg` | `float` | Current position in degrees |
238
+ | `min_deg` | `float` | Minimum limit in degrees (default `-360.0`) |
239
+ | `max_deg` | `float` | Maximum limit in degrees (default `360.0`) |
240
+ | `max_speed_deg_s` | `float` | Maximum speed in degrees/second (default `180.0`) |
241
+
242
+ ### `TCPPosition`
243
+
244
+ Tool center point position in Cartesian space.
245
+
246
+ | Field | Type | Description |
247
+ |---|---|---|
248
+ | `x` | `float` | X position in mm |
249
+ | `y` | `float` | Y position in mm |
250
+ | `z` | `float` | Z position in mm |
251
+ | `rx` | `float` | Rotation around X — OEM-native units (see Rotation Convention below) |
252
+ | `ry` | `float` | Rotation around Y — OEM-native units |
253
+ | `rz` | `float` | Rotation around Z — OEM-native units |
254
+
255
+ ### `IOSignal`
256
+
257
+ A single I/O signal.
258
+
259
+ | Field | Type | Description |
260
+ |---|---|---|
261
+ | `name` | `str` | Signal name (e.g., `"DI_01"`, `"DO_Gripper"`) |
262
+ | `signal_type` | `Literal` | One of `"digital_input"`, `"digital_output"`, `"analog_input"`, `"analog_output"` |
263
+ | `value` | `float` | Signal value — `0`/`1` for digital, `0.0`-`1.0` for analog |
264
+
265
+ ### `IOState`
266
+
267
+ Container for all I/O signals.
268
+
269
+ | Field | Type | Description |
270
+ |---|---|---|
271
+ | `signals` | `list[IOSignal]` | All I/O signals on the controller |
272
+
273
+ ### `ProgramInfo`
274
+
275
+ Metadata about a program on the controller.
276
+
277
+ | Field | Type | Description |
278
+ |---|---|---|
279
+ | `name` | `str` | Program/module name |
280
+ | `loaded` | `bool` | Whether the program is loaded (default `False`) |
281
+ | `running` | `bool` | Whether the program is running (default `False`) |
282
+ | `paused` | `bool` | Whether the program is paused (default `False`) |
283
+
284
+ ### `ToolData`
285
+
286
+ A configured tool (end-effector) definition.
287
+
288
+ | Field | Type | Description |
289
+ |---|---|---|
290
+ | `name` | `str` | Tool name |
291
+ | `tcp_x` | `float` | TCP offset X in mm (default `0.0`) |
292
+ | `tcp_y` | `float` | TCP offset Y in mm (default `0.0`) |
293
+ | `tcp_z` | `float` | TCP offset Z in mm (default `0.0`) |
294
+ | `mass_kg` | `float` | Tool mass in kg (default `0.0`) |
295
+
296
+ ### `AdapterCapabilities`
297
+
298
+ Declares what the adapter supports.
299
+
300
+ | Field | Type | Description |
301
+ |---|---|---|
302
+ | `read` | `bool` | Can read robot state (default `True`) |
303
+ | `validate` | `bool` | Can validate programs (default `False`) |
304
+ | `deploy` | `bool` | Can upload programs (default `False`) |
305
+ | `execute` | `bool` | Can execute programs / motion (default `False`) |
306
+ | `events` | `list[str]` | Supported event channels (default empty) |
307
+ | `streaming` | `bool` | Supports real-time streaming (default `False`) |
308
+
309
+ ### `RobotContext`
310
+
311
+ Aggregated robot state for AI prompt injection.
312
+
313
+ | Field | Type | Description |
314
+ |---|---|---|
315
+ | `identity` | `RobotIdentity \| None` | Robot identity (default `None`) |
316
+ | `tcp` | `TCPPosition \| None` | Current TCP position (default `None`) |
317
+ | `joints` | `list[JointState]` | Current joint states (default empty) |
318
+ | `io` | `IOState` | I/O state (default empty) |
319
+ | `programs` | `list[ProgramInfo]` | Programs on controller (default empty) |
320
+ | `tools` | `list[ToolData]` | Configured tools (default empty) |
321
+
322
+ Call `context.to_prompt_block()` to get a formatted text block for LLM system prompt injection.
323
+
324
+ ### `RCPEvent`
325
+
326
+ A real-time event from the controller.
327
+
328
+ | Field | Type | Description |
329
+ |---|---|---|
330
+ | `channel` | `str` | Event channel: `"io_changed"`, `"position_changed"`, `"program_state"`, `"error"`, `"cycle"`, `"safety"` |
331
+ | `data` | `dict` | Event payload (default empty) |
332
+ | `timestamp` | `float` | Unix timestamp in milliseconds (default `0.0`) |
333
+
334
+ ### `UploadResult`
335
+
336
+ Result of uploading a program to the controller.
337
+
338
+ | Field | Type | Description |
339
+ |---|---|---|
340
+ | `success` | `bool` | Whether the upload succeeded |
341
+ | `message` | `str` | Human-readable result message (default empty) |
342
+ | `audit_id` | `str` | Audit trail entry ID (default empty) |
343
+
344
+ ### `DiffResult`
345
+
346
+ Result of comparing local code against controller code.
347
+
348
+ | Field | Type | Description |
349
+ |---|---|---|
350
+ | `local_code` | `str` | The local version of the code |
351
+ | `controller_code` | `str` | The version currently on the controller |
352
+ | `added` | `int` | Number of lines added (default `0`) |
353
+ | `removed` | `int` | Number of lines removed (default `0`) |
354
+ | `changed` | `int` | Number of lines changed (default `0`) |
355
+
356
+ Call `diff.summary()` to get a formatted string like `"+3 -1 ~2 lines"`.
357
+
358
+ ### `AuditEntry`
359
+
360
+ Append-only audit log entry for GUARDED and RESTRICTED actions.
361
+
362
+ | Field | Type | Description |
363
+ |---|---|---|
364
+ | `id` | `str` | Unique entry ID |
365
+ | `timestamp` | `str` | ISO 8601 timestamp |
366
+ | `action` | `str` | Action name (e.g., `"upload_program"`) |
367
+ | `risk_level` | `RiskLevel` | `"SAFE"`, `"GUARDED"`, `"RESTRICTED"`, or `"PROHIBITED"` |
368
+ | `approved_by` | `str` | Who approved the action |
369
+ | `robot` | `str` | Robot description (e.g., `"ABB IRB 6700 (SN: 12345)"`) |
370
+ | `params` | `dict` | Action parameters (default empty) |
371
+ | `result` | `str` | Outcome: `"success"`, `"failed"`, or `"rejected"` (default empty) |
372
+ | `diff_summary` | `str` | Diff summary for upload actions (default empty) |
373
+
374
+ ### `RiskLevel`
375
+
376
+ Type alias: `Literal["SAFE", "GUARDED", "RESTRICTED", "PROHIBITED"]`
377
+
378
+ ## Rotation Convention
379
+
380
+ The `rx`, `ry`, `rz` fields on `TCPPosition` hold OEM-native rotation values. Each robot manufacturer uses a different rotation representation:
381
+
382
+ | OEM | Convention | Fields |
383
+ |---|---|---|
384
+ | ABB | Quaternion (converted to Euler internally) | `rx`, `ry`, `rz` as Euler angles |
385
+ | KUKA | Euler ZYX | `rx`=A, `ry`=B, `rz`=C |
386
+ | Universal Robots | Rotation vector (axis-angle) | `rx`, `ry`, `rz` as rotation vector components |
387
+ | FANUC | W,P,R (Euler ZYZ variant) | `rx`=W, `ry`=P, `rz`=R |
388
+
389
+ Adapters are responsible for converting their OEM's native rotation format into the `rx`/`ry`/`rz` fields. Consumers of RCP data should treat these values as opaque per-OEM values unless they know the specific adapter in use.
390
+
391
+ ## License
392
+
393
+ Apache 2.0 — see [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
394
+
395
+ Apache 2.0 was chosen (matching the RCP specification) for its explicit patent grant — important for enterprise manufacturers adopting the protocol. Same license as Kubernetes, gRPC, Kafka, ROS 2, and TensorFlow.