Commit 07a60f4
fix(ik): unify ik_XX/ikine_XX return types and fix IK docs (#652)
* fix(ik): add IKSolution.__getitem__/__repr__, fix docstring typos
IKSolution had __iter__ but no __getitem__, so positional indexing
(sol[0], sol[1], ...) -- the pattern every existing caller and the
old bare-tuple return used -- raised TypeError. Add __getitem__
matching __iter__'s order, and a __repr__ matching the existing
custom __str__ instead of the verbose default dataclass repr.
Also fixes "Levemberg-Marquadt"/"Marquadt" -> "Levenberg-Marquardt"
and "progamming" -> "programming", present throughout this file's
docstrings.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(ik): unify ik_LM/ik_NR/ik_GN's return type with IKSolution
ik_LM/ik_NR/ik_GN (the fast C++-backed solvers) returned a bare
5-tuple while ikine_LM/ikine_NR/ikine_GN (the pure-Python solvers)
already returned IKSolution -- same family of methods, two different
return shapes. Wrap the C++ tuple in IKSolution in both ETS.ik_LM/
ik_NR/ik_GN and their RobotKinematics forwarders, and update the
return-type annotations and :returns:/:rtype: docstring fields to
match (ikine_LM/ikine_NR/ikine_GN/ikine_QP were missing :returns:/
:rtype: entirely -- added those too).
Also:
- bidirectionally cross-reference each ik_XX with its ikine_XX
counterpart (previously only cross-referenced their C++ siblings)
- add a loud warning to ik_LM/ik_NR/ik_GN's docstrings that they
require the compiled C++ extension and raise RuntimeError without
it (e.g. pure-Python builds, Pyodide/JupyterLite)
- fix several copy-paste bugs in RobotKinematics.py found while doing
this: ik_GN's own "See Also" listed itself instead of ik_LM/ik_NR,
ikine_GN's and ikine_QP's listed the wrong solver class entirely
(IK_NR instead of IK_GN/IK_QP), and two runblock examples said
"ikine_GN"/"ikine_LM" while actually calling ik_NR/ik_LM/ik_GN
- fix "Levemberg-Marquadt"/"Marquadt" -> "Levenberg-Marquardt" and
"deined" -> "defined" throughout both files
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(dhrobot): remove 5 completely broken dead IK methods
DHRobot.ik_lm_chan/ik_lm_wampler/ik_lm_sugihara/ik_nr/ik_gn all
forwarded to self.ets().<same-name>(...), but ETS has never had
methods by these names (only the unified ik_LM/ik_NR/ik_GN, each
taking a method= kwarg where relevant) -- every one of these five
methods raises AttributeError unconditionally on any call. Their
docstrings even have literal ":seealso: TODO" placeholders. No test
exercises any of them.
Confirmed dead: nothing in tests/ or docs/ references any of the
five; the only caller was examples/ik_exp.py (fixed separately).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix(examples): repair ik_exp.py to use the real ik_NR/ik_GN/ik_LM API
Called the now-removed dead ets.ik_nr/ik_gn/ik_lm_chan/ik_lm_wampler/
ik_lm_sugihara methods, which never existed on ETS in the first place
(same root cause as the DHRobot dead-method removal). Rewired to the
real ik_NR/ik_GN/ik_LM(method=...) API with matching parameter names,
switched from raw 5-tuple unpacking to IKSolution attribute access
(the old unpacking would have silently broken now that these methods
return a 6-field IKSolution instead of a 5-tuple), and dropped several
entirely unused imports (fknm, swift, spatialgeometry, sys, and unused
typing names).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs: fix Levenberg-Marquardt spelling in IK docs
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(ik): add regression tests for IKSolution/ik_XX return-type changes
Covers IKSolution.__getitem__/__repr__, and that ik_LM/ik_NR/ik_GN
now return real IKSolution instances rather than a bare tuple.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>1 parent 2e2bfe2 commit 07a60f4
8 files changed
Lines changed: 259 additions & 741 deletions
File tree
- docs/source
- IK
- examples
- src/roboticstoolbox
- ets
- robot
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | 3 | | |
10 | 4 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | 5 | | |
16 | 6 | | |
17 | 7 | | |
| |||
42 | 32 | | |
43 | 33 | | |
44 | 34 | | |
45 | | - | |
| 35 | + | |
46 | 36 | | |
47 | 37 | | |
48 | 38 | | |
| |||
64 | 54 | | |
65 | 55 | | |
66 | 56 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | 57 | | |
96 | 58 | | |
97 | | - | |
| 59 | + | |
98 | 60 | | |
99 | 61 | | |
100 | 62 | | |
101 | 63 | | |
102 | 64 | | |
103 | | - | |
104 | | - | |
105 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
106 | 68 | | |
107 | 69 | | |
108 | 70 | | |
109 | 71 | | |
110 | 72 | | |
111 | | - | |
| 73 | + | |
112 | 74 | | |
113 | 75 | | |
114 | 76 | | |
115 | 77 | | |
116 | 78 | | |
117 | | - | |
118 | | - | |
119 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
120 | 82 | | |
121 | 83 | | |
122 | 84 | | |
123 | 85 | | |
124 | 86 | | |
125 | | - | |
| 87 | + | |
126 | 88 | | |
127 | 89 | | |
128 | 90 | | |
129 | 91 | | |
130 | 92 | | |
131 | | - | |
132 | | - | |
133 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
134 | 97 | | |
135 | 98 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | 99 | | |
163 | 100 | | |
164 | | - | |
| 101 | + | |
165 | 102 | | |
166 | 103 | | |
167 | 104 | | |
168 | 105 | | |
169 | 106 | | |
170 | | - | |
171 | | - | |
172 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
173 | 111 | | |
174 | 112 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | 113 | | |
215 | 114 | | |
216 | | - | |
| 115 | + | |
217 | 116 | | |
218 | 117 | | |
219 | 118 | | |
220 | 119 | | |
221 | 120 | | |
222 | | - | |
223 | | - | |
224 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
225 | 125 | | |
226 | 126 | | |
227 | 127 | | |
| |||
230 | 130 | | |
231 | 131 | | |
232 | 132 | | |
233 | | - | |
| 133 | + | |
234 | 134 | | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
240 | 140 | | |
241 | 141 | | |
242 | 142 | | |
| |||
0 commit comments