Compare commits
No commits in common. "legacy-claude-flow" and "main" have entirely different histories.
legacy-cla
...
main
4
.github/FUNDING.yml
vendored
Normal file
4
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Shown as the "Sponsor" button on the GitHub repo
|
||||
github: otherworld-dev
|
||||
custom:
|
||||
- "https://www.paypal.com/donate/?hosted_button_id=MA56N6K8FSTQ2"
|
||||
14
.gitignore
vendored
14
.gitignore
vendored
@ -1,3 +1,17 @@
|
||||
# Python
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Claude Code
|
||||
.claude/
|
||||
CLAUDE.md
|
||||
.claudeignore
|
||||
|
||||
# Build artifacts
|
||||
*.egg-info/
|
||||
build/
|
||||
dist/
|
||||
|
||||
# KUKA proprietary material - never commit (copyright)
|
||||
KUKA.RobotSensorInterface*.pdf
|
||||
TestServer.exe
|
||||
|
||||
20
CITATION.cff
Normal file
20
CITATION.cff
Normal file
@ -0,0 +1,20 @@
|
||||
cff-version: 1.2.0
|
||||
message: "If you use this software, please cite it as below."
|
||||
type: software
|
||||
title: "RSIPI: Robot Sensor Interface for Python"
|
||||
authors:
|
||||
- family-names: Morgan
|
||||
given-names: Adam
|
||||
email: contact@otherworld.dev
|
||||
affiliation: Swansea University
|
||||
version: 0.1.1
|
||||
date-released: 2026-07-11
|
||||
url: "https://github.com/otherworld-dev/rsi-pi"
|
||||
repository-code: "https://github.com/otherworld-dev/rsi-pi"
|
||||
license: Apache-2.0
|
||||
keywords:
|
||||
- KUKA
|
||||
- robotics
|
||||
- RSI
|
||||
- real-time control
|
||||
- industrial robots
|
||||
79
CLAUDE.md
79
CLAUDE.md
@ -1,79 +0,0 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## What This Project Does
|
||||
|
||||
RSIPI enables real-time control of KUKA industrial robots from Python via the RSI (Robot Sensor Interface) protocol. The robot sends its position ~250 times/second over UDP, and this library lets you send back position corrections to control the robot externally.
|
||||
|
||||
## Build & Development Commands
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
pip install -e .
|
||||
|
||||
# Or install from requirements (if present)
|
||||
pip install pandas>=2.0 numpy>=1.22 matplotlib>=3.5 lxml>=4.9 scipy>=1.8
|
||||
|
||||
# Run the CLI
|
||||
python -m RSIPI.rsi_cli --config RSI_EthernetConfig.xml
|
||||
|
||||
# Run the echo server (for offline testing without a real robot)
|
||||
python -m RSIPI.rsi_echo_server
|
||||
```
|
||||
|
||||
**No test suite exists** - testing is done via the echo server simulation and example scripts in `examples/`.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Core Communication Flow
|
||||
|
||||
```
|
||||
KUKA Robot Controller <--UDP/XML--> NetworkProcess <--multiprocessing.Manager--> RSIClient <-- RSIAPI/CLI
|
||||
```
|
||||
|
||||
1. **NetworkProcess** (`network_handler.py`) - Runs in separate process via `multiprocessing.Process`. Binds to UDP socket, receives XML from robot, parses into `receive_variables`, sends XML from `send_variables` back to robot. Uses `start_event` to wait for explicit start signal.
|
||||
|
||||
2. **RSIClient** (`rsi_client.py`) - Orchestrates the system. Initializes ConfigParser, SafetyManager, and NetworkProcess. Uses `multiprocessing.Manager` dicts for thread-safe variable sharing between processes.
|
||||
|
||||
3. **RSIAPI** (`rsi_api.py`) - High-level API wrapping RSIClient. Runs RSIClient in a daemon thread. Provides trajectory planning, logging, plotting, and safety controls.
|
||||
|
||||
4. **RSICommandLineInterface** (`rsi_cli.py`) - Interactive CLI that wraps RSIAPI.
|
||||
|
||||
### Key Shared State
|
||||
|
||||
Variables are shared between processes using `multiprocessing.Manager().dict()`:
|
||||
- `send_variables` - Values to send to robot (RKorr corrections, digital outputs, etc.)
|
||||
- `receive_variables` - Values received from robot (RIst position, ASPos joints, IPOC timestamp)
|
||||
|
||||
### Configuration
|
||||
|
||||
`RSI_EthernetConfig.xml` defines:
|
||||
- Network settings (IP, port) in `<CONFIG>` section
|
||||
- Send variables in `<SEND><ELEMENTS>` - what the robot receives from us
|
||||
- Receive variables in `<RECEIVE><ELEMENTS>` - what we receive from robot
|
||||
|
||||
Variable tags like `DEF_RIst` get the `DEF_` prefix stripped and are expanded using `internal_structure` in ConfigParser to full dicts (e.g., `RIst: {X, Y, Z, A, B, C}`).
|
||||
|
||||
### Safety Layer
|
||||
|
||||
**SafetyManager** (`safety_manager.py`) validates all outgoing values against configurable limits. Can load limits from `.rsi.xml` files. Supports emergency stop and safety override modes.
|
||||
|
||||
### Trajectory Execution
|
||||
|
||||
`TrajectoryPlanner` generates interpolated waypoints. `execute_trajectory()` in RSIAPI uses asyncio to send points at specified rate (default 12ms for Cartesian, 400ms for joints).
|
||||
|
||||
## Important Patterns
|
||||
|
||||
- **IPOC synchronization**: The robot sends an IPOC (timestamp) value. The response must include `IPOC + 4` to maintain sync. This is handled automatically in `NetworkProcess.process_received_data()`.
|
||||
|
||||
- **Lazy client initialization**: RSIAPI uses `_ensure_client()` pattern - RSIClient is created on first use, not at RSIAPI instantiation.
|
||||
|
||||
- **Non-blocking start**: `start_rsi()` runs the client loop in a daemon thread. The NetworkProcess waits on `start_event` before binding the socket.
|
||||
|
||||
## File Locations
|
||||
|
||||
- Source code: `src/RSIPI/`
|
||||
- Example scripts: `examples/`
|
||||
- Config template: `RSI_EthernetConfig.xml`
|
||||
- Logs written to: `logs/` (created at runtime)
|
||||
435
LICENSE
435
LICENSE
@ -1,235 +1,202 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
RSI-PI
|
||||
Copyright (C) 2025 adam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@ -1,499 +0,0 @@
|
||||
# Phase 2: Network Reliability - Complete
|
||||
|
||||
## Summary
|
||||
|
||||
Successfully implemented comprehensive network reliability infrastructure for RSIPI. The library now provides real-time performance monitoring, automatic connection recovery, and long-duration stability testing capabilities - essential for industrial robot control applications requiring 24/7 operation.
|
||||
|
||||
## What Changed
|
||||
|
||||
### Network Monitoring and Diagnostics
|
||||
|
||||
The RSIPI library now tracks detailed timing and network quality metrics in real-time:
|
||||
|
||||
1. **Timing Instrumentation** - Records cycle time, jitter, and latency with minimal overhead
|
||||
2. **IPOC Gap Detection** - Identifies missed packets via IPOC sequence analysis
|
||||
3. **Packet Loss Tracking** - Monitors communication reliability with percentage metrics
|
||||
4. **Watchdog Timer** - Detects communication timeouts (>1 second without packets)
|
||||
5. **Health Monitoring** - Real-time health status with threshold-based warnings
|
||||
|
||||
### Automatic Reconnection
|
||||
|
||||
New auto-reconnection manager provides graceful recovery from network failures:
|
||||
|
||||
1. **Background Monitoring** - Checks watchdog status every 2 seconds
|
||||
2. **Configurable Retry Strategies**:
|
||||
- IMMEDIATE: Reconnect without delay
|
||||
- LINEAR_BACKOFF: Incremental retry delays (5s, 10s, 15s, ...)
|
||||
- EXPONENTIAL_BACKOFF: Exponential retry delays (5s, 10s, 20s, 40s, ...)
|
||||
3. **Connection Verification** - Validates successful reconnection with health checks
|
||||
4. **Statistics Tracking** - Records reconnection attempts, failures, and timestamps
|
||||
5. **Event Callbacks** - Optional callbacks for reconnection success/failure
|
||||
|
||||
### Long-Duration Testing
|
||||
|
||||
24-hour stability test infrastructure for validating production-readiness:
|
||||
|
||||
1. **Configurable Duration** - Run tests from minutes to days
|
||||
2. **Sample Collection** - Records metrics at configurable intervals (default: 60s)
|
||||
3. **Real-Time Logging** - Progress updates with health status and warnings
|
||||
4. **JSON Reports** - Comprehensive statistical analysis of test results
|
||||
5. **Graceful Interruption** - Handles KeyboardInterrupt, always generates report
|
||||
|
||||
## New Files Created
|
||||
|
||||
```
|
||||
rsi-pi/
|
||||
├── src/RSIPI/
|
||||
│ ├── timing_metrics.py # NEW (305 lines)
|
||||
│ │ ├── TimingMetrics class
|
||||
│ │ │ ├── record_cycle() - Records IPOC and cycle time
|
||||
│ │ │ ├── check_watchdog() - Detects communication timeout
|
||||
│ │ │ ├── get_current_stats() - Real-time statistics
|
||||
│ │ │ ├── get_detailed_stats() - Statistics with percentiles
|
||||
│ │ │ └── get_health_status() - Health check with warnings
|
||||
│ │ └── NetworkQualityMonitor class
|
||||
│ │ ├── is_healthy() - Overall health status
|
||||
│ │ ├── get_warnings() - Active warning messages
|
||||
│ │ └── get_quality_score() - 0-100 quality score
|
||||
│ │
|
||||
│ └── auto_reconnect.py # NEW (241 lines)
|
||||
│ ├── ReconnectStrategy enum
|
||||
│ │ ├── IMMEDIATE
|
||||
│ │ ├── LINEAR_BACKOFF
|
||||
│ │ └── EXPONENTIAL_BACKOFF
|
||||
│ └── AutoReconnectManager class
|
||||
│ ├── start() - Start background monitoring
|
||||
│ ├── stop() - Stop background monitoring
|
||||
│ ├── _monitor_loop() - Watchdog monitoring thread
|
||||
│ ├── _attempt_reconnection() - Retry logic with backoff
|
||||
│ └── _verify_connection() - Post-reconnect validation
|
||||
│
|
||||
└── tests/
|
||||
└── stability_test.py # NEW (365 lines)
|
||||
├── StabilityTest class
|
||||
│ ├── setup() - Initialize API with auto-reconnect
|
||||
│ ├── run() - Execute test with sample collection
|
||||
│ ├── _collect_sample() - Get metrics snapshot
|
||||
│ ├── _log_progress() - Real-time progress logging
|
||||
│ ├── _cleanup() - Stop API and generate report
|
||||
│ ├── _generate_report() - Statistical analysis
|
||||
│ └── _print_summary() - Human-readable summary
|
||||
└── main() - Command-line interface
|
||||
```
|
||||
|
||||
## Modified Files
|
||||
|
||||
### [src/RSIPI/network_handler.py](rsi-pi/src/RSIPI/network_handler.py)
|
||||
|
||||
**Integration of timing metrics into real-time UDP loop:**
|
||||
|
||||
- Added `TimingMetrics` initialization in `run()` method
|
||||
- Record cycle on every received packet with `record_cycle(ipoc)`
|
||||
- Batch updates to shared metrics dict every 100 cycles (~400ms)
|
||||
- Zero-overhead design preserves 250Hz real-time performance
|
||||
|
||||
**Key Changes:**
|
||||
```python
|
||||
# Added to __init__
|
||||
def __init__(self, ..., metrics_dict: Optional[Any] = None):
|
||||
self.metrics_dict = metrics_dict
|
||||
|
||||
# In run() method
|
||||
if self.metrics_dict is not None:
|
||||
self.timing_metrics = TimingMetrics()
|
||||
|
||||
# In _run_loop()
|
||||
if self.timing_metrics is not None:
|
||||
ipoc = self.receive_variables.get("IPOC", 0)
|
||||
self.timing_metrics.record_cycle(ipoc)
|
||||
|
||||
update_counter += 1
|
||||
if update_counter >= 100:
|
||||
self._update_metrics_dict()
|
||||
update_counter = 0
|
||||
```
|
||||
|
||||
### [src/RSIPI/rsi_client.py](rsi-pi/src/RSIPI/rsi_client.py)
|
||||
|
||||
**Added auto-reconnection support and shared metrics dictionary:**
|
||||
|
||||
- Created `Manager().dict()` for inter-process metrics sharing
|
||||
- Pass metrics dict to NetworkProcess constructor
|
||||
- New constructor parameters for auto-reconnection configuration
|
||||
- Start/stop auto-reconnect monitor in lifecycle methods
|
||||
|
||||
**Key Changes:**
|
||||
```python
|
||||
# Added imports
|
||||
from .auto_reconnect import AutoReconnectManager, ReconnectStrategy
|
||||
|
||||
# New constructor parameters
|
||||
def __init__(
|
||||
self,
|
||||
config_file: str,
|
||||
rsi_limits_file: Optional[str] = None,
|
||||
enable_auto_reconnect: bool = False,
|
||||
auto_reconnect_retries: int = 5,
|
||||
auto_reconnect_delay: float = 5.0
|
||||
) -> None:
|
||||
|
||||
# Created shared metrics dict
|
||||
self.metrics_dict = self.manager.dict()
|
||||
|
||||
# Pass to NetworkProcess
|
||||
self.network_process = NetworkProcess(..., self.metrics_dict)
|
||||
|
||||
# Initialize auto-reconnect manager
|
||||
if enable_auto_reconnect:
|
||||
self.auto_reconnect_manager = AutoReconnectManager(
|
||||
client=self,
|
||||
enabled=True,
|
||||
max_retries=auto_reconnect_retries,
|
||||
retry_delay=auto_reconnect_delay,
|
||||
strategy=ReconnectStrategy.LINEAR_BACKOFF
|
||||
)
|
||||
|
||||
# In start() method
|
||||
if self.auto_reconnect_manager:
|
||||
self.auto_reconnect_manager.start()
|
||||
|
||||
# In stop() method
|
||||
if self.auto_reconnect_manager:
|
||||
self.auto_reconnect_manager.stop()
|
||||
```
|
||||
|
||||
### [src/RSIPI/diagnostics_api.py](rsi-pi/src/RSIPI/diagnostics_api.py)
|
||||
|
||||
**Fully implemented DiagnosticsAPI (was placeholder in Phase 5):**
|
||||
|
||||
- `get_stats()` - Comprehensive network and performance statistics
|
||||
- `get_timing()` - Timing-specific metrics (cycle time, jitter)
|
||||
- `get_network_quality()` - Network quality metrics (packet loss, IPOC gaps)
|
||||
- `is_healthy()` - Overall system health check
|
||||
- `get_warnings()` - Active warning messages
|
||||
- `check_watchdog()` - Watchdog timeout status
|
||||
- `format_stats()` - Human-readable statistics output
|
||||
|
||||
## Example Usage
|
||||
|
||||
### Basic Diagnostics
|
||||
|
||||
```python
|
||||
from RSIPI import RSIAPI
|
||||
|
||||
api = RSIAPI('RSI_EthernetConfig.xml')
|
||||
api.start()
|
||||
|
||||
# Check overall health
|
||||
if api.diagnostics.is_healthy():
|
||||
print("✅ Network healthy")
|
||||
else:
|
||||
print("⚠️ Network issues detected")
|
||||
for warning in api.diagnostics.get_warnings():
|
||||
print(f" - {warning}")
|
||||
|
||||
# Get timing metrics
|
||||
timing = api.diagnostics.get_timing()
|
||||
print(f"Mean cycle time: {timing['mean_cycle_time']*1000:.2f}ms")
|
||||
print(f"Jitter: {timing['jitter']*1000:.2f}ms")
|
||||
|
||||
# Get network quality
|
||||
network = api.diagnostics.get_network_quality()
|
||||
print(f"Packet loss: {network['packet_loss_rate']:.2f}%")
|
||||
print(f"IPOC gaps per 1000 cycles: {network['ipoc_gap_rate']:.1f}")
|
||||
|
||||
# Print formatted statistics
|
||||
print(api.diagnostics.format_stats())
|
||||
|
||||
api.stop()
|
||||
```
|
||||
|
||||
### Auto-Reconnection
|
||||
|
||||
```python
|
||||
from RSIPI import RSIAPI
|
||||
|
||||
# Enable auto-reconnection with unlimited retries
|
||||
api = RSIAPI(
|
||||
'RSI_EthernetConfig.xml',
|
||||
enable_auto_reconnect=True,
|
||||
auto_reconnect_retries=0, # 0 = unlimited
|
||||
auto_reconnect_delay=10.0 # 10 second initial delay
|
||||
)
|
||||
|
||||
api.start()
|
||||
|
||||
# Auto-reconnection will now handle any communication failures
|
||||
# Monitor will check watchdog every 2 seconds
|
||||
# Will attempt reconnection with linear backoff (10s, 20s, 30s, ...)
|
||||
|
||||
# Your application code here...
|
||||
|
||||
api.stop() # Stops auto-reconnect monitor gracefully
|
||||
```
|
||||
|
||||
### Custom Reconnection Callbacks
|
||||
|
||||
```python
|
||||
from RSIPI import RSIAPI
|
||||
from RSIPI.auto_reconnect import ReconnectStrategy
|
||||
|
||||
def on_reconnect_success():
|
||||
print("✅ Reconnected successfully!")
|
||||
# Re-initialize application state, restart trajectories, etc.
|
||||
|
||||
def on_reconnect_failure():
|
||||
print("❌ Reconnection failed after max retries")
|
||||
# Send alert, log failure, initiate shutdown, etc.
|
||||
|
||||
api = RSIAPI('RSI_EthernetConfig.xml')
|
||||
api.start()
|
||||
|
||||
# Manually configure auto-reconnect with callbacks
|
||||
from RSIPI.auto_reconnect import AutoReconnectManager
|
||||
api.auto_reconnect_manager = AutoReconnectManager(
|
||||
client=api,
|
||||
enabled=True,
|
||||
max_retries=10,
|
||||
retry_delay=5.0,
|
||||
strategy=ReconnectStrategy.EXPONENTIAL_BACKOFF,
|
||||
on_reconnect=on_reconnect_success,
|
||||
on_failure=on_reconnect_failure
|
||||
)
|
||||
api.auto_reconnect_manager.start()
|
||||
|
||||
# Your application code here...
|
||||
|
||||
api.auto_reconnect_manager.stop()
|
||||
api.stop()
|
||||
```
|
||||
|
||||
### Running Stability Test
|
||||
|
||||
**Quick 5-minute test:**
|
||||
```bash
|
||||
cd tests
|
||||
python stability_test.py --duration 0.083 --interval 10
|
||||
```
|
||||
|
||||
**1-hour test with custom config:**
|
||||
```bash
|
||||
python stability_test.py \
|
||||
--duration 1 \
|
||||
--config custom_config.xml \
|
||||
--interval 30 \
|
||||
--output results_1hr.json
|
||||
```
|
||||
|
||||
**Full 24-hour test:**
|
||||
```bash
|
||||
python stability_test.py \
|
||||
--duration 24 \
|
||||
--interval 60 \
|
||||
--output stability_24hr.json
|
||||
```
|
||||
|
||||
**Example output:**
|
||||
```
|
||||
=== RSI Stability Test ===
|
||||
Config: RSI_EthernetConfig.xml
|
||||
Duration: 1.0 hours
|
||||
Check interval: 30.0s
|
||||
Output: stability_test_20260117_103045.json
|
||||
==================================================
|
||||
Starting RSI communication...
|
||||
✅ RSI communication started successfully
|
||||
Test started at 2026-01-17 10:30:45
|
||||
Will run until 2026-01-17 11:30:45
|
||||
✅ Progress: 8.3% | Elapsed: 0.08h | Remaining: 0.92h | Samples: 6 | Jitter: 0.45ms | Loss: 0.00%
|
||||
✅ Progress: 16.7% | Elapsed: 0.17h | Remaining: 0.83h | Samples: 12 | Jitter: 0.52ms | Loss: 0.00%
|
||||
...
|
||||
✅ Progress: 100.0% | Elapsed: 1.00h | Remaining: 0.00h | Samples: 120 | Jitter: 0.48ms | Loss: 0.01%
|
||||
|
||||
=== Test Complete ===
|
||||
Stopping RSI communication...
|
||||
Generating report...
|
||||
✅ Report saved to: stability_test_20260117_103045.json
|
||||
|
||||
============================================================
|
||||
STABILITY TEST SUMMARY
|
||||
============================================================
|
||||
|
||||
Test Duration: 1.00 hours
|
||||
Total Samples: 120
|
||||
|
||||
Health: 100.0% healthy
|
||||
Healthy samples: 120
|
||||
Unhealthy samples: 0
|
||||
|
||||
Timing Performance:
|
||||
Mean cycle time: 4.12ms
|
||||
Cycle time range: 3.85 - 4.42ms
|
||||
Mean jitter: 0.48ms
|
||||
Max jitter: 0.85ms
|
||||
|
||||
Network Quality:
|
||||
Mean packet loss: 0.008%
|
||||
Max packet loss: 0.040%
|
||||
|
||||
Overall Result: ✅ PASS
|
||||
============================================================
|
||||
```
|
||||
|
||||
## Metrics Tracked
|
||||
|
||||
### Timing Metrics
|
||||
|
||||
| Metric | Description | Units |
|
||||
|--------|-------------|-------|
|
||||
| `mean_cycle_time` | Average time between packets | seconds |
|
||||
| `std_cycle_time` | Standard deviation of cycle time | seconds |
|
||||
| `min_cycle_time` | Minimum cycle time observed | seconds |
|
||||
| `max_cycle_time` | Maximum cycle time observed | seconds |
|
||||
| `jitter` | Cycle time variance (std_dev) | seconds |
|
||||
|
||||
### Network Quality Metrics
|
||||
|
||||
| Metric | Description | Units |
|
||||
|--------|-------------|-------|
|
||||
| `packet_loss_rate` | Percentage of packets lost | percent |
|
||||
| `ipoc_gap_rate` | IPOC gaps per 1000 cycles | gaps/1000 cycles |
|
||||
| `total_cycles` | Total communication cycles | count |
|
||||
| `total_packets_lost` | Total packets lost | count |
|
||||
| `total_ipoc_gaps` | Total IPOC discontinuities | count |
|
||||
|
||||
### Health Indicators
|
||||
|
||||
| Indicator | Threshold | Description |
|
||||
|-----------|-----------|-------------|
|
||||
| `is_healthy` | All checks pass | Overall system health |
|
||||
| `watchdog_timeout` | >1 second | Communication timeout detected |
|
||||
| High jitter | >2ms | Excessive timing variance |
|
||||
| High packet loss | >1% | Network reliability issue |
|
||||
| High cycle time | >6ms (1.5x expected) | Performance degradation |
|
||||
|
||||
## Health Thresholds
|
||||
|
||||
The system is considered **healthy** when:
|
||||
- No watchdog timeout (packets received within last 1 second)
|
||||
- Jitter < 2ms (timing variance acceptable)
|
||||
- Packet loss < 1% (minimal data loss)
|
||||
- Mean cycle time < 6ms (within 1.5x expected 4ms)
|
||||
|
||||
Violations of any threshold trigger:
|
||||
- Warning messages in log
|
||||
- `is_healthy()` returns False
|
||||
- Warning list populated with specific issues
|
||||
|
||||
## Performance Impact
|
||||
|
||||
**Timing Metrics Collection:**
|
||||
- Per-cycle overhead: ~10 microseconds (timestamp + IPOC append)
|
||||
- Shared dict update: Every 100 cycles (~400ms) to minimize overhead
|
||||
- Total impact: <0.1% on 250Hz real-time loop
|
||||
- No GIL contention (metrics calculated in NetworkProcess)
|
||||
|
||||
**Auto-Reconnection Monitoring:**
|
||||
- Background thread sleeps 2 seconds between checks
|
||||
- Reconnection attempt: ~3-5 seconds (stop, wait, start, verify)
|
||||
- Zero impact during normal operation (thread sleeping)
|
||||
|
||||
## Architecture Details
|
||||
|
||||
### Multiprocessing Design
|
||||
|
||||
```
|
||||
Main Process (RSIAPI)
|
||||
├── Manager.dict() (shared metrics_dict)
|
||||
├── RSIClient
|
||||
│ ├── AutoReconnectManager (if enabled)
|
||||
│ │ └── Background Thread (monitors watchdog every 2s)
|
||||
│ └── NetworkProcess (separate process)
|
||||
│ ├── TimingMetrics
|
||||
│ │ ├── Records IPOC + timestamp each cycle
|
||||
│ │ └── Updates shared dict every 100 cycles
|
||||
│ └── UDP Communication Loop (250Hz)
|
||||
└── DiagnosticsAPI
|
||||
└── Reads from shared metrics_dict
|
||||
```
|
||||
|
||||
**Key Design Decisions:**
|
||||
1. **Separate Process for Network**: Avoids Python GIL, guarantees real-time performance
|
||||
2. **Shared Manager.dict()**: Inter-process communication for metrics
|
||||
3. **Batched Updates**: Only update shared dict every 100 cycles to minimize overhead
|
||||
4. **Deferred Statistics**: Heavy calculations (mean, stdev) done on-demand, not per-cycle
|
||||
|
||||
## Migration Notes
|
||||
|
||||
### No Breaking Changes
|
||||
|
||||
Phase 2 is **fully backward compatible** with Phase 1 & 5 API:
|
||||
|
||||
- All existing code continues to work without modification
|
||||
- Auto-reconnection is opt-in via constructor parameter
|
||||
- DiagnosticsAPI methods are new additions (no conflicts)
|
||||
|
||||
### Opt-In Auto-Reconnection
|
||||
|
||||
```python
|
||||
# Old code (still works, no auto-reconnect)
|
||||
api = RSIAPI('RSI_EthernetConfig.xml')
|
||||
|
||||
# New code (with auto-reconnect)
|
||||
api = RSIAPI(
|
||||
'RSI_EthernetConfig.xml',
|
||||
enable_auto_reconnect=True,
|
||||
auto_reconnect_retries=0, # unlimited
|
||||
auto_reconnect_delay=5.0
|
||||
)
|
||||
```
|
||||
|
||||
## Benefits of Phase 2
|
||||
|
||||
1. **Production-Ready Reliability**: Automatic recovery from network failures
|
||||
2. **Real-Time Diagnostics**: Comprehensive metrics without performance impact
|
||||
3. **Early Warning System**: Detect network degradation before failures occur
|
||||
4. **Validation Infrastructure**: 24-hour stability testing for production deployments
|
||||
5. **Research Quality**: Publication-ready performance metrics and analysis
|
||||
|
||||
## Phase 2 Status: ✅ COMPLETE
|
||||
|
||||
All planned features have been implemented:
|
||||
- ✅ Timing instrumentation (latency, jitter, cycle time tracking)
|
||||
- ✅ Watchdog timer for communication loss detection
|
||||
- ✅ Network quality monitoring (packet loss, IPOC gaps)
|
||||
- ✅ CSV logging optimization (batched updates)
|
||||
- ✅ Auto-reconnection with graceful recovery
|
||||
- ✅ 24-hour stability test infrastructure
|
||||
|
||||
## Next Steps
|
||||
|
||||
### Immediate Actions
|
||||
1. Run actual 24-hour stability test with real robot hardware
|
||||
2. Collect performance metrics for publication
|
||||
3. Document any issues discovered during long-duration testing
|
||||
|
||||
### Phase 3: KRL Coordination (Upcoming)
|
||||
- High-level Digital I/O API (set_output, get_input, pulse)
|
||||
- KRL state coordination helpers (wait_for_signal, signal_complete)
|
||||
- Parameter passing via Tech variables
|
||||
- KRL code templates for coordination scenarios
|
||||
- Enhanced inject_rsi_to_krl with coordination boilerplate
|
||||
|
||||
The `api.io` and `api.krl` namespaces will be enhanced with Python-KRL coordination features to enable seamless bidirectional communication between RSIPI and KRL programs.
|
||||
|
||||
## Commits
|
||||
|
||||
- `6e8ea2e` - Implement Phase 2: Network Reliability and Diagnostics (January 17, 2026)
|
||||
- Created timing_metrics.py with TimingMetrics and NetworkQualityMonitor
|
||||
- Integrated metrics into network_handler.py real-time loop
|
||||
- Updated rsi_client.py with shared metrics dictionary
|
||||
- Fully implemented diagnostics_api.py
|
||||
|
||||
- `bb65500` - Complete Phase 2: Auto-reconnection and stability testing (January 17, 2026)
|
||||
- Created auto_reconnect.py with AutoReconnectManager
|
||||
- Integrated auto-reconnect into rsi_client.py
|
||||
- Created tests/stability_test.py for long-duration testing
|
||||
|
||||
- `edca436` - Update ROADMAP: Mark Phase 2 as complete (January 17, 2026)
|
||||
- Updated roadmap status, timeline, and success criteria
|
||||
@ -1,761 +0,0 @@
|
||||
# Phase 4: Advanced Motion Control - Implementation Summary
|
||||
|
||||
**Date**: January 17, 2026
|
||||
**Phase**: 4 of 6
|
||||
**Status**: ✅ Complete
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Phase 4 adds professional-grade motion planning capabilities to RSIPI, enabling industrial applications requiring complex trajectories, optimized timing, and flexible coordinate systems. This phase focuses on trajectory generation, velocity profiling, geometric primitives, path blending, and coordinate transformations.
|
||||
|
||||
## What Was Implemented
|
||||
|
||||
### 1. Velocity Profiling
|
||||
|
||||
**File**: `src/RSIPI/motion_api.py`
|
||||
|
||||
**New Method**: `generate_velocity_profile()`
|
||||
|
||||
Generate time-optimal velocity profiles for trajectory execution with configurable acceleration limits.
|
||||
|
||||
```python
|
||||
profiled_trajectory = api.motion.generate_velocity_profile(
|
||||
trajectory=waypoints,
|
||||
max_velocity=200.0, # mm/s
|
||||
max_acceleration=500.0, # mm/s²
|
||||
profile='trapezoidal' # or 's-curve'
|
||||
)
|
||||
|
||||
# Returns: List[Tuple[Dict[str, float], float]]
|
||||
# Each element: (waypoint, time_delta)
|
||||
```
|
||||
|
||||
**Features**:
|
||||
- **Trapezoidal Profile**: Bang-bang acceleration with constant velocity cruise phase
|
||||
- Fast point-to-point motion
|
||||
- Time-optimal for given velocity/acceleration limits
|
||||
- Suitable for pick-and-place, navigation
|
||||
|
||||
- **S-Curve Profile**: Jerk-limited smooth acceleration transitions
|
||||
- Reduced mechanical stress and vibration
|
||||
- Smooth motion for delicate operations
|
||||
- Better for assembly, inspection, coating
|
||||
|
||||
**Implementation**:
|
||||
- Calculates Euclidean distances between waypoints
|
||||
- Determines acceleration, constant velocity, and deceleration phases
|
||||
- Handles both full trapezoidal and triangular (short distance) profiles
|
||||
- S-curve uses sine function for smooth jerk limiting
|
||||
- Returns trajectory with precise timing for each waypoint
|
||||
|
||||
---
|
||||
|
||||
### 2. Geometric Motion Primitives
|
||||
|
||||
**File**: `src/RSIPI/motion_api.py`
|
||||
|
||||
#### 2.1 Arc Generation
|
||||
|
||||
**New Method**: `generate_arc()`
|
||||
|
||||
Generate circular arc trajectories in specified planes.
|
||||
|
||||
```python
|
||||
arc = api.motion.generate_arc(
|
||||
center={"X": 100, "Y": 0, "Z": 500},
|
||||
radius=50.0,
|
||||
start_angle=0, # degrees
|
||||
end_angle=90, # degrees
|
||||
steps=50,
|
||||
plane='XY' # or 'XZ', 'YZ'
|
||||
)
|
||||
```
|
||||
|
||||
**Features**:
|
||||
- Partial circular arcs (any start/end angle)
|
||||
- Multiple plane support (XY, XZ, YZ)
|
||||
- Preserves orientation (A, B, C) from center point
|
||||
- Configurable point density
|
||||
|
||||
**Use Cases**:
|
||||
- Curved approach paths
|
||||
- Obstacle avoidance
|
||||
- Rounded corners in machining
|
||||
- Smooth insertion trajectories
|
||||
|
||||
#### 2.2 Circle Generation
|
||||
|
||||
**New Method**: `generate_circle()`
|
||||
|
||||
Generate complete 360° circular trajectories.
|
||||
|
||||
```python
|
||||
circle = api.motion.generate_circle(
|
||||
center={"X": 100, "Y": 0, "Z": 500},
|
||||
radius=30.0,
|
||||
steps=100,
|
||||
plane='XY'
|
||||
)
|
||||
```
|
||||
|
||||
**Features**:
|
||||
- Full circle trajectory (0° to 360°)
|
||||
- Automatically closes loop
|
||||
- Same plane support as arcs
|
||||
- Optimized for continuous motion
|
||||
|
||||
**Use Cases**:
|
||||
- Circular scanning/inspection
|
||||
- Screw driving patterns
|
||||
- Bore polishing
|
||||
- Circular welds
|
||||
|
||||
#### 2.3 Spiral Generation
|
||||
|
||||
**New Method**: `generate_spiral()`
|
||||
|
||||
Generate expanding or contracting spiral trajectories with configurable pitch.
|
||||
|
||||
```python
|
||||
# Expanding spiral (drilling)
|
||||
spiral_expand = api.motion.generate_spiral(
|
||||
center={"X": 100, "Y": 0, "Z": 500},
|
||||
start_radius=5.0,
|
||||
end_radius=40.0,
|
||||
pitch=10.0, # mm per revolution (positive = descending)
|
||||
revolutions=3.0,
|
||||
steps=150,
|
||||
plane='XY',
|
||||
axis='Z'
|
||||
)
|
||||
|
||||
# Contracting spiral (retraction)
|
||||
spiral_contract = api.motion.generate_spiral(
|
||||
center={"X": 100, "Y": 0, "Z": 470},
|
||||
start_radius=40.0,
|
||||
end_radius=5.0,
|
||||
pitch=-10.0, # negative = ascending
|
||||
revolutions=3.0,
|
||||
steps=150,
|
||||
plane='XY',
|
||||
axis='Z'
|
||||
)
|
||||
```
|
||||
|
||||
**Features**:
|
||||
- Variable radius (expanding or contracting)
|
||||
- Configurable pitch (positive/negative for descending/ascending)
|
||||
- Multiple plane and axis combinations
|
||||
- Continuous motion from start to end
|
||||
|
||||
**Use Cases**:
|
||||
- **Expanding**: Hole drilling, pocket milling, large hole boring
|
||||
- **Contracting**: Tool retraction from deep holes, spiral unwinding
|
||||
- **Constant radius + pitch**: Thread cutting, helical scanning
|
||||
- **Variable radius + no pitch**: Spiral inspection patterns
|
||||
|
||||
---
|
||||
|
||||
### 3. Path Blending
|
||||
|
||||
**File**: `src/RSIPI/motion_api.py`
|
||||
|
||||
**New Method**: `blend_trajectories()`
|
||||
|
||||
Create smooth transitions between trajectories using cubic Hermite spline interpolation.
|
||||
|
||||
```python
|
||||
traj1 = api.motion.generate_trajectory(p0, p1, steps=50)
|
||||
traj2 = api.motion.generate_trajectory(p1, p2, steps=50)
|
||||
|
||||
blended = api.motion.blend_trajectories(
|
||||
traj1=traj1,
|
||||
traj2=traj2,
|
||||
blend_radius=20.0, # Start blending 20mm before corner
|
||||
blend_steps=20 # Interpolation points in blend zone
|
||||
)
|
||||
```
|
||||
|
||||
**Features**:
|
||||
- Cubic interpolation for smooth velocity transitions
|
||||
- Configurable blend zone radius
|
||||
- Handles position and orientation blending
|
||||
- Eliminates stop-and-go at trajectory junctions
|
||||
|
||||
**Implementation**:
|
||||
- Automatically finds blend points based on radius
|
||||
- Uses cubic Hermite spline with zero endpoint velocities
|
||||
- Interpolates all axes (X, Y, Z, A, B, C, A1-A6)
|
||||
- Preserves trajectory before/after blend zones
|
||||
|
||||
**Benefits**:
|
||||
- **Reduced cycle time**: Eliminates stops at corners
|
||||
- **Better quality**: No witness marks in welding/machining
|
||||
- **Mechanical benefits**: Lower stress, reduced vibration
|
||||
- **Consistent process**: Constant velocity through transitions
|
||||
|
||||
---
|
||||
|
||||
### 4. Coordinate Frame Transformations
|
||||
|
||||
**File**: `src/RSIPI/motion_api.py`
|
||||
|
||||
**New Method**: `transform_coordinates()`
|
||||
|
||||
Transform poses between different coordinate frames with configurable offsets.
|
||||
|
||||
```python
|
||||
work_offset = {
|
||||
"X": 500.0,
|
||||
"Y": -200.0,
|
||||
"Z": 50.0,
|
||||
"A": 0.0,
|
||||
"B": 0.0,
|
||||
"C": 15.0
|
||||
}
|
||||
|
||||
pose_base = api.motion.transform_coordinates(
|
||||
pose={"X": 100, "Y": 50, "Z": 30},
|
||||
from_frame='WORK',
|
||||
to_frame='BASE',
|
||||
frame_offset=work_offset
|
||||
)
|
||||
```
|
||||
|
||||
**Supported Frames**:
|
||||
- `'BASE'`: Robot base coordinate system
|
||||
- `'WORLD'`: Global world coordinates
|
||||
- `'TOOL'`: Tool center point (TCP)
|
||||
- `'WORK'`: Work object (pallet/fixture)
|
||||
- `'ROBROOT'`: Robot root system
|
||||
|
||||
**Features**:
|
||||
- Position transformation (X, Y, Z)
|
||||
- Orientation transformation (A, B, C)
|
||||
- Joint angle transformation (A1-A6)
|
||||
- Simple translational and rotational offsets
|
||||
|
||||
**Use Cases**:
|
||||
- **Multiple work objects**: Teach once, execute anywhere by changing offset
|
||||
- **Tool changes**: Adapt taught positions for different tool lengths
|
||||
- **Vision integration**: Apply sensor corrections to taught trajectories
|
||||
- **Multi-robot cells**: Coordinate motion in shared workspace
|
||||
|
||||
---
|
||||
|
||||
## Examples Created
|
||||
|
||||
All examples are production-ready with comprehensive logging, error handling, and argparse CLI.
|
||||
|
||||
### 01_velocity_profiles.py (234 lines)
|
||||
|
||||
Demonstrates trapezoidal vs S-curve velocity profiling.
|
||||
|
||||
**Key Examples**:
|
||||
- Trapezoidal profile for fast point-to-point motion
|
||||
- S-curve profile for smooth motion
|
||||
- Velocity sampling at different trajectory points
|
||||
- Comparison of motion characteristics
|
||||
|
||||
**Run**: `python 01_velocity_profiles.py --config RSI_EthernetConfig.xml`
|
||||
|
||||
---
|
||||
|
||||
### 02_geometric_primitives.py (225 lines)
|
||||
|
||||
Demonstrates arc, circle, and spiral generation.
|
||||
|
||||
**Key Examples**:
|
||||
1. Circular arc (90°)
|
||||
2. Full circle (360°)
|
||||
3. Expanding spiral (drilling pattern)
|
||||
4. Contracting spiral (retraction pattern)
|
||||
5. Circles in different planes (XY, XZ, YZ)
|
||||
|
||||
**Run**: `python 02_geometric_primitives.py --config RSI_EthernetConfig.xml`
|
||||
|
||||
---
|
||||
|
||||
### 03_path_blending.py (253 lines)
|
||||
|
||||
Demonstrates smooth trajectory transitions.
|
||||
|
||||
**Key Examples**:
|
||||
1. Sharp corner vs blended corner comparison
|
||||
2. Continuous path with multiple blends (square pattern)
|
||||
3. Different blend radii effects
|
||||
4. Blending with orientation changes
|
||||
|
||||
**Run**: `python 03_path_blending.py --config RSI_EthernetConfig.xml`
|
||||
|
||||
---
|
||||
|
||||
### 04_coordinate_transforms.py (284 lines)
|
||||
|
||||
Demonstrates coordinate frame transformations.
|
||||
|
||||
**Key Examples**:
|
||||
1. BASE to WORLD transformation
|
||||
2. TOOL frame offset (TCP calibration)
|
||||
3. Transforming entire trajectories
|
||||
4. Work object (pallet) transformation
|
||||
5. Sensor-guided motion with corrections
|
||||
|
||||
**Run**: `python 04_coordinate_transforms.py --config RSI_EthernetConfig.xml`
|
||||
|
||||
---
|
||||
|
||||
### 05_combined_motion.py (336 lines)
|
||||
|
||||
Complete production application combining all Phase 4 features.
|
||||
|
||||
**Application**: Automated drilling and inspection workflow
|
||||
|
||||
**Flow**:
|
||||
1. Navigate to inspection position (blended, S-curve, 300mm/s)
|
||||
2. Spiral inspection pattern (S-curve, 50mm/s)
|
||||
3. Navigate to drilling position (blended, trapezoidal, 250mm/s)
|
||||
4. Expanding spiral drilling (S-curve, 30mm/s, descending)
|
||||
5. Return to home (blended, trapezoidal, 350mm/s)
|
||||
|
||||
**Features Used**:
|
||||
- ✅ Coordinate transformations (work object & tool)
|
||||
- ✅ Path blending (smooth navigation)
|
||||
- ✅ Velocity profiling (optimized speeds)
|
||||
- ✅ Geometric primitives (spiral patterns)
|
||||
|
||||
**Run**: `python 05_combined_motion.py --config RSI_EthernetConfig.xml`
|
||||
|
||||
---
|
||||
|
||||
### README.md (584 lines)
|
||||
|
||||
Comprehensive documentation for advanced_motion examples.
|
||||
|
||||
**Sections**:
|
||||
- Prerequisites and setup
|
||||
- Example descriptions and usage
|
||||
- API reference with code examples
|
||||
- Customization guide
|
||||
- Troubleshooting
|
||||
- Advanced usage patterns
|
||||
- Performance optimization tips
|
||||
|
||||
---
|
||||
|
||||
## Technical Implementation Details
|
||||
|
||||
### Helper Functions Added
|
||||
|
||||
**File**: `src/RSIPI/motion_api.py`
|
||||
|
||||
```python
|
||||
def _calculate_distance(p1: Dict[str, float], p2: Dict[str, float]) -> float:
|
||||
"""Calculate Euclidean distance between waypoints."""
|
||||
# Handles X, Y, Z, A1-A6 coordinates
|
||||
|
||||
def _trapezoidal_profile(distances, total_distance, max_velocity, max_acceleration):
|
||||
"""Generate trapezoidal velocity profile."""
|
||||
# Accelerate → constant → decelerate
|
||||
# Handles both full trapezoidal and triangular profiles
|
||||
|
||||
def _s_curve_profile(distances, total_distance, max_velocity, max_acceleration):
|
||||
"""Generate S-curve velocity profile."""
|
||||
# Smooth jerk-limited acceleration using sine function
|
||||
|
||||
def _find_blend_point(trajectory, blend_radius, from_end=False) -> int:
|
||||
"""Find trajectory index at specified distance from start/end."""
|
||||
# Used to locate blend zone boundaries
|
||||
|
||||
def _cubic_blend(p1, p2, steps) -> List[Dict[str, float]]:
|
||||
"""Generate cubic Hermite spline interpolation."""
|
||||
# Smooth transition with zero velocity at endpoints
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Code Quality
|
||||
|
||||
### Imports Added
|
||||
|
||||
```python
|
||||
import math
|
||||
import numpy as np
|
||||
from typing import Dict, List, Any, Optional, Tuple, TYPE_CHECKING
|
||||
```
|
||||
|
||||
### Documentation
|
||||
|
||||
- All new methods have comprehensive docstrings
|
||||
- Detailed parameter descriptions
|
||||
- Return value specifications
|
||||
- Usage examples in docstrings
|
||||
- Real-world application scenarios
|
||||
|
||||
### Error Handling
|
||||
|
||||
- Validates input parameters
|
||||
- Checks for divide-by-zero conditions
|
||||
- Handles edge cases (short trajectories, zero radius, etc.)
|
||||
- Provides meaningful error messages
|
||||
|
||||
---
|
||||
|
||||
## Files Modified
|
||||
|
||||
### src/RSIPI/motion_api.py
|
||||
- **Lines added**: ~550
|
||||
- **New methods**: 5 public static methods
|
||||
- **New helpers**: 4 private helper functions
|
||||
- **Documentation**: Comprehensive docstrings for all new methods
|
||||
|
||||
---
|
||||
|
||||
## Files Created
|
||||
|
||||
### examples/advanced_motion/
|
||||
- `01_velocity_profiles.py` (234 lines)
|
||||
- `02_geometric_primitives.py` (225 lines)
|
||||
- `03_path_blending.py` (253 lines)
|
||||
- `04_coordinate_transforms.py` (284 lines)
|
||||
- `05_combined_motion.py` (336 lines)
|
||||
- `README.md` (584 lines)
|
||||
|
||||
**Total**: 1,916 lines of examples and documentation
|
||||
|
||||
---
|
||||
|
||||
## Usage Patterns
|
||||
|
||||
### Basic Velocity Profiling
|
||||
|
||||
```python
|
||||
# Generate trajectory
|
||||
trajectory = api.motion.generate_trajectory(p0, p1, steps=100)
|
||||
|
||||
# Apply velocity profile
|
||||
profiled = api.motion.generate_velocity_profile(
|
||||
trajectory,
|
||||
max_velocity=200.0,
|
||||
max_acceleration=500.0,
|
||||
profile='s-curve'
|
||||
)
|
||||
|
||||
# Execute with precise timing
|
||||
for waypoint, dt in profiled:
|
||||
api.motion.update_cartesian(**waypoint)
|
||||
time.sleep(dt)
|
||||
```
|
||||
|
||||
### Geometric Primitives
|
||||
|
||||
```python
|
||||
# Generate drilling pattern
|
||||
spiral = api.motion.generate_spiral(
|
||||
center={"X": 100, "Y": 0, "Z": 500},
|
||||
start_radius=5.0,
|
||||
end_radius=40.0,
|
||||
pitch=10.0,
|
||||
revolutions=3.0,
|
||||
steps=150,
|
||||
plane='XY',
|
||||
axis='Z'
|
||||
)
|
||||
|
||||
# Execute
|
||||
api.motion.execute_trajectory(spiral, space='cartesian', rate=0.02)
|
||||
```
|
||||
|
||||
### Path Blending
|
||||
|
||||
```python
|
||||
# Generate segments
|
||||
seg1 = api.motion.generate_trajectory(p0, p1, steps=50)
|
||||
seg2 = api.motion.generate_trajectory(p1, p2, steps=50)
|
||||
|
||||
# Blend for smooth transition
|
||||
blended = api.motion.blend_trajectories(
|
||||
seg1, seg2,
|
||||
blend_radius=20.0,
|
||||
blend_steps=20
|
||||
)
|
||||
|
||||
# Execute continuous motion
|
||||
api.motion.execute_trajectory(blended, space='cartesian', rate=0.02)
|
||||
```
|
||||
|
||||
### Coordinate Transformations
|
||||
|
||||
```python
|
||||
# Define work object offset
|
||||
pallet_offset = {
|
||||
"X": 800.0,
|
||||
"Y": -300.0,
|
||||
"Z": 50.0,
|
||||
"A": 0.0,
|
||||
"B": 0.0,
|
||||
"C": 30.0
|
||||
}
|
||||
|
||||
# Transform position
|
||||
pick_point_pallet = {"X": 50, "Y": 50, "Z": 20}
|
||||
pick_point_base = api.motion.transform_coordinates(
|
||||
pick_point_pallet,
|
||||
from_frame='WORK',
|
||||
to_frame='BASE',
|
||||
frame_offset=pallet_offset
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Production Applications
|
||||
|
||||
### Drilling and Milling
|
||||
- Expanding spirals for hole boring and pocket milling
|
||||
- Optimized feed rates with velocity profiling
|
||||
- Smooth retractions with contracting spirals
|
||||
|
||||
### Assembly
|
||||
- Circular insertion paths with clearance
|
||||
- Smooth approach trajectories with blending
|
||||
- Flexible part placement with coordinate transforms
|
||||
|
||||
### Inspection
|
||||
- Spiral scanning patterns for large areas
|
||||
- Circular scanning of features
|
||||
- Consistent scanning speed with velocity profiling
|
||||
|
||||
### Welding and Coating
|
||||
- Continuous beads at corners (no stop marks)
|
||||
- Consistent deposition rate with velocity control
|
||||
- Smooth transitions between weld segments
|
||||
|
||||
### Pick and Place
|
||||
- Reduced cycle time with blended paths
|
||||
- Optimized acceleration profiles
|
||||
- Multiple work objects with coordinate transforms
|
||||
|
||||
---
|
||||
|
||||
## Performance Characteristics
|
||||
|
||||
### Trajectory Generation Speed
|
||||
- **Arcs/Circles**: O(n) where n = steps
|
||||
- **Spirals**: O(n) where n = steps
|
||||
- **Blending**: O(n₁ + n₂) where n₁, n₂ = trajectory lengths
|
||||
- **Transforms**: O(1) per point
|
||||
|
||||
### Memory Usage
|
||||
- Trajectories stored as list of dictionaries
|
||||
- Memory scales linearly with number of waypoints
|
||||
- Typical trajectory (100 waypoints): ~10KB
|
||||
|
||||
### Real-Time Performance
|
||||
- Coordinate transforms: <0.1ms per point
|
||||
- Velocity profiling: <10ms for 100-point trajectory
|
||||
- Path blending: <50ms for typical blend zone
|
||||
- Suitable for offline trajectory generation
|
||||
|
||||
---
|
||||
|
||||
## Integration with Existing RSIPI
|
||||
|
||||
Phase 4 methods integrate seamlessly with existing RSIPI functionality:
|
||||
|
||||
```python
|
||||
# Generate complex trajectory with Phase 4
|
||||
trajectory = api.motion.generate_circle(...)
|
||||
|
||||
# Apply velocity profile (Phase 4)
|
||||
profiled = api.motion.generate_velocity_profile(trajectory, ...)
|
||||
|
||||
# Execute with existing Phase 1-3 methods
|
||||
for waypoint, dt in profiled:
|
||||
api.motion.update_cartesian(**waypoint) # Phase 1
|
||||
time.sleep(dt)
|
||||
|
||||
# Or use convenience method
|
||||
api.motion.execute_trajectory(trajectory, ...) # Phase 2
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Testing and Validation
|
||||
|
||||
### Manual Testing
|
||||
- All examples tested with simulated robot controller
|
||||
- Trajectory generation verified for correctness
|
||||
- Velocity profiles validated against kinematic limits
|
||||
- Coordinate transforms checked with known test cases
|
||||
|
||||
### Edge Cases Handled
|
||||
- Zero radius circles/spirals
|
||||
- Zero blend radius
|
||||
- Very short trajectories
|
||||
- Single-point trajectories
|
||||
- Identical start/end points
|
||||
|
||||
---
|
||||
|
||||
## Future Enhancements (Not in Phase 4)
|
||||
|
||||
Potential additions for future phases:
|
||||
|
||||
1. **Advanced Velocity Profiling**
|
||||
- Velocity constraints per axis
|
||||
- Velocity-dependent acceleration limits
|
||||
- Look-ahead optimization
|
||||
|
||||
2. **More Geometric Primitives**
|
||||
- Ellipses and elliptical arcs
|
||||
- B-splines and Bézier curves
|
||||
- Helical paths
|
||||
- Lissajous curves
|
||||
|
||||
3. **Advanced Blending**
|
||||
- Multi-segment blending (blend through multiple points)
|
||||
- Velocity-dependent blend radius
|
||||
- Orientation-specific blend control
|
||||
|
||||
4. **Full 6-DOF Transformations**
|
||||
- Complete rotation matrix support
|
||||
- Quaternion-based rotations
|
||||
- Denavit-Hartenberg transformations
|
||||
|
||||
5. **Trajectory Optimization**
|
||||
- Time-optimal trajectory planning
|
||||
- Energy-optimal paths
|
||||
- Obstacle avoidance
|
||||
|
||||
---
|
||||
|
||||
## Compatibility
|
||||
|
||||
### Python Version
|
||||
- Requires Python 3.7+ (for type hints)
|
||||
- Uses `Dict` and `List` from `typing` module
|
||||
|
||||
### Dependencies
|
||||
- `numpy`: Used for array operations in helpers
|
||||
- `math`: Used for trigonometric functions
|
||||
- All dependencies already in RSIPI requirements
|
||||
|
||||
### RSI Configuration
|
||||
- Requires Cartesian corrections (RKorr) configured
|
||||
- No additional RSI XML changes needed
|
||||
- Compatible with existing RSI 3.3 setup
|
||||
|
||||
---
|
||||
|
||||
## Documentation
|
||||
|
||||
### Code Documentation
|
||||
- ✅ Comprehensive docstrings for all new methods
|
||||
- ✅ Parameter descriptions with types and units
|
||||
- ✅ Return value specifications
|
||||
- ✅ Usage examples in docstrings
|
||||
|
||||
### Example Documentation
|
||||
- ✅ 5 complete example programs
|
||||
- ✅ Comprehensive README.md (584 lines)
|
||||
- ✅ Inline comments in complex sections
|
||||
- ✅ Real-world application scenarios
|
||||
|
||||
### User Documentation
|
||||
- ✅ API reference in README
|
||||
- ✅ Customization guide
|
||||
- ✅ Troubleshooting section
|
||||
- ✅ Performance optimization tips
|
||||
|
||||
---
|
||||
|
||||
## Lessons Learned
|
||||
|
||||
### Design Decisions
|
||||
|
||||
1. **Velocity Profiling Returns Tuples**
|
||||
- Allows precise timing control per waypoint
|
||||
- User can choose to ignore timing if not needed
|
||||
- Flexible for different execution strategies
|
||||
|
||||
2. **Simple Coordinate Transforms**
|
||||
- Chose translational + rotational offsets over full transformation matrices
|
||||
- Sufficient for 90% of RSI applications
|
||||
- Easier to understand and use
|
||||
- Can be extended later if needed
|
||||
|
||||
3. **Static Methods in MotionAPI**
|
||||
- Trajectory generation doesn't require API instance
|
||||
- Can be used for offline planning
|
||||
- Consistent with existing RSIPI architecture
|
||||
|
||||
4. **Cubic Hermite Spline for Blending**
|
||||
- Zero velocity at endpoints ensures smooth transitions
|
||||
- Simpler than quintic splines
|
||||
- Sufficient for industrial applications
|
||||
|
||||
### Implementation Insights
|
||||
|
||||
1. **Edge Case Handling**
|
||||
- Short trajectories need special handling in velocity profiling
|
||||
- Blend radius must be validated against trajectory length
|
||||
- Zero-radius cases need explicit checks
|
||||
|
||||
2. **Performance Trade-offs**
|
||||
- More waypoints = smoother motion but longer generation time
|
||||
- Typical industrial applications: 50-200 waypoints is optimal
|
||||
- S-curve profiling is ~2x slower than trapezoidal but worth it
|
||||
|
||||
3. **Coordinate System Conventions**
|
||||
- KUKA RSI uses right-handed coordinate systems
|
||||
- Rotations follow KUKA's A, B, C convention
|
||||
- Important to document frame assumptions clearly
|
||||
|
||||
---
|
||||
|
||||
## Statistics
|
||||
|
||||
### Code Metrics
|
||||
- **New lines of code**: ~550 (motion_api.py)
|
||||
- **Example code**: ~1,332 lines
|
||||
- **Documentation**: ~584 lines (README.md)
|
||||
- **Total additions**: ~2,466 lines
|
||||
|
||||
### Method Counts
|
||||
- **New public methods**: 5
|
||||
- **New helper functions**: 4
|
||||
- **Total API methods**: 9 (including helpers)
|
||||
|
||||
### Example Counts
|
||||
- **Example programs**: 5
|
||||
- **Total examples**: 43 (across all examples)
|
||||
- **Application scenarios**: 15+
|
||||
|
||||
---
|
||||
|
||||
## Next Phase
|
||||
|
||||
Phase 4 is now complete. The next phase in the roadmap is:
|
||||
|
||||
**Phase 6: Testing and Documentation**
|
||||
- Comprehensive unit tests for all methods
|
||||
- Integration tests with simulated robot
|
||||
- API documentation generation
|
||||
- User guide and tutorials
|
||||
|
||||
---
|
||||
|
||||
## Conclusion
|
||||
|
||||
Phase 4 successfully adds professional-grade motion planning capabilities to RSIPI. The implementation provides industrial-quality trajectory generation, velocity optimization, geometric primitives, path smoothing, and coordinate transformations suitable for production applications.
|
||||
|
||||
All features are well-documented, thoroughly tested with examples, and integrate seamlessly with existing RSIPI functionality. The phase is complete and ready for production use.
|
||||
|
||||
---
|
||||
|
||||
**Phase 4 Status**: ✅ **COMPLETE**
|
||||
|
||||
**Completion Date**: January 17, 2026
|
||||
39
README.md
39
README.md
@ -1,7 +1,7 @@
|
||||
# RSIPI: Robot Sensor Interface for Python
|
||||
|
||||
[](https://www.python.org/downloads/)
|
||||
[](LICENSE)
|
||||
[](LICENSE)
|
||||
|
||||
RSIPI is a Python library for real-time control of KUKA industrial robots via the Robot Sensor Interface (RSI) protocol. The robot controller sends its state over UDP at a configurable cycle rate (4ms at 250Hz or 12ms at 83Hz), and RSIPI sends back position corrections, I/O commands, and Tech parameters. Communication uses XML packets over a dedicated Ethernet link, managed in a separate process so your control logic never blocks the real-time loop.
|
||||
|
||||
@ -577,6 +577,41 @@ The CLI provides the same capabilities as the Python API through text commands:
|
||||
|
||||
---
|
||||
|
||||
## How to Cite
|
||||
|
||||
If you use RSIPI in academic work, please cite it:
|
||||
|
||||
```bibtex
|
||||
@software{morgan_rsipi,
|
||||
author = {Morgan, Adam},
|
||||
title = {{RSIPI}: Robot Sensor Interface for Python},
|
||||
year = {2026},
|
||||
url = {https://github.com/otherworld-dev/rsi-pi},
|
||||
version = {0.1.1}
|
||||
}
|
||||
```
|
||||
|
||||
Or in plain text:
|
||||
|
||||
> Morgan, A. (2026). *RSIPI: Robot Sensor Interface for Python* (Version 0.1.1) [Computer software]. https://github.com/otherworld-dev/rsi-pi
|
||||
|
||||
A [CITATION.cff](CITATION.cff) file is included, so you can also use GitHub's
|
||||
**Cite this repository** button for APA/BibTeX output.
|
||||
|
||||
---
|
||||
|
||||
## Support This Project
|
||||
|
||||
RSIPI is developed and maintained in spare time. If it saves you hours of
|
||||
KUKA head-scratching, consider supporting development:
|
||||
|
||||
- [GitHub Sponsors](https://github.com/sponsors/otherworld-dev)
|
||||
- [PayPal](https://www.paypal.com/donate/?hosted_button_id=MA56N6K8FSTQ2)
|
||||
|
||||
Bug reports, docs improvements, and pull requests are equally appreciated.
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
[Apache License 2.0](LICENSE)
|
||||
|
||||
346
ROADMAP.md
346
ROADMAP.md
@ -1,346 +0,0 @@
|
||||
# RSIPI Improvement Roadmap
|
||||
|
||||
**Goal:** Transform RSIPI into publication-quality research software for industrial robot control
|
||||
|
||||
**Status:** Phase 1 ✅ Complete | Phase 2 ✅ Complete | Phase 3 ✅ Complete | Phase 4 ✅ Complete | Phase 5 ✅ Complete | Phase 6 📋 Planned
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Six-phase improvement plan to make RSIPI world-class Python library for KUKA RSI control, suitable for publication in robotics research papers and industrial applications.
|
||||
|
||||
---
|
||||
|
||||
## ✅ Phase 1: Code Quality Foundation (COMPLETE)
|
||||
|
||||
**Objective:** Establish professional code quality baseline
|
||||
|
||||
**Completed Tasks:**
|
||||
- ✅ Add comprehensive type hints to all core modules (500+ annotations)
|
||||
- ✅ Create custom exception hierarchy (20+ specialized exceptions)
|
||||
- ✅ Replace all print() statements with proper logging
|
||||
- ✅ Add comprehensive docstrings with Args/Returns/Raises sections
|
||||
- ✅ Improve error handling with exception chaining
|
||||
|
||||
**Files Modified:**
|
||||
- `rsi_client.py` - State machine with typed exceptions
|
||||
- `network_handler.py` - CSV logging and UDP communication
|
||||
- `config_parser.py` - XML parsing with proper exception handling
|
||||
- `safety_manager.py` - Safety validation with typed limits
|
||||
- `exceptions.py` - NEW comprehensive exception hierarchy
|
||||
|
||||
**Commit:** `50e6df9` (January 16, 2026)
|
||||
|
||||
---
|
||||
|
||||
## ✅ Phase 2: Network Reliability (COMPLETE)
|
||||
|
||||
**Objective:** Ensure rock-solid network communication and diagnostics
|
||||
|
||||
**Completed Tasks:**
|
||||
- ✅ Implement timing instrumentation (latency, jitter, cycle time tracking)
|
||||
- ✅ Add watchdog timer for communication loss detection
|
||||
- ✅ Implement network quality monitoring (packet loss, IPOC gaps, buffer health)
|
||||
- ✅ Optimize CSV logging to prevent timing impact (batched updates every 100 cycles)
|
||||
- ✅ Add auto-reconnection with graceful recovery
|
||||
- ✅ Create 24-hour stability test infrastructure
|
||||
|
||||
**Deliverables:**
|
||||
- Fully implemented `DiagnosticsAPI` namespace
|
||||
- Real-time network health monitoring with TimingMetrics class
|
||||
- Automatic recovery from network failures via AutoReconnectManager
|
||||
- Comprehensive metrics tracking (cycle time, jitter, packet loss, IPOC gaps)
|
||||
- 24-hour stability test script with JSON reporting
|
||||
|
||||
**Files Created/Modified:**
|
||||
- `timing_metrics.py` - NEW TimingMetrics and NetworkQualityMonitor classes
|
||||
- `auto_reconnect.py` - NEW AutoReconnectManager with retry strategies
|
||||
- `network_handler.py` - Integrated timing metrics into real-time loop
|
||||
- `rsi_client.py` - Added shared metrics dict and auto-reconnect support
|
||||
- `diagnostics_api.py` - Fully implemented (was placeholder)
|
||||
- `tests/stability_test.py` - NEW 24-hour stability test script
|
||||
|
||||
**API Methods:**
|
||||
- `api.diagnostics.get_stats()` - Comprehensive network and performance statistics
|
||||
- `api.diagnostics.get_timing()` - Timing-specific metrics
|
||||
- `api.diagnostics.is_healthy()` - Overall system health check
|
||||
- `api.diagnostics.get_network_quality()` - Network quality metrics
|
||||
- `api.diagnostics.check_watchdog()` - Watchdog timeout status
|
||||
- `api.diagnostics.format_stats()` - Human-readable statistics
|
||||
|
||||
**Commits:**
|
||||
- `6e8ea2e` - Timing instrumentation and diagnostics (January 17, 2026)
|
||||
- `bb65500` - Auto-reconnection and stability testing (January 17, 2026)
|
||||
|
||||
---
|
||||
|
||||
## ✅ Phase 3: KRL Coordination (COMPLETE)
|
||||
|
||||
**Objective:** Seamless Python-KRL coordination and communication
|
||||
|
||||
**Completed Tasks:**
|
||||
- ✅ Implement high-level Digital I/O API (set_output, get_input, pulse)
|
||||
- ✅ Add KRL state coordination helpers (wait_for_signal, signal_complete)
|
||||
- ✅ Implement parameter passing via Tech variables (write_param, read_param)
|
||||
- ✅ Create KRL code templates for all coordination scenarios (3 templates)
|
||||
- ✅ Create Python coordination example workflows (3 examples)
|
||||
|
||||
**Deliverables:**
|
||||
- Enhanced `IOAPI` with high-level I/O methods
|
||||
- Enhanced `KRLAPI` with coordination helpers
|
||||
- KRL template library (basic_handshake, parameter_passing, state_machine)
|
||||
- Python coordination examples (3 production-ready scripts)
|
||||
- Comprehensive documentation with KRL code examples
|
||||
|
||||
**Files Created/Modified:**
|
||||
- `io_api.py` - Added set_output(), get_input(), pulse() methods
|
||||
- `krl_api.py` - Added wait_for_signal(), signal_complete(), write_param(), read_param()
|
||||
- `templates/krl/` - 3 KRL templates + README with coordination patterns
|
||||
- `examples/coordination/` - 3 Python examples + README with usage guide
|
||||
|
||||
**API Methods:**
|
||||
- `api.io.set_output(channel, value)` - Set digital output by channel
|
||||
- `api.io.get_input(channel)` - Read digital input by channel
|
||||
- `api.io.pulse(channel, duration)` - Generate timed output pulse
|
||||
- `api.krl.wait_for_signal(channel, timeout)` - Wait for KRL I/O signal
|
||||
- `api.krl.signal_complete(channel)` - Signal KRL completion
|
||||
- `api.krl.write_param(slot, value)` - Write to Tech.C (Python → KRL)
|
||||
- `api.krl.read_param(slot)` - Read from Tech.T (KRL → Python)
|
||||
|
||||
**Commit:** `6e0b87b` (January 17, 2026)
|
||||
|
||||
---
|
||||
|
||||
## ✅ Phase 4: Advanced Motion Control (COMPLETE)
|
||||
|
||||
**Objective:** Professional-grade trajectory planning and execution
|
||||
|
||||
**Completed Tasks:**
|
||||
- ✅ Implement velocity profiling (trapezoidal, S-curve)
|
||||
- ✅ Add coordinate frame transformation helpers
|
||||
- ✅ Implement motion primitives (arc, circle, spiral)
|
||||
- ✅ Add path blending for smooth transitions
|
||||
- ✅ Create comprehensive motion planning examples (5 examples)
|
||||
- ✅ Document all features with application use cases
|
||||
|
||||
**Deliverables:**
|
||||
- Enhanced `MotionAPI` with 5 new advanced planning methods
|
||||
- Velocity profiling algorithms (trapezoidal and S-curve)
|
||||
- Geometric motion primitives (arc, circle, spiral)
|
||||
- Path blending with cubic Hermite spline interpolation
|
||||
- Coordinate transformations between BASE/WORLD/TOOL/WORK frames
|
||||
- 5 production-ready motion planning examples
|
||||
- Comprehensive documentation (584-line README.md)
|
||||
|
||||
**Files Created/Modified:**
|
||||
- `motion_api.py` - Added 5 static methods + 4 helper functions (~550 lines)
|
||||
- `examples/advanced_motion/01_velocity_profiles.py` - NEW (234 lines)
|
||||
- `examples/advanced_motion/02_geometric_primitives.py` - NEW (225 lines)
|
||||
- `examples/advanced_motion/03_path_blending.py` - NEW (253 lines)
|
||||
- `examples/advanced_motion/04_coordinate_transforms.py` - NEW (284 lines)
|
||||
- `examples/advanced_motion/05_combined_motion.py` - NEW (336 lines)
|
||||
- `examples/advanced_motion/README.md` - NEW comprehensive guide (584 lines)
|
||||
- `PHASE_4_SUMMARY.md` - NEW detailed implementation documentation
|
||||
|
||||
**API Methods:**
|
||||
- `api.motion.generate_velocity_profile(trajectory, max_velocity, max_acceleration, profile)`
|
||||
- `api.motion.generate_arc(center, radius, start_angle, end_angle, steps, plane)`
|
||||
- `api.motion.generate_circle(center, radius, steps, plane)`
|
||||
- `api.motion.generate_spiral(center, start_radius, end_radius, pitch, revolutions, steps, plane, axis)`
|
||||
- `api.motion.blend_trajectories(traj1, traj2, blend_radius, blend_steps)`
|
||||
- `api.motion.transform_coordinates(pose, from_frame, to_frame, frame_offset)`
|
||||
|
||||
**Commit:** `cc19e10` (January 17, 2026)
|
||||
|
||||
---
|
||||
|
||||
## ✅ Phase 5: API Restructuring (COMPLETE)
|
||||
|
||||
**Objective:** Clean, namespaced API architecture
|
||||
|
||||
**Completed Tasks:**
|
||||
- ✅ Create SafetyAPI namespace class
|
||||
- ✅ Create IOAPI namespace class
|
||||
- ✅ Create MonitoringAPI namespace class
|
||||
- ✅ Create LoggingAPI namespace class
|
||||
- ✅ Create KRLAPI namespace class
|
||||
- ✅ Create ToolsAPI namespace class
|
||||
- ✅ Create VizAPI namespace class
|
||||
- ✅ Create MotionAPI namespace class
|
||||
- ✅ Create DiagnosticsAPI placeholder class
|
||||
- ✅ Restructure RSIAPI as orchestrator with namespace properties
|
||||
|
||||
**New Namespace Structure:**
|
||||
```python
|
||||
api = RSIAPI('RSI_EthernetConfig.xml')
|
||||
api.motion # Motion control
|
||||
api.io # Digital I/O
|
||||
api.krl # KRL manipulation
|
||||
api.safety # Safety management
|
||||
api.monitoring # Live data access
|
||||
api.logging # CSV logging
|
||||
api.diagnostics # Network diagnostics
|
||||
api.viz # Visualization
|
||||
api.tools # Utilities
|
||||
```
|
||||
|
||||
**Breaking Changes:**
|
||||
- No backward compatibility (clean slate)
|
||||
- Old API completely replaced with namespaced structure
|
||||
|
||||
**Files Created:**
|
||||
- `motion_api.py`, `io_api.py`, `krl_api.py`, `safety_api.py`
|
||||
- `monitoring_api.py`, `logging_api.py`, `diagnostics_api.py`
|
||||
- `viz_api.py`, `tools_api.py`
|
||||
|
||||
**Commit:** `50e6df9` (January 16, 2026)
|
||||
|
||||
---
|
||||
|
||||
## 📋 Phase 6: Validation & Benchmarking (PLANNED)
|
||||
|
||||
**Objective:** Prove production-readiness and publish results
|
||||
|
||||
**Planned Tasks:**
|
||||
1. Create performance benchmark suite (vs ROS, vs KUKA SDK)
|
||||
2. Run long-duration stability tests with real robot
|
||||
3. Document example applications and use cases
|
||||
|
||||
**Expected Deliverables:**
|
||||
- Benchmark comparison report (RSIPI vs ROS vs KUKA SDK)
|
||||
- 24-hour+ stability test results
|
||||
- Latency/jitter performance analysis
|
||||
- Example applications repository
|
||||
- Use case documentation
|
||||
- Publication-ready performance data
|
||||
|
||||
**Benchmark Metrics:**
|
||||
- Communication latency (round-trip time)
|
||||
- Jitter and timing variance
|
||||
- Maximum sustainable update rate
|
||||
- CPU/memory overhead comparison
|
||||
- Reliability (packet loss, connection uptime)
|
||||
|
||||
---
|
||||
|
||||
## Project Structure After All Phases
|
||||
|
||||
```
|
||||
rsi-pi/
|
||||
├── src/RSIPI/
|
||||
│ ├── rsi_api.py # Main orchestrator
|
||||
│ ├── rsi_client.py # Core RSI client
|
||||
│ ├── motion_api.py # Motion control namespace
|
||||
│ ├── io_api.py # Digital I/O namespace
|
||||
│ ├── krl_api.py # KRL manipulation namespace
|
||||
│ ├── safety_api.py # Safety management namespace
|
||||
│ ├── monitoring_api.py # Monitoring namespace
|
||||
│ ├── logging_api.py # CSV logging namespace
|
||||
│ ├── diagnostics_api.py # Network diagnostics namespace
|
||||
│ ├── viz_api.py # Visualization namespace
|
||||
│ ├── tools_api.py # Utilities namespace
|
||||
│ ├── network_handler.py # UDP communication
|
||||
│ ├── config_parser.py # XML config parsing
|
||||
│ ├── safety_manager.py # Safety validation
|
||||
│ ├── exceptions.py # Exception hierarchy
|
||||
│ ├── xml_handler.py # XML generation
|
||||
│ ├── trajectory_planner.py # Trajectory generation
|
||||
│ ├── static_plotter.py # Static plots
|
||||
│ ├── live_plotter.py # Live plots
|
||||
│ ├── krl_to_csv_parser.py # KRL parsing
|
||||
│ ├── inject_rsi_to_krl.py # KRL injection
|
||||
│ └── kuka_visualiser.py # Visualization
|
||||
├── tests/ # Test suite
|
||||
├── examples/ # Example applications
|
||||
├── benchmarks/ # Performance benchmarks
|
||||
├── docs/ # Documentation
|
||||
├── README.md
|
||||
└── RSIPI_ROADMAP.md # This file
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Success Criteria
|
||||
|
||||
**Phase 1 & 5 (Complete):**
|
||||
- ✅ 500+ type annotations across codebase
|
||||
- ✅ 20+ custom exceptions with proper hierarchy
|
||||
- ✅ Zero print() statements (all logging)
|
||||
- ✅ Comprehensive docstrings on all public methods
|
||||
- ✅ 9 namespaced API classes with clean separation
|
||||
- ✅ Professional API design pattern
|
||||
|
||||
**Phase 2 (Complete):**
|
||||
- ✅ Real-time network quality monitoring
|
||||
- ✅ Automatic recovery from network failures
|
||||
- ✅ Comprehensive diagnostics dashboard
|
||||
- ✅ TimingMetrics tracking (cycle time, jitter, packet loss)
|
||||
- ✅ AutoReconnectManager with configurable retry strategies
|
||||
- ✅ 24-hour stability test infrastructure
|
||||
- ⏳ Run actual 24-hour stability test (pending hardware)
|
||||
|
||||
**Phase 3 (Complete):**
|
||||
- ✅ High-level I/O API with pulse generation (set_output, get_input, pulse)
|
||||
- ✅ Python-KRL coordination patterns documented (templates/krl/README.md)
|
||||
- ✅ Tech variable parameter passing working (write_param, read_param)
|
||||
- ✅ KRL template library created (3 templates with full workflows)
|
||||
- ✅ Example coordination workflows (3 Python examples with documentation)
|
||||
|
||||
**Phase 4 (Complete):**
|
||||
- ✅ Trapezoidal and S-curve velocity profiles implemented
|
||||
- ✅ Arc, circle, spiral motion primitives created
|
||||
- ✅ Path blending with cubic interpolation and configurable blend radius
|
||||
- ✅ Coordinate frame transformations (BASE/WORLD/TOOL/WORK)
|
||||
- ✅ Smooth continuous motion demonstrated in examples
|
||||
- ✅ 5 comprehensive production-ready examples
|
||||
- ✅ 584-line documentation guide created
|
||||
|
||||
**Phase 6 (Planned):**
|
||||
- Performance benchmarks vs ROS/KUKA SDK
|
||||
- Publication-ready data and graphs
|
||||
- Long-duration stability proven
|
||||
- Multiple example applications
|
||||
- Use cases documented
|
||||
|
||||
---
|
||||
|
||||
## Timeline
|
||||
|
||||
- **Phase 1:** ✅ Complete (January 16, 2026)
|
||||
- **Phase 2:** ✅ Complete (January 17, 2026)
|
||||
- **Phase 3:** ✅ Complete (January 17, 2026)
|
||||
- **Phase 4:** ✅ Complete (January 17, 2026)
|
||||
- **Phase 5:** ✅ Complete (January 16, 2026)
|
||||
- **Phase 6:** 📋 Next priority - Final validation
|
||||
|
||||
**Approach:** "Get it right the first time" - complete each phase fully before moving to the next.
|
||||
|
||||
---
|
||||
|
||||
## Research Publication Goal
|
||||
|
||||
**Target:** High-quality research paper demonstrating RSIPI as lightweight, high-performance alternative to ROS for KUKA robot control in drilling/manufacturing applications.
|
||||
|
||||
**Key Points:**
|
||||
- Python-based, easy to integrate
|
||||
- ~250Hz update rate, <5ms latency
|
||||
- Industrial-grade reliability
|
||||
- Comprehensive safety features
|
||||
- Minimal dependencies
|
||||
- Professional API design
|
||||
- Proven stability (24-hour tests)
|
||||
- Benchmarked against ROS
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
- No backward compatibility - clean slate design
|
||||
- Focus on quality over speed
|
||||
- All features properly documented
|
||||
- Type-safe with comprehensive testing
|
||||
- Suitable for industrial research applications
|
||||
- Designed for drilling PhD research (but general-purpose)
|
||||
|
||||
**Last Updated:** January 17, 2026
|
||||
BIN
TestServer.exe
BIN
TestServer.exe
Binary file not shown.
249
docs/controller-setup.md
Normal file
249
docs/controller-setup.md
Normal file
@ -0,0 +1,249 @@
|
||||
# KUKA Controller Setup Guide
|
||||
|
||||
Getting RSIPI talking to a real robot: installing the config files on a KRC4
|
||||
controller, configuring the network, and troubleshooting the common failure
|
||||
modes.
|
||||
|
||||
Primary source: the official **KUKA.RobotSensorInterface 3.3 manual**
|
||||
(KST RSI 3.3 V5, issued 2016-10-17, for KSS 8.3/8.4), available from KUKA
|
||||
via [my.kuka.com](https://my.kuka.com) or your KUKA support contact (it is
|
||||
KUKA-copyrighted, so it is not redistributed with this repo). Section/page
|
||||
references below (e.g. "manual §8.1.1, p. 56") point into that document. Claims not covered by the
|
||||
manual are marked *(practical experience)* and sourced at the bottom.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **KRC4 controller** with **KSS 8.3 or 8.4** and the
|
||||
**KUKA.RobotSensorInterface 3.x** option package installed
|
||||
(manual §4.1, p. 25). Check **Help > Info > Options** on the pendant.
|
||||
RSI provides `RSI_CREATE`, `RSI_ON`, `RSI_MOVECORR`, `RSI_OFF`,
|
||||
`RSI_DELETE` (manual §7.1, p. 39).
|
||||
- RSI must **not** be installed together with KUKA.ConveyorTech or
|
||||
KUKA.ServoGun TC (manual §4.1, p. 25).
|
||||
- For corrections in `#IPO` sensor mode, **function generator 1 must be
|
||||
free** (manual §4.1, p. 25; configurable via `RSITECHIDX` in
|
||||
`KRC:\R1\TP\RSI\RSI.DAT`, manual §5.2, p. 30).
|
||||
- PC side: Python 3.10+ with RSIPI installed (`pip install -e .`), on a
|
||||
network interface reachable from the controller. KUKA specifies a
|
||||
"real-time-capable operating system and real-time-capable network card
|
||||
with 100 Mbit in full duplex mode" (manual §4.1, p. 25) — a normal
|
||||
Windows/Linux PC works for testing but is not real-time capable, so
|
||||
expect occasional late packets (see [Timing](#timing-requirements)).
|
||||
|
||||
## 1. Install the files
|
||||
|
||||
The files in `rsi_config/` go to **two different places**. This split is
|
||||
specified in manual §8.1.1, p. 56:
|
||||
|
||||
> 2. Copy KRL programs into the directory `C:\KRC\ROBOTER\KRC\R1\Program`
|
||||
> of the robot controller.
|
||||
> 3. Copy the sample configurations and the XML file for the Ethernet
|
||||
> connection to the directory
|
||||
> `C:\KRC\ROBOTER\Config\User\Common\SensorInterface` of the robot
|
||||
> controller.
|
||||
|
||||
| File | Destination on controller |
|
||||
|---|---|
|
||||
| `RSIPI_Full.rsi` | `C:\KRC\ROBOTER\Config\User\Common\SensorInterface\` |
|
||||
| `RSIPI_Full.rsi.diagram` | `C:\KRC\ROBOTER\Config\User\Common\SensorInterface\` |
|
||||
| `RSIPI_Full.rsi.xml` | `C:\KRC\ROBOTER\Config\User\Common\SensorInterface\` |
|
||||
| `RSI_EthernetConfig_Full.xml` | `C:\KRC\ROBOTER\Config\User\Common\SensorInterface\` |
|
||||
| `RSIPI_Minimal.src` | `C:\KRC\ROBOTER\KRC\R1\Program\` (= `KRC:\R1\Program` in the Navigator) |
|
||||
| `RSIPI_Test.src` | `C:\KRC\ROBOTER\KRC\R1\Program\` (= `KRC:\R1\Program` in the Navigator) |
|
||||
|
||||
Watch the paths carefully — they are confusingly similar:
|
||||
|
||||
- KRL programs go under `...\ROBOTER\KRC\R1\Program` (**with** `\KRC\`).
|
||||
- SensorInterface files go under `...\ROBOTER\Config\User\Common\...`
|
||||
(**without** a second `\KRC\`). Putting them in
|
||||
`C:\KRC\ROBOTER\KRC\Config\User\Common\SensorInterface` is a common
|
||||
mistake; `RSI_CREATE` will not find them there.
|
||||
- A `.src` file placed in the SensorInterface folder never appears as a
|
||||
program, and a program that isn't loaded through `KRC:\R1\Program` throws
|
||||
"variable not defined" on every RSI keyword.
|
||||
|
||||
Notes:
|
||||
|
||||
- The RSI, DIAGRAM and XML files "form a unit and must be transferred to
|
||||
the robot controller together" (manual §8.1, p. 55).
|
||||
- **Do not rename the files.** `RSIPI_Full.rsi` references
|
||||
`RSI_EthernetConfig_Full.xml` by name in its ETHERNET object, and the
|
||||
`.src` programs load `"RSIPI_Full.rsi"` by name in `RSI_CREATE`.
|
||||
- Copy `.src` files as the **Expert** user group (log on via
|
||||
Configuration > User group).
|
||||
|
||||
## 2. Configure the network
|
||||
|
||||
RSI needs "its own Ethernet sensor network which is independent of other
|
||||
KLI subnetworks", physically connected via the KLI ports X66 or X67.1-3 on
|
||||
the controller cabinet (manual §5.1, p. 29).
|
||||
|
||||
### Controller side
|
||||
|
||||
Two documented ways to set the robot's RSI IP address (manual §5.1.1 and
|
||||
§5.1.2, pp. 29–30):
|
||||
|
||||
**A. KLI network configuration on the pendant** (requires KSS 8.3.15+,
|
||||
Expert group, T1/T2, no program selected):
|
||||
|
||||
1. Main menu > **Start-up > Network configuration** > **Advanced...**
|
||||
2. **Add interface**; name it (e.g. "Ethernet sensor network").
|
||||
3. Set **Address type: Mixed IP address** — this auto-creates the
|
||||
real-time UDP receiving tasks RSI needs.
|
||||
4. Enter the robot's IP and subnet mask, **Save**, and **reboot the
|
||||
controller**.
|
||||
|
||||
**B. RSI-Network tool in Windows** (Expert group): minimize the HMI
|
||||
(Start-up > Service > Minimize HMI), run **All Programs > RSI-Network**,
|
||||
select the entry **New** under *RSI Ethernet* in the tree, press **Edit**,
|
||||
enter the robot controller's IP, confirm, then **cold restart** the
|
||||
controller.
|
||||
|
||||
IP address rules (manual §5.1.1, p. 29):
|
||||
|
||||
- PC and controller must be "located in the same network segment", i.e.
|
||||
only the last of the 4 octets may differ.
|
||||
- "The IP address range **192.168.0.x is blocked**" and the address "must
|
||||
not be in the address range of another KLI subnet". The manual's example
|
||||
uses robot `192.168.1.2` / mask `255.255.255.0` with the sensor (PC) at
|
||||
`192.168.1.1`. This repo's default config uses `10.10.10.x`, which
|
||||
safely avoids all KUKA-internal ranges *(practical experience — see
|
||||
Sources)*.
|
||||
|
||||
### "Address already in use" when adding the interface
|
||||
|
||||
This error is not documented in the manual *(practical experience)*: it
|
||||
appears when the address you enter collides with an interface entry that
|
||||
already exists — a leftover RSI Ethernet entry, or another KLI subnet
|
||||
containing the same address. Fix: in the interface tree, **edit or delete
|
||||
the existing entry instead of adding a second one** (note the documented
|
||||
RSI-Network procedure edits the existing "New" entry rather than creating
|
||||
another), and make sure the subnet doesn't overlap any other configured
|
||||
interface. Reboot (cold restart) afterwards — network changes only take
|
||||
effect after a reboot (manual §5.1.1 step 8 / §5.1.2 step 5, p. 30).
|
||||
|
||||
### PC side
|
||||
|
||||
Give the PC a **static IP** on the RSI link and put that address in
|
||||
`RSI_EthernetConfig_Full.xml` (both the copy on the controller and the copy
|
||||
the Python side loads — they must match):
|
||||
|
||||
```xml
|
||||
<CONFIG>
|
||||
<IP_NUMBER>10.10.10.10</IP_NUMBER> <!-- your PC's IP -->
|
||||
<PORT>64000</PORT>
|
||||
<SENTYPE>ImFree</SENTYPE>
|
||||
<ONLYSEND>FALSE</ONLYSEND>
|
||||
</CONFIG>
|
||||
```
|
||||
|
||||
Pick a free UDP port "not assigned a standard service" (manual §8.1.2.1,
|
||||
p. 58). Allow that UDP port through the PC firewall, or disable the
|
||||
firewall on the dedicated RSI interface *(practical experience)* — a
|
||||
blocked firewall shows up as "Python receives nothing" while a packet
|
||||
capture still sees traffic arriving.
|
||||
|
||||
### Timing requirements
|
||||
|
||||
The robot controller initiates the exchange and sends a packet every
|
||||
sensor cycle; "a data packet received by the sensor system must be
|
||||
answered within the sensor cycle rate. Packets that arrive too late are
|
||||
rejected. When the maximum number of data packets for which a response has
|
||||
been sent too late has been exceeded, the robot stops." (manual §2.3.2,
|
||||
p. 15). The sensor cycle is **4 ms** in `#IPO_FAST` (default) or **12 ms**
|
||||
in `#IPO` mode (manual §7.1.4, p. 41). The allowed number of late packets
|
||||
is the `Timeout` parameter of the ETHERNET object — set to 100 in
|
||||
`RSIPI_Full.rsi`.
|
||||
|
||||
## 3. First run: minimal test
|
||||
|
||||
`RSIPI_Minimal.src` mirrors KUKA's official `RSI_Ethernet.src` example
|
||||
(manual §8.1.3, p. 59: `RSI_CREATE` → `RSI_ON(#RELATIVE)` →
|
||||
`RSI_MOVECORR()` → `RSI_OFF`) and uses no `$TECH` variables, no I/O and no
|
||||
`$SEN_PREA` — so it isolates "does RSI work at all" from everything else.
|
||||
|
||||
1. On the pendant (T1 mode, low override): select `RSIPI_Minimal` and start
|
||||
it. It does a BCO run to the current position, activates RSI, and reports
|
||||
*"RSI active - start the Python sender now"*. The robot holds position,
|
||||
waiting for corrections.
|
||||
2. On the PC, from the repo root:
|
||||
|
||||
```python
|
||||
from RSIPI import RSIAPI
|
||||
|
||||
api = RSIAPI("RSI_EthernetConfig_Full.xml")
|
||||
api.start()
|
||||
if not api.wait_for_connection(timeout=30.0):
|
||||
raise SystemExit("No packets from robot - see troubleshooting table")
|
||||
|
||||
print("Connected:", api.motion.get_current_pose())
|
||||
api.motion.update_cartesian(X=5.0) # small 5mm correction
|
||||
input("Press Enter to stop...")
|
||||
api.stop()
|
||||
```
|
||||
|
||||
3. Stop by cancelling the program on the pendant. Stopping the Python side
|
||||
instead also works: after `Timeout` late packets the robot stops and
|
||||
reports an RSI communication error — expected and safe (manual §2.3.2,
|
||||
p. 15). (A clean stop signal would require a STOP object in the signal
|
||||
flow, manual §7.1.6, p. 42 — `RSIPI_Full.rsi` doesn't include one.)
|
||||
|
||||
Keep first corrections small. The signal flow limits Cartesian corrections
|
||||
to ±500 mm (`POSCORR1` in `RSIPI_Full.rsi`), which is generous — tighten it
|
||||
in RSI Visual and/or set software limits on the Python side via
|
||||
`api.safety.set_limit()` before doing anything real.
|
||||
|
||||
Independent cross-check: KUKA ships a Windows test server (`TestServer.exe`)
|
||||
with the RSI option package for exactly this purpose (manual §8.1.2, p. 56)
|
||||
— find it on the controller under
|
||||
`D:\KUKA_OPT\RSI\DOC\Examples\Ethernet\Server` (manual §8.1, p. 55). If the
|
||||
robot exchanges packets with TestServer but not with RSIPI, the problem is
|
||||
on the Python/firewall side, not the robot.
|
||||
|
||||
## 4. Full test
|
||||
|
||||
`RSIPI_Test.src` + `rsi_config/rsipi_test.py` exercise the whole feature
|
||||
set: corrections, `$SEN_PREA` (via MAP2SEN_PREA objects, manual §11.2.10,
|
||||
p. 81), digital I/O, and a handshake over the `Tech.C` / `Tech.T` channels.
|
||||
Those channels are "technology parameters in the main run / advance run
|
||||
(function generators 1 to 6)" (manual §7.4.5–7.4.6, pp. 52–53): on the
|
||||
wire, `DEF_Tech.C1` carries the ten parameters of function generator 1 as
|
||||
attributes `C11…C110`.
|
||||
|
||||
On the KRL side the test program reads/writes these as `$TECH.C[11]` etc.
|
||||
On at least one user's KSS 8.3.38 installation these `$TECH` references
|
||||
fail to load with "variable not defined"
|
||||
([issue #1](https://github.com/otherworld-dev/rsi-pi/issues/1)) — the
|
||||
variables appear tied to a technology-package installation, and the exact
|
||||
availability conditions haven't been pinned down yet. **If only the
|
||||
`$TECH.…` lines error, run `RSIPI_Minimal.src` instead** — everything
|
||||
except the Tech handshake works without them.
|
||||
|
||||
## 5. Troubleshooting
|
||||
|
||||
| Symptom | Likely cause | Fix |
|
||||
|---|---|---|
|
||||
| "Variable not defined" on **every** line / `RSI_CREATE`, `RSI_ON`, `RSIOK` unknown | `.src` file not in `KRC:\R1\Program`, or RSI option not installed | Move the `.src` (see §1); check RSI appears under Help > Info > Options |
|
||||
| "Variable not defined" only on `$TECH.…` lines | `$TECH` technology parameters not available on this installation | Use `RSIPI_Minimal.src` (see §4) |
|
||||
| "Address already in use" when creating the RSI Ethernet entry | An interface entry with that address/subnet already exists | Edit or delete the existing entry instead of adding a new one; reboot (see §2) |
|
||||
| `RSI_CREATE` returns `RSIFILENOTFOUND` / `RSIINVFILE` | Config files missing from `Config\User\Common\SensorInterface` (check for the extra-`\KRC\` path mistake), renamed, or `.rsi`/`.rsi.xml`/`.diagram` set incomplete | Re-copy all four config files together, keep original names (manual §7.1.2, p. 40 for return codes) |
|
||||
| `RSI_ON` fails / RSI communication error immediately | IP in `RSI_EthernetConfig_Full.xml` doesn't match the PC, or subnet mismatch (only last octet may differ), or PC in `192.168.0.x` | Fix `<IP_NUMBER>`; follow the IP rules in §2 |
|
||||
| Robot program runs but Python sees no packets | PC firewall blocking the UDP port, or RSIPI bound to the wrong interface | Allow the port / disable firewall on the RSI interface; verify with KUKA's `TestServer.exe` (see §3) |
|
||||
| Robot stops mid-motion with RSI error after running fine | Response packets late: Python loop blocked, or non-dedicated network | Keep the correction loop free of blocking work; use a dedicated interface; watch the `Delay` variable (count of late packets, manual §7.4.5, p. 52) |
|
||||
| Corrections apply but motion is jerky | Late/rejected packets | Same as above — dedicated network, faster loop |
|
||||
|
||||
Still stuck? Open an issue with your KSS version, RSI version (Help > Info >
|
||||
Options), and the exact pendant error message.
|
||||
|
||||
## Sources
|
||||
|
||||
- **KUKA.RobotSensorInterface 3.3** manual, KST RSI 3.3 V5, KUKA Roboter
|
||||
GmbH, 2016-10-17 — from KUKA ([my.kuka.com](https://my.kuka.com)).
|
||||
All "manual §…" references above.
|
||||
- [Michael Sobrepera, "KUKA Setup Guide"](https://michaelsobrepera.com/guides/kuka.html)
|
||||
— practical KRC4 + RSI walkthrough (network interface creation, firewall,
|
||||
file copying).
|
||||
- Robot-Forum: [KRC4 RSI Ethernet](https://www.robot-forum.com/robotforum/thread/12240-krc4-rsi-ethernet/)
|
||||
and [IP addresses in network configuration of KRC4](https://www.robot-forum.com/robotforum/thread/16990-ip-addresses-in-network-configuration-of-krc4/)
|
||||
— reserved KRC4 subnets (`192.168.0.x` shared-memory driver) and RSI
|
||||
network setup experience.
|
||||
@ -561,7 +561,6 @@ for i in range(len(layers) - 1):
|
||||
## References
|
||||
|
||||
- [RSIPI API Documentation](../../README.md)
|
||||
- [Phase 4 Implementation Summary](../../PHASE_4_SUMMARY.md) (when available)
|
||||
- [Basic Motion Examples](../basic_motion/)
|
||||
- [Coordination Examples](../coordination/)
|
||||
- [KUKA RSI 3.3 Manual](https://www.kuka.com)
|
||||
|
||||
@ -10,7 +10,7 @@ readme = "README.md"
|
||||
requires-python = ">=3.8"
|
||||
license = { file = "LICENSE" }
|
||||
authors = [
|
||||
{ name="Adam Morgan", email="yadam.j.morgan@swansea.ac.uk" }
|
||||
{ name="Adam Morgan", email="contact@otherworld.dev" }
|
||||
]
|
||||
dependencies = [
|
||||
"pandas>=2.0",
|
||||
@ -21,7 +21,7 @@ dependencies = [
|
||||
]
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
|
||||
|
||||
74
rsi_config/RSIPI_Minimal.src
Normal file
74
rsi_config/RSIPI_Minimal.src
Normal file
@ -0,0 +1,74 @@
|
||||
&ACCESS RVP
|
||||
&REL 1
|
||||
DEF RSIPI_Minimal()
|
||||
; =========================================================================
|
||||
; RSIPI Minimal Test Program
|
||||
; =========================================================================
|
||||
; Bare-bones RSI check with NO dependency on the Technology package:
|
||||
; - no $TECH.C[] / $TECH.T[] variables
|
||||
; - no digital I/O, no $SEN_PREA
|
||||
;
|
||||
; It only verifies that:
|
||||
; 1. The RSI context (RSIPI_Full.rsi) loads -> RSI_CREATE
|
||||
; 2. RSI activates and the UDP link comes up -> RSI_ON
|
||||
; 3. Corrections streamed from Python are applied -> RSI_MOVECORR
|
||||
;
|
||||
; Use this first if RSIPI_Test.src reports "variable not defined" on
|
||||
; $TECH lines (Technology package missing/not licensed) or to prove
|
||||
; the network link before running the full test.
|
||||
;
|
||||
; Python side: any correction sender works, e.g.
|
||||
; examples/example_02_send_cartesian.py
|
||||
; started AFTER RSI_MOVECORR is reached (robot waits, holding position).
|
||||
;
|
||||
; To stop: cancel the program on the pendant, or stop the Python side
|
||||
; and let the ETHERNET object time out (motion stops, RSI reports a
|
||||
; communication error - this is expected and safe).
|
||||
;
|
||||
; See docs/controller-setup.md for installation and troubleshooting.
|
||||
; =========================================================================
|
||||
|
||||
DECL INT ret, CONTID
|
||||
|
||||
INI
|
||||
|
||||
; BCO run to the current position
|
||||
PTP $POS_ACT
|
||||
|
||||
; -- Load RSI signal flow configuration -----------------------------------
|
||||
; RSIPI_Full.rsi must be in Config\User\Common\SensorInterface
|
||||
ret = RSI_CREATE("RSIPI_Full.rsi", CONTID, TRUE)
|
||||
IF (ret <> RSIOK) THEN
|
||||
MsgNotify("RSI_CREATE failed - check SensorInterface files", "RSIPI_Minimal")
|
||||
HALT
|
||||
ENDIF
|
||||
|
||||
; -- Activate RSI ----------------------------------------------------------
|
||||
; RELATIVE corrections in the default #IPO_FAST sensor mode (4ms cycle),
|
||||
; exactly like KUKA's own RSI_Ethernet example (KST RSI 3.3 manual, 8.1.3).
|
||||
; Do not pass #IPO here: in IPO mode corrections only apply to LIN/CIRC
|
||||
; path motions and function generator 1 must be free (manual 4.1, 7.1.4).
|
||||
ret = RSI_ON(#RELATIVE)
|
||||
IF (ret <> RSIOK) THEN
|
||||
MsgNotify("RSI_ON failed - check network config", "RSIPI_Minimal")
|
||||
HALT
|
||||
ENDIF
|
||||
|
||||
MsgNotify("RSI active - start the Python sender now", "RSIPI_Minimal")
|
||||
|
||||
; -- Sensor-guided motion --------------------------------------------------
|
||||
; The robot holds position and applies RKorr corrections streamed from
|
||||
; Python. Blocks until the program is cancelled or RSI stops.
|
||||
RSI_MOVECORR()
|
||||
|
||||
; -- Clean up ----------------------------------------------------------------
|
||||
ret = RSI_OFF()
|
||||
IF (ret <> RSIOK) THEN
|
||||
MsgNotify("RSI_OFF warning", "RSIPI_Minimal")
|
||||
ENDIF
|
||||
|
||||
ret = RSI_DELETE(CONTID)
|
||||
|
||||
MsgNotify("RSIPI_Minimal complete", "RSIPI_Minimal")
|
||||
|
||||
END
|
||||
8
setup.py
8
setup.py
@ -6,9 +6,9 @@ setup(
|
||||
description="Robot Sensor Interface Python Integration (RSIPI) for KUKA RSI control",
|
||||
long_description=open("README.md", encoding="utf-8").read(),
|
||||
long_description_content_type="text/markdown",
|
||||
author="YAdam Morgan",
|
||||
author_email="adam.j.morgan@swansea.ac.uk",
|
||||
license="MIT",
|
||||
author="Adam Morgan",
|
||||
author_email="contact@otherworld.dev",
|
||||
license="Apache-2.0",
|
||||
python_requires=">=3.8",
|
||||
packages=find_packages(where="src"),
|
||||
package_dir={"": "src"},
|
||||
@ -21,7 +21,7 @@ setup(
|
||||
],
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
"Operating System :: OS Independent",
|
||||
],
|
||||
include_package_data=True,
|
||||
|
||||
@ -1,437 +0,0 @@
|
||||
Metadata-Version: 2.4
|
||||
Name: RSIPI
|
||||
Version: 0.1.1
|
||||
Summary: Robot Sensor Interface Python Integration (RSIPI) for KUKA RSI control
|
||||
Author: YAdam Morgan
|
||||
Author-email: Adam Morgan <yadam.j.morgan@swansea.ac.uk>
|
||||
License: GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
RSI-PI
|
||||
Copyright (C) 2025 adam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Requires-Python: >=3.8
|
||||
Description-Content-Type: text/markdown
|
||||
License-File: LICENSE
|
||||
Requires-Dist: pandas>=2.0
|
||||
Requires-Dist: numpy>=1.22
|
||||
Requires-Dist: matplotlib>=3.5
|
||||
Requires-Dist: lxml>=4.9
|
||||
Requires-Dist: scipy>=1.8
|
||||
Provides-Extra: dev
|
||||
Requires-Dist: pytest>=7.0; extra == "dev"
|
||||
Dynamic: author
|
||||
Dynamic: license-file
|
||||
Dynamic: requires-python
|
||||
|
||||
# RSIPI: Robot Sensor Interface - Python Integration
|
||||
|
||||
RSIPI is a high-performance, Python-based communication and control system designed for real-time interfacing with KUKA robots using the Robot Sensor Interface (RSI) protocol. It provides both a robust **API** for developers and a powerful **Command Line Interface (CLI)** for researchers and engineers who need to monitor, control, and analyse robotic movements in real time.
|
||||
|
||||
---
|
||||
|
||||
🛡️ Safety Notice
|
||||
RSIPI is a powerful tool that directly interfaces with industrial robotic systems. Improper use can lead to dangerous movements, property damage, or personal injury.
|
||||
|
||||
⚠️ Safety Guidelines
|
||||
- **Test in Simulation First:** Always verify your RSI communication and trajectories using simulation tools before deploying to a live robot.
|
||||
- **Enable Emergency Stops:** Ensure all safety hardware (E-Stop, fencing, light curtains) is active and functioning correctly.
|
||||
- **Supervised Operation Only:** Run RSIPI only in supervised environments with trained personnel present.
|
||||
- **Limit Movement Ranges:** Use KUKA Workspaces or software limits to constrain movement, especially when testing new code.
|
||||
- **Use Logging for Debugging:** Avoid debugging while RSI is active; instead, enable CSV logging and review logs post-run.
|
||||
- **Secure Network Configuration:** Ensure your RSI network is on a closed, isolated interface to avoid external interference or spoofing.
|
||||
- **Never Rely on RSIPI for Safety:** RSIPI is not a safety-rated system. Do not use it in applications where failure could result in harm.
|
||||
|
||||
---
|
||||
|
||||
## 📄 Description
|
||||
|
||||
RSIPI allows users to:
|
||||
- Communicate with KUKA robots using the RSI XML-based protocol.
|
||||
- Dynamically update control variables (TCP position, joint angles, I/O, external axes, etc.).
|
||||
- Log and visualise robot movements with live graphs and static plots.
|
||||
- Analyse motion data and compare planned vs actual trajectories.
|
||||
- Parse and inject RSI into KRL programs.
|
||||
- Simulate robot behaviour using a realistic Echo Server.
|
||||
- Enforce safety limits and manage emergency stops.
|
||||
|
||||
### Target Audience
|
||||
- **Researchers** working on advanced robotic applications, control algorithms, and feedback systems.
|
||||
- **Engineers** developing robotic workflows or automated processes.
|
||||
- **Educators** using real robots in coursework or lab environments.
|
||||
- **Students** learning about robot control systems and data-driven motion planning.
|
||||
|
||||
---
|
||||
|
||||
## 📊 Features
|
||||
- Real-time network communication with KUKA RSI over UDP.
|
||||
- Structured logging to CSV with British date formatting.
|
||||
- Background execution and live variable updates.
|
||||
- Fully-featured Python API for scripting or external integration.
|
||||
- CLI for interactive control, trajectory planning, and live monitoring.
|
||||
- Real-time and post-analysis graphing (live TCP, joints, force, acceleration).
|
||||
- Safety management: emergency stop, limit enforcement, safety override.
|
||||
- KUKA KRL `.src/.dat` parsing and RSI injection tools.
|
||||
- Echo Server and GUI for offline simulation and testing.
|
||||
- Deviation and force spike alerts during live operation.
|
||||
|
||||
---
|
||||
|
||||
## 📊 API Overview (`rsi_api.py`)
|
||||
|
||||
### Initialization
|
||||
```python
|
||||
from src.RSIPI import rsi_api
|
||||
api = rsi_api.RSIAPI(config_file='examples/RSI_EthernetConfig.xml')
|
||||
```
|
||||
|
||||
### Selected Methods
|
||||
| Method | CLI | API | Description |
|
||||
|--------|-----|-----|-------------|
|
||||
| `start_rsi()` | ✅ | ✅ | Starts RSI communication (non-blocking). |
|
||||
| `stop_rsi()` | ✅ | ✅ | Stops RSI communication. |
|
||||
| `update_variable(path, value)` | ✅ | ✅ | Dynamically updates a send variable (e.g. `RKorr.X`). |
|
||||
| `get_variable(path)` | ✅ | ✅ | Retrieves the latest value of any variable. |
|
||||
| `plan_linear_cartesian(start, end, steps)` | ✅ | ✅ | Create Cartesian paths. |
|
||||
| `plan_linear_joint(start, end, steps)` | ✅ | ✅ | Create Joint-space paths. |
|
||||
| `execute_trajectory(traj, rate)` | ✅ | ✅ | Execute planned trajectory live. |
|
||||
| `enable_alerts(True/False)` | ✅ | ✅ | Enable or disable deviation/force alerts. |
|
||||
| `start_live_plot(mode)` | ✅ | ✅ | Live graph position, velocity, force, etc. |
|
||||
| `generate_plot(csv, type)` | ✅ | ✅ | Static graphing from CSV files. |
|
||||
| `export_movement_data(filename)` | ✅ | ✅ | Export recorded motion as CSV. |
|
||||
| `parse_krl_to_csv(src, dat, output)` | ✅ | ✅ | Extract TCP points from KRL programs. |
|
||||
| `inject_rsi(input, output, config)` | ✅ | ✅ | Add RSI startup code to a KRL file. |
|
||||
|
||||
_(Full API details available in `rsi_api.py`.)_
|
||||
|
||||
---
|
||||
|
||||
## 🔧 CLI Overview (`rsi_cli.py`)
|
||||
|
||||
Start the CLI:
|
||||
```bash
|
||||
python main.py --cli
|
||||
```
|
||||
|
||||
### Selected Commands
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `start` / `stop` | Start or stop RSI client. |
|
||||
| `set <var> <value>` | Update send variable. |
|
||||
| `get <var>` | Get latest receive variable. |
|
||||
| `move_cartesian`, `move_joint` | Move robot using planned trajectories. |
|
||||
| `queue_cartesian`, `queue_joint` | Queue trajectory steps. |
|
||||
| `execute_queue` | Run queued trajectories. |
|
||||
| `alerts on/off` | Enable or disable alerts. |
|
||||
| `graph show/compare` | Plot or compare test runs. |
|
||||
| `log start/stop/status` | Manage CSV logging. |
|
||||
| `plot <type> <csv>` | Static plotting (position, velocity, deviation, etc.). |
|
||||
| `safety-stop`, `safety-reset`, `safety-status` | Emergency stop and limit management. |
|
||||
| `krlparse <src> <dat> <out>` | Parse KRL to CSV. |
|
||||
| `inject_rsi <src> [out] [config]` | Inject RSI code into KRL file. |
|
||||
|
||||
---
|
||||
|
||||
## 📃 Example Usage
|
||||
|
||||
### Update TCP position live
|
||||
```python
|
||||
api.start_rsi()
|
||||
api.update_variable('RKorr.X', 100.0)
|
||||
api.update_variable('RKorr.Y', 50.0)
|
||||
```
|
||||
|
||||
### Plan and execute a Cartesian move
|
||||
```python
|
||||
start_pose = {'X': 0, 'Y': 0, 'Z': 500}
|
||||
end_pose = {'X': 200, 'Y': 0, 'Z': 500}
|
||||
traj = api.plan_linear_cartesian(start_pose, end_pose, steps=100)
|
||||
api.execute_trajectory(traj, rate=0.012)
|
||||
```
|
||||
|
||||
### CLI session sample
|
||||
```bash
|
||||
> start
|
||||
> set RKorr.X 150
|
||||
> move_cartesian X=0,Y=0,Z=500 X=200,Y=0,Z=500 steps=100 rate=0.012
|
||||
> graph show my_log.csv
|
||||
> log start
|
||||
> stop
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📅 Output and Logs
|
||||
- CSV logs saved to `logs/` folder.
|
||||
- Each log includes British timestamp, sent/received variables.
|
||||
- Static plots exportable as PNG/PDF.
|
||||
- Live plots include alert messages and deviation tracking.
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Getting Started
|
||||
1. Connect robot and PC via Ethernet.
|
||||
2. Deploy KUKA RSI program with matching config.
|
||||
3. Install Python dependencies:
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
4. Run `main.py` or import `RSIAPI` in your Python scripts.
|
||||
|
||||
---
|
||||
|
||||
## 🔖 Citation
|
||||
If you use RSIPI in your research, please cite:
|
||||
```bibtex
|
||||
@software{rsipi2025,
|
||||
author = {RSIPI Development Team},
|
||||
title = {RSIPI: Robot Sensor Interface - Python Integration},
|
||||
year = {2025},
|
||||
url = {https://github.com/your-org/rsipi},
|
||||
note = {Accessed: [insert date]}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚖️ License
|
||||
RSIPI is licensed under the MIT License.
|
||||
|
||||
---
|
||||
|
||||
## 🚧 Disclaimer
|
||||
RSIPI is intended for research and experimental purposes only. Always ensure safe operation with appropriate safety measures in place.
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
LICENSE
|
||||
MANIFEST.in
|
||||
README.md
|
||||
pyproject.toml
|
||||
setup.py
|
||||
src/RSIPI/__init__.py
|
||||
src/RSIPI/auto_reconnect.py
|
||||
src/RSIPI/config_parser.py
|
||||
src/RSIPI/diagnostics_api.py
|
||||
src/RSIPI/echo_server_gui.py
|
||||
src/RSIPI/exceptions.py
|
||||
src/RSIPI/inject_rsi_to_krl.py
|
||||
src/RSIPI/io_api.py
|
||||
src/RSIPI/krl_api.py
|
||||
src/RSIPI/krl_to_csv_parser.py
|
||||
src/RSIPI/kuka_visualiser.py
|
||||
src/RSIPI/live_plotter.py
|
||||
src/RSIPI/logging_api.py
|
||||
src/RSIPI/monitoring_api.py
|
||||
src/RSIPI/motion_api.py
|
||||
src/RSIPI/network_handler.py
|
||||
src/RSIPI/rsi_api.py
|
||||
src/RSIPI/rsi_cli.py
|
||||
src/RSIPI/rsi_client.py
|
||||
src/RSIPI/rsi_config.py
|
||||
src/RSIPI/rsi_echo_server.py
|
||||
src/RSIPI/rsi_graphing.py
|
||||
src/RSIPI/rsi_limit_parser.py
|
||||
src/RSIPI/safety_api.py
|
||||
src/RSIPI/safety_manager.py
|
||||
src/RSIPI/static_plotter.py
|
||||
src/RSIPI/timing_metrics.py
|
||||
src/RSIPI/tools_api.py
|
||||
src/RSIPI/trajectory_planner.py
|
||||
src/RSIPI/viz_api.py
|
||||
src/RSIPI/xml_handler.py
|
||||
src/RSIPI.egg-info/PKG-INFO
|
||||
src/RSIPI.egg-info/SOURCES.txt
|
||||
src/RSIPI.egg-info/dependency_links.txt
|
||||
src/RSIPI.egg-info/requires.txt
|
||||
src/RSIPI.egg-info/top_level.txt
|
||||
tests/test_safety_manager.py
|
||||
tests/test_trajectory_planner.py
|
||||
tests/test_xml_handler.py
|
||||
@ -1 +0,0 @@
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
pandas>=2.0
|
||||
numpy>=1.22
|
||||
matplotlib>=3.5
|
||||
lxml>=4.9
|
||||
scipy>=1.8
|
||||
|
||||
[dev]
|
||||
pytest>=7.0
|
||||
@ -1 +0,0 @@
|
||||
RSIPI
|
||||
Loading…
Reference in New Issue
Block a user