armdoc 0.6.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- armdoc-0.6.1/LICENSE +202 -0
- armdoc-0.6.1/PKG-INFO +15 -0
- armdoc-0.6.1/README.md +178 -0
- armdoc-0.6.1/armdoc/__init__.py +0 -0
- armdoc-0.6.1/armdoc/baseline.py +106 -0
- armdoc-0.6.1/armdoc/cli.py +15 -0
- armdoc-0.6.1/armdoc/core.py +384 -0
- armdoc-0.6.1/armdoc/doctor.py +317 -0
- armdoc-0.6.1/armdoc/record.py +37 -0
- armdoc-0.6.1/armdoc/report.py +391 -0
- armdoc-0.6.1/armdoc.egg-info/PKG-INFO +15 -0
- armdoc-0.6.1/armdoc.egg-info/SOURCES.txt +29 -0
- armdoc-0.6.1/armdoc.egg-info/dependency_links.txt +1 -0
- armdoc-0.6.1/armdoc.egg-info/entry_points.txt +2 -0
- armdoc-0.6.1/armdoc.egg-info/requires.txt +1 -0
- armdoc-0.6.1/armdoc.egg-info/top_level.txt +1 -0
- armdoc-0.6.1/armdoc.egg-info/zip-safe +1 -0
- armdoc-0.6.1/config/armdoc.yaml +12 -0
- armdoc-0.6.1/launch/armdoc.launch.py +34 -0
- armdoc-0.6.1/package.xml +19 -0
- armdoc-0.6.1/resource/armdoc +0 -0
- armdoc-0.6.1/setup.cfg +10 -0
- armdoc-0.6.1/setup.py +25 -0
- armdoc-0.6.1/test/test_baseline.py +30 -0
- armdoc-0.6.1/test/test_baseline_live.py +53 -0
- armdoc-0.6.1/test/test_checks.py +156 -0
- armdoc-0.6.1/test/test_core.py +239 -0
- armdoc-0.6.1/test/test_cpp_equivalence.py +127 -0
- armdoc-0.6.1/test/test_cpp_live.py +76 -0
- armdoc-0.6.1/test/test_report.py +117 -0
armdoc-0.6.1/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
armdoc-0.6.1/PKG-INFO
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: armdoc
|
|
3
|
+
Version: 0.6.1
|
|
4
|
+
Summary: Attach to a running ros2_control / MoveIt 2 arm and say why it is not moving.
|
|
5
|
+
Maintainer: darshmenon
|
|
6
|
+
Maintainer-email: darshmenon02@gmail.com
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: setuptools
|
|
10
|
+
Dynamic: license
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
Dynamic: maintainer
|
|
13
|
+
Dynamic: maintainer-email
|
|
14
|
+
Dynamic: requires-dist
|
|
15
|
+
Dynamic: summary
|
armdoc-0.6.1/README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# armdoc
|
|
2
|
+
|
|
3
|
+
[](https://github.com/darshmenon/armdoc/actions/workflows/ci.yml) [](https://github.com/darshmenon/armdoc/releases) [](LICENSE) 
|
|
4
|
+
|
|
5
|
+
**Why isn't my arm moving?** Attach to a running ros2_control / MoveIt 2 arm and get a one-line cause. Read-only: it subscribes to topics and lists controllers, and never publishes or changes anything.
|
|
6
|
+
|
|
7
|
+
Part of [ros2-doctor-tools](https://github.com/darshmenon/ros2-doctor-tools), an index of my ROS 2 diagnosis, fault injection and evaluation tools.
|
|
8
|
+
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
ros2 run armdoc armdoc --ready # pre-flight check: READY / NOT READY, with a next step for each problem
|
|
13
|
+
ros2 launch armdoc armdoc.launch.py ns:=/ur3 moveit:=true # live: a report every 2 s (drop ns / moveit if you don't use them)
|
|
14
|
+
docker run --rm armdoc # no robot? try it on a fake arm (build it first, see below)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Install** into a ROS 2 workspace (Humble tested; the C++ package also builds in CI on Jazzy and Lyrical):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cd ~/ros2_ws/src && git clone https://github.com/darshmenon/armdoc.git
|
|
21
|
+
cd .. && colcon build --packages-select armdoc && source install/setup.bash
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or with pip (the launch file example above needs the colcon build):
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# ROS 2 sourced; if you use a venv, create it with --system-site-packages
|
|
28
|
+
pip install git+https://github.com/darshmenon/armdoc
|
|
29
|
+
armdoc --help
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
A pip install puts the `armdoc` command on your PATH; run it directly. The `ros2 run` form needs the colcon build.
|
|
33
|
+
|
|
34
|
+
**Docker** (nothing else to install; the demo runs a healthy fake arm, then a stalled one, then a fake MoveIt with no planning scene):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
docker build -t armdoc https://github.com/darshmenon/armdoc.git
|
|
38
|
+
docker run --rm armdoc # the demo
|
|
39
|
+
docker run --rm --net=host -e ROS_DOMAIN_ID=0 armdoc armdoc --ready # check a running arm on this machine
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
More ways to run it:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
ros2 run armdoc armdoc --ns /ur3 --moveit # namespaced arm, also check move_group and the planning scene
|
|
46
|
+
ros2 run armdoc armdoc --once 10 # watch 10 s, print one report, exit 1 on any ERROR (for CI)
|
|
47
|
+
ros2 run armdoc armdoc --diagnostics # also publish findings to /diagnostics (opt-in, see below)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
ERROR [CTRL_INACTIVE] controller arm_controller (joint_trajectory_controller/JointTrajectoryController) is inactive, not active
|
|
52
|
+
ERROR [TRAJ_STALLED] a trajectory goal has been active for 10s but the joints moved 0.0000 rad
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
*Real output from a UR3 in Gazebo: healthy, then the arm controller deactivated, then the sim paused while armdoc was attached. Source: `docs/ur3_gazebo_demo.txt`, `docs/make_screenshot.py`.*
|
|
58
|
+
|
|
59
|
+
## What it checks
|
|
60
|
+
|
|
61
|
+
| Code | Level | Means |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `JOINT_STATES_NONE` / `JOINT_STATES_STALE` | error | no `/joint_states`, or it went silent (broadcaster or controller manager down) |
|
|
64
|
+
| `JOINT_NAN` | error | a joint position is NaN/inf (diverged controller) |
|
|
65
|
+
| `NEAR_LIMIT` / `LIMIT_POS` | warn / error | within 1% of a URDF joint limit, or outside it |
|
|
66
|
+
| `LIMIT_VEL` | warn | joint faster than its URDF velocity limit |
|
|
67
|
+
| `EFFORT_SAT` | warn | a joint pinned at its effort limit for 2 s (contact or payload) |
|
|
68
|
+
| `NO_CONTROLLER_MANAGER` | warn | `list_controllers` does not answer |
|
|
69
|
+
| `CTRL_INACTIVE` / `NO_ACTIVE_ARM_CTRL` | error | an arm controller is not active, or none is |
|
|
70
|
+
| `NO_MOVE_GROUP` | error | `--moveit` and no `move_group` node |
|
|
71
|
+
| `NO_PLANNING_SCENE` | warn | `--moveit`, `move_group` is up, but nothing publishes `/monitored_planning_scene` and `/get_planning_scene` is not served |
|
|
72
|
+
| `MOVEIT_PLAN_FAILED` | warn | `--moveit` and a `/move_action` goal was aborted in the last 30 s |
|
|
73
|
+
| `TRACKING_ERROR` | warn | trajectory controller error above 0.05 rad for 3 s |
|
|
74
|
+
| `TRAJ_STALLED` | error | a `follow_joint_trajectory` goal is executing but the joints are not moving |
|
|
75
|
+
| `NOISY_JOINTS` | warn | position jitter above 0.002 rad (estimated over 1 s, at 20 Hz or faster): encoder or driver noise |
|
|
76
|
+
| `STREAM_LAG` | warn | `/joint_states` arrive more than 0.5 s after their header stamp, so the controller and planner see old data |
|
|
77
|
+
| `GOAL_ABORTS` | warn | 3 or more trajectory goals aborted or cancelled within 30 s |
|
|
78
|
+
| `LOG_PLAN_GOAL_INVALID` / `LOG_START_STATE_BAD` / `LOG_START_DEVIATES` | warn | `move_group` logged that the goal cannot be sampled (in collision, unreachable), the start state is in collision, or the trajectory starts away from the real arm |
|
|
79
|
+
| `LOG_NO_CONTROLLER` / `LOG_ACTION_NOT_CONNECTED` | warn | `move_group` logged that no controller covers the joints, or cannot reach a controller's `follow_joint_trajectory` action |
|
|
80
|
+
| `LOG_ROBOT_STATE_STALE` | warn | `move_group` logged that it gets no fresh joint state |
|
|
81
|
+
| `LOG_TOLERANCE_VIOLATED` / `LOG_EXEC_ABORTED` | warn | a trajectory controller logged a path or goal tolerance violation, or `move_group` logged an aborted or rejected execution |
|
|
82
|
+
|
|
83
|
+
How the new checks work, and what they cannot see:
|
|
84
|
+
|
|
85
|
+
- **`NOISY_JOINTS`** takes the fourth difference of each arm joint's positions (white noise of sigma s gives a standard deviation of about 8.4 s; smooth motion cancels out, even a fast sine). It treats samples as evenly spaced, so heavy timing jitter at high joint speed can raise the estimate, and it stays silent below 20 Hz. A sudden step in the data (for example a stream that was delayed catching up) shows up as one report. Tune with `--noise-rad`.
|
|
86
|
+
- **`STREAM_LAG`** compares a message's header stamp with the time it arrives, using the median of the last 2 s. When the stamps are simulation time, run armdoc with `--ros-args -p use_sim_time:=true`, otherwise the two clocks differ by years and the check stays silent on purpose. A source that restamps old data is invisible to it. Tune with `--lag-max`.
|
|
87
|
+
- **`MOVEIT_PLAN_FAILED`** counts goals that went to ABORTED on `/move_action/_action/status` after armdoc attached; goals that finished before that are history, judged by the goal's own timestamp. It cannot tell you why planning failed, only that it did.
|
|
88
|
+
- **`NO_PLANNING_SCENE`** looks for a publisher on `/monitored_planning_scene` or a `/get_planning_scene` service rather than waiting for a message, because MoveIt publishes the scene only when it changes.
|
|
89
|
+
|
|
90
|
+
The `LOG_*` rows read WARN and ERROR lines on `/rosout` from `move_group`, `controller_manager` and the controllers, counted over 30 s, each with a hint. The patterns follow the MoveIt 2 and `joint_trajectory_controller` sources and are tested on the message text and with a fake `move_group` log line; they have not yet been run against a real stack that emits each one.
|
|
91
|
+
|
|
92
|
+
Limits come from `/robot_description`, and are checked only for joints that arm controllers claim (grippers and broadcasters are skipped). Missing-thing checks wait out a startup grace (`--grace`, 20 s).
|
|
93
|
+
|
|
94
|
+
## Per-arm baselines
|
|
95
|
+
|
|
96
|
+
A 50 Hz `/joint_states` is normal on one arm and a sign of trouble on another. Record normal once, then get warned on drift:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
armdoc --learn 60 --baseline-file my_arm.json # on a healthy arm: writes the normal /joint_states rate
|
|
100
|
+
armdoc --baseline --baseline-file my_arm.json # later: RATE_DROP / RATE_SPIKE below half or above double normal
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The rate is the median messages per second: plain statistics, no model. A silent stream is still `JOINT_STATES_STALE`, not a rate finding.
|
|
104
|
+
|
|
105
|
+
## Parameters and launch
|
|
106
|
+
|
|
107
|
+
`ros2 launch armdoc armdoc.launch.py` takes `ns`, `moveit`, `diagnostics`, `use_sim_time` and `params_file` (default `config/armdoc.yaml`). The thresholds in that file are ROS parameters of the `armdoc` node: `period`, `hints`, `stale`, `grace`, `track_err`, `stall_time`, `noise_rad`, `lag_max`. They also work without the launch file:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
ros2 run armdoc armdoc --ros-args --params-file my_thresholds.yaml
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Parameters win over the matching command-line flags. `--once`, `--ready`, `--json` and `--record` are command-line only.
|
|
114
|
+
|
|
115
|
+
## `/diagnostics` (opt-in)
|
|
116
|
+
|
|
117
|
+
armdoc never publishes anything unless you pass `--diagnostics`. Then each report goes to `/diagnostics` as a `diagnostic_msgs/DiagnosticArray`: one status per finding (`armdoc: <CODE>`, level WARN or ERROR, the message), or a single OK status when the arm looks healthy. It publishes nothing else, and never commands or reconfigures the arm.
|
|
118
|
+
|
|
119
|
+
## Timeline report (visualization)
|
|
120
|
+
|
|
121
|
+
Record a run, then turn it into a timeline: joint positions with shaded bands where findings were active, a controller lane, and a findings table.
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
ros2 run armdoc armdoc --record run.jsonl # Ctrl-C to stop; logs joints (10 Hz) + findings (1 Hz)
|
|
125
|
+
armdoc report run.jsonl --html report.html --png report.png # no ROS needed for this step
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+

|
|
129
|
+
|
|
130
|
+
*Real recording of a UR3 in Gazebo (80 s): two moves, then `arm_controller` deactivated (the move commanded meanwhile is ignored, and the arm only follows after reactivation), then the sim paused until `/joint_states` went silent. Source: `docs/ur3_run.jsonl`; open [`docs/ur3_report.html`](https://darshmenon.github.io/armdoc/ur3_report.html) for the interactive version.*
|
|
131
|
+
|
|
132
|
+
- **HTML:** one self-contained file (inline SVG + a little JS, no network). Hover for a crosshair with every joint value and the findings active at that moment, click a legend entry to hide a joint, light/dark follows the OS. A 1 Hz table of the joint positions is folded under the findings table.
|
|
133
|
+
- **PNG:** the same timeline via matplotlib.
|
|
134
|
+
- Lines break where `/joint_states` was silent, so a gap is shown as a gap. The controller lane shows only controllers that had been active and then dropped out.
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
The same report runs in the browser: `web/index.html` loads your `--record` log and builds the page with Pyodide, nothing uploaded (no ROS, no numpy needed). Serve the folder with any static host (`python3 -m http.server -d web`, or GitHub Pages); `web/build.sh` refreshes the copied module. Tested in headless Chrome with the bundled UR3 example (same findings as the command line) and a garbage file (clear error).
|
|
138
|
+
|
|
139
|
+
## Try it without a robot
|
|
140
|
+
|
|
141
|
+
`test/fake_arm.py` publishes a fake ros2_control graph: healthy, or `--freeze`, `--inactive`, `--stall`, and with `--moveit` a fake `move_group` (`--no-scene`, `--plan-fail`).
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
python3 test/fake_arm.py --stall &
|
|
145
|
+
ros2 run armdoc armdoc --once 12 --stall-time 4 # TRAJ_STALLED, exit 1
|
|
146
|
+
python3 -m pytest test # the diagnosis rules, no ROS needed
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Checked with armchaos
|
|
150
|
+
|
|
151
|
+
[armchaos](https://github.com/darshmenon/armchaos) injects `noise` and `lag` into a stream; armdoc named both. Raw runs: `docs/e2e_noise_lag.txt`, `docs/e2e_lag_timeline.txt`, `docs/e2e_moveit.txt`.
|
|
152
|
+
|
|
153
|
+
| Fault | armdoc | After the fault started | After it ended |
|
|
154
|
+
|---|---|---|---|
|
|
155
|
+
| noise, sigma 0.02 rad | `NOISY_JOINTS` (estimated 0.018 to 0.025 rad) | +0.5 s | OK in 1.6 s |
|
|
156
|
+
| lag, 3 s | `JOINT_STATES_STALE`, then `STREAM_LAG` | +2.4 s, then +3.5 s | OK in 1.5 s |
|
|
157
|
+
|
|
158
|
+
## C++ node (low overhead)
|
|
159
|
+
|
|
160
|
+
`armdoc_cpp` is a sibling colcon package with a C++ port of the live joint-state checks, for leaving on next to a fast controller:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
colcon build --packages-select armdoc_cpp && source install/setup.bash
|
|
164
|
+
ros2 run armdoc_cpp armdoc_fast --ros-args -p ns:=/ur3 -p once:=10.0 # one report, exit 1 on ERROR
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
It covers `JOINT_STATES_NONE`/`STALE`, `JOINT_NAN`, `LIMIT_POS`, `NEAR_LIMIT`, `LIMIT_VEL`, `EFFORT_SAT`, `NOISY_JOINTS` and `STREAM_LAG`, with the same thresholds (`grace`, `stale`, `noise_rad`, `lag_max`). It learns the arm's joints from the controller manager (or the `arm_joints` parameter), so a gripper at its closed limit is not judged. `-p json:=true` prints the findings as the same JSON list as `armdoc --json`. Trajectory goals, MoveIt, `--record` and `/diagnostics` stay in the Python tool. Run against a live UR3 Gazebo sim, it reports the arm healthy like the Python tool. A test feeds the same randomized streams to both and requires identical findings. Measured on a 50 Hz fake arm (one 20 s run, busy machine): 0.9% of a core and 22 MB for C++, 5.5% and 65 MB for Python.
|
|
168
|
+
|
|
169
|
+
## Checked on other arms
|
|
170
|
+
|
|
171
|
+
Besides UR3 and UR5e in Gazebo, armdoc was run (through armchaos) against FANUC (6 joints) and Franka Panda (7 joints, separate gripper controller) on the real ros2_control controller manager with mock hardware: every injected fault was named by the right code. The Fanuc URDF has no effort limit, so `EFFORT_SAT` cannot fire there. Not a real arm; see armchaos `docs/e2e_fanuc_ros2_control.txt` and `docs/e2e_panda_ros2_control.txt`.
|
|
172
|
+
|
|
173
|
+
## Limits
|
|
174
|
+
|
|
175
|
+
- Verified on Humble against live Gazebo sims of a UR3 and a UR5e (ros2_control, `arm_controller`; the UR3 also with `gripper_controller`): healthy, a deactivated controller and a paused sim gave the expected verdicts on both. Both are Universal Robots arms in simulation; no real robot and no non-UR arm has been tested yet. Controller state topics assume `<controller>/state` (`JointTrajectoryControllerState`).
|
|
176
|
+
- The Docker image and demo were built and run on Docker 29 with `ros:humble`; the GitHub Actions workflow itself has not been seen running.
|
|
177
|
+
- One arm per run; use `--ns` for each.
|
|
178
|
+
- Text or `--json` output; `/diagnostics` only with `--diagnostics`.
|
|
File without changes
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"""Per-robot baselines: learn what normal looks like on this robot, then flag deviations. Pure statistics, no ROS, no training data.
|
|
2
|
+
|
|
3
|
+
`learn` turns message arrival times into a rate (median messages per second) and a jitter (median absolute deviation of that count). `check` compares the recent rate with that baseline."""
|
|
4
|
+
import json
|
|
5
|
+
import statistics
|
|
6
|
+
|
|
7
|
+
MIN_SECONDS = 5 # whole seconds of data needed to trust a stream's baseline
|
|
8
|
+
DROP_RATIO = 0.5 # recent rate below this fraction of the baseline is a drop
|
|
9
|
+
SPIKE_RATIO = 2.0 # recent rate above this multiple is a spike
|
|
10
|
+
WINDOW_S = 6.0 # look-back used by `check`
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def per_second_counts(times):
|
|
14
|
+
"""Messages per whole second, full seconds only (the first and last are partial)."""
|
|
15
|
+
times = sorted(times)
|
|
16
|
+
if len(times) < 2:
|
|
17
|
+
return []
|
|
18
|
+
t0 = times[0]
|
|
19
|
+
counts = {}
|
|
20
|
+
for t in times:
|
|
21
|
+
counts[int(t - t0)] = counts.get(int(t - t0), 0) + 1
|
|
22
|
+
last = int(times[-1] - t0)
|
|
23
|
+
return [counts.get(i, 0) for i in range(1, last)]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def learn(arrivals):
|
|
27
|
+
"""{stream: [times]} -> {stream: {'hz', 'jitter', 'n'}}. The rate is the median messages per second, so bursts of
|
|
28
|
+
messages in one instant (TF) and a few stalls do not skew it. Streams seen for too few seconds are left out."""
|
|
29
|
+
out = {}
|
|
30
|
+
for stream, times in arrivals.items():
|
|
31
|
+
c = per_second_counts(list(times))
|
|
32
|
+
if len(c) < MIN_SECONDS:
|
|
33
|
+
continue
|
|
34
|
+
med = statistics.median(c)
|
|
35
|
+
if med <= 0:
|
|
36
|
+
continue
|
|
37
|
+
mad = statistics.median(abs(x - med) for x in c)
|
|
38
|
+
out[stream] = {'hz': round(float(med), 3), 'jitter': round(float(mad), 3), 'n': len(times)}
|
|
39
|
+
return out
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def recent_rate(times, now, window=WINDOW_S):
|
|
43
|
+
t = [x for x in times if now - x <= window]
|
|
44
|
+
if len(t) < 3:
|
|
45
|
+
return None
|
|
46
|
+
return (len(t) - 1) / (t[-1] - t[0]) if t[-1] > t[0] else None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def check(baseline, arrivals, now, window=WINDOW_S):
|
|
50
|
+
"""Findings as (level, code, msg). A stream with no recent messages is not reported here: the stale checks own that."""
|
|
51
|
+
found = []
|
|
52
|
+
for stream, b in sorted(baseline.items()):
|
|
53
|
+
r = recent_rate(arrivals.get(stream, []), now, window)
|
|
54
|
+
if r is None:
|
|
55
|
+
continue
|
|
56
|
+
if r < b['hz'] * DROP_RATIO:
|
|
57
|
+
found.append(('WARN', 'RATE_DROP', f'{stream} runs at {r:.1f} Hz, this robot normally gives {b["hz"]:.1f} Hz '
|
|
58
|
+
f'({r / b["hz"]:.0%} of normal)'))
|
|
59
|
+
elif r > b['hz'] * SPIKE_RATIO:
|
|
60
|
+
found.append(('WARN', 'RATE_SPIKE', f'{stream} runs at {r:.1f} Hz, this robot normally gives {b["hz"]:.1f} Hz '
|
|
61
|
+
f'({r / b["hz"]:.1f}x normal)'))
|
|
62
|
+
return found
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def parse_expect(items):
|
|
66
|
+
"""['scan:10', 'odom=20'] -> {'scan': {'hz': 10.0, 'jitter': 0.0, 'n': 0}}: rates stated with --expect, used like a
|
|
67
|
+
learned baseline and overriding it for the same stream. Raises ValueError on a bad item."""
|
|
68
|
+
out = {}
|
|
69
|
+
for item in items or ():
|
|
70
|
+
name, sep, hz = item.replace('=', ':').rpartition(':')
|
|
71
|
+
if not sep or not name.strip().strip('/'):
|
|
72
|
+
raise ValueError(f'--expect wants STREAM:HZ (e.g. joint_states:50), got {item!r}')
|
|
73
|
+
try:
|
|
74
|
+
rate = float(hz)
|
|
75
|
+
except ValueError:
|
|
76
|
+
raise ValueError(f'--expect {item!r}: {hz!r} is not a number') from None
|
|
77
|
+
if rate <= 0:
|
|
78
|
+
raise ValueError(f'--expect {item!r}: rate must be > 0')
|
|
79
|
+
out[name.strip().strip('/')] = {'hz': rate, 'jitter': 0.0, 'n': 0}
|
|
80
|
+
return out
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def save(baseline, path):
|
|
84
|
+
with open(path, 'w') as f:
|
|
85
|
+
json.dump({'version': 1, 'streams': baseline}, f, indent=2, sort_keys=True)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def load(path):
|
|
89
|
+
"""Read a baseline file written by `save`. Raises ValueError with a readable message (never a bare traceback, and never
|
|
90
|
+
a malformed entry that only crashes later inside `check`) for a missing file, bad JSON, no `streams`, or an entry
|
|
91
|
+
without a positive numeric `hz`."""
|
|
92
|
+
try:
|
|
93
|
+
with open(path) as f:
|
|
94
|
+
data = json.load(f)
|
|
95
|
+
except OSError as e:
|
|
96
|
+
raise ValueError(f'cannot read baseline file {path!r}: {e.strerror or e}') from None
|
|
97
|
+
except ValueError as e:
|
|
98
|
+
raise ValueError(f'baseline file {path!r} is not valid JSON ({e}); re-create it with --learn') from None
|
|
99
|
+
streams = data.get('streams') if isinstance(data, dict) else None
|
|
100
|
+
if not isinstance(streams, dict):
|
|
101
|
+
raise ValueError(f'baseline file {path!r} has no "streams" object; re-create it with --learn')
|
|
102
|
+
for name, entry in streams.items():
|
|
103
|
+
hz = entry.get('hz') if isinstance(entry, dict) else None
|
|
104
|
+
if isinstance(hz, bool) or not isinstance(hz, (int, float)) or not hz > 0:
|
|
105
|
+
raise ValueError(f'baseline file {path!r}: stream {name!r} needs a positive numeric "hz", got {entry!r}')
|
|
106
|
+
return streams
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Console entry point: `armdoc report ...` needs no ROS; everything else runs the live doctor."""
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def main(argv=None):
|
|
6
|
+
argv = sys.argv[1:] if argv is None else argv
|
|
7
|
+
if argv and argv[0] == "report":
|
|
8
|
+
from armdoc.report import main as report_main
|
|
9
|
+
return report_main(argv[1:])
|
|
10
|
+
from armdoc.doctor import main as doctor_main
|
|
11
|
+
return doctor_main(argv)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if __name__ == "__main__":
|
|
15
|
+
sys.exit(main())
|