8000 get joint revolute/prismatic status as a bool array · oridong/robotics-toolbox-python@7dd6e17 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7dd6e17

Browse files
committed
get joint revolute/prismatic status as a bool array
needed for Robot.toradians, todegrees
1 parent eeadff3 commit 7dd6e17

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

roboticstoolbox/robot/Robot.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,50 @@ def structure(self):
329329

330330
return ''.join(structure)
331331

332+
def isrevolute(self):
333+
"""
334+
Revolute joints as bool array
335+
336+
:return: array of joint type, True if revolute
337+
:rtype: bool(n)
338+
339+
Example:
340+
341+
.. runblock:: pycon
342+
343+
>>> import roboticstoolbox as rtb
344+
>>> puma = rtb.models.DH.Puma560()
345+
>>> puma.isrevolute()
346+
>>> stanford = rtb.models.DH.Stanford()
347+
>>> stanford.isrevolute()
348+
349+
.. note:: Fixed joints, that maintain a constant link relative pose,
350+
are not included. ``len(self.structure) == self.n``.
351+
"""
352+
return [link.isrevolute for link in self]
353+
354+
def isprismatic(self):
355+
"""
356+
Revolute joints as bool array
357+
358+
:return: array of joint type, True if prismatic
359+
:rtype: bool(n)
360+
361+
Example:
362+
363+
.. runblock:: pycon
364+
365+
>>> import roboticstoolbox as rtb
366+
>>> puma = rtb.models.DH.Puma560()
367+
>>> puma.isprismatic()
368+
>>> stanford = rtb.models.DH.Stanford()
369+
>>> stanford.isprismatic()
370+
371+
.. note:: Fixed joints, that maintain a constant link relative pose,
372+
are not included. ``len(self.structure) == self.n``.
373+
"""
374+
return [link.isprismatic for link in self]
375+
332376
def todegrees(self, q=None):
333377
"""
334378
Convert joint angles to degrees

0 commit comments

Comments
 (0)
0