@@ -188,7 +188,7 @@ def _repr_pretty_(self, p, cycle):
188
188
"""
189
189
print (self .__str__ ())
190
190
191
- def joints (self ) -> List [int ]: # Returns a list of ET's joint_idx
191
+ def joint_idx (self ) -> List [int ]:
192
192
"""
193
193
Get index of joint transforms
194
194
@@ -200,12 +200,29 @@ def joints(self) -> List[int]: # Returns a list of ET's joint_idx
200
200
201
201
>>> from roboticstoolbox import ET
202
202
>>> e = ET.Rz() * ET.tx(1) * ET.Rz() * ET.tx(1)
203
- >>> e.joints ()
203
+ >>> e.joint_idx ()
204
204
205
205
"""
206
206
return where ([e .isjoint for e in self ])[0 ]
207
207
208
- def jointset (self ) -> Set [int ]: #
208
+ def joints (self ) -> List [ET ]:
209
+ """
210
+ Get a list of the variable ETs with this ETS
211
+
212
+ :return: list of ETs that are joints
213
+
214
+ Example:
215
+
216
+ .. runblock:: pycon
217
+
218
+ >>> from roboticstoolbox import ET
219
+ >>> e = ET.Rz() * ET.tx(1) * ET.Rz() * ET.tx(1)
220
+ >>> e.joints()
221
+
222
+ """
223
+ return [e for e in self if e .isjoint ]
224
+
225
+ def jindex_set (self ) -> Set [int ]: #
209
226
"""
210
227
Get set of joint indices
211
228
@@ -219,7 +236,7 @@ def jointset(self) -> Set[int]: #
219
236
>>> e = ET.Rz(jindex=1) * ET.tx(jindex=2) * ET.Rz(jindex=1) * ET.tx(1)
220
237
>>> e.jointset()
221
238
"""
222
- return set ([self [j ].jindex for j in self .joints ()]) # type: ignore
239
+ return set ([self [j ].jindex for j in self .joint_idx ()]) # type: ignore
223
240
224
241
@cached_property
225
242
def jindices (self ) -> ndarray :
@@ -298,7 +315,9 @@ def structure(self) -> str:
298
315
>>> e.structure
299
316
300
317
"""
301
- return "" .join (["R" if self .data [i ].isrotation else "P" for i in self .joints ()])
318
+ return "" .join (
319
+ ["R" if self .data [i ].isrotation else "P" for i in self .joint_idx ()]
320
+ )
302
321
303
322
@property
304
323
def n (self ) -> int :
@@ -420,7 +439,7 @@ def split(self):
420
439
segments = []
421
440
start = 0
422
441
423
- for j , k in enumerate (self .joints ()):
442
+ for j , k in enumerate (self .joint_idx ()):
424
443
ets_j = self .data [start : k + 1 ]
425
444
start = k + 1
426
445
segments .append (ets_j )
@@ -610,7 +629,7 @@ def __init__(
610
629
self ._auto_jindex = False
611
630
612
631
# Check if jindices are set
613
- joints = [ self [ j ] for j in self .joints ()]
632
+ joints = self .joints ()
614
633
615
634
# Number of joints with a jindex
616
635
jindices = 0
@@ -1497,7 +1516,7 @@ def __init__(
1497
1516
self ._auto_jindex = False
1498
1517
1499
1518
# Check if jindices are set
1500
- joints = [ self [ j ] for j in self .joints ()]
1519
+ joints = self .joints ()
1501
1520
1502
1521
# Number of joints with a jindex
1503
1522
jindices = 0
@@ -1772,7 +1791,7 @@ def jacob0(
1772
1791
1773
1792
j = 0
1774
1793
J = zeros ((3 , self .n ))
1775
- etjoints = self .joints ()
1794
+ etjoints = self .joint_idx ()
1776
1795
1777
1796
if not all (array ([self [i ].jindex for i in etjoints ])):
1778
1797
# not all joints have a jindex it is required, set them
0 commit comments