3
3
from roboticstoolbox .tools import rtb_get_param
4
4
from roboticstoolbox .robot .ERobot import ERobot2
5
5
from ansitable import ANSITable , Column
6
+ import inspect
6
7
7
8
# import importlib
8
9
9
10
10
- def list (keywords = None , dof = None , mtype = None , border = None ):
11
+ def list (keywords = None , dof = None , type = None , border = "thin" ):
11
12
"""
12
13
Display all robot models in summary form
13
14
14
15
:param keywords: keywords to filter on, defaults to None
15
16
:type keywords: tuple of str, optional
16
17
:param dof: number of DoF to filter on, defaults to None
17
18
:type dof: int, optional
19
+ :param type: model type "DH", "ETS", "URDF", defaults to all types
20
+ :type type: str, optional
18
21
19
22
- ``list()`` displays a list of all models provided by the Toolbox. It
20
23
lists the name, manufacturer, model type, number of DoF, and keywords.
21
24
22
- - ``list(mtype =MT)`` as above, but only displays models of type ``MT``
25
+ - ``list(type =MT)`` as above, but only displays models of type ``MT``
23
26
where ``MT`` is one of "DH", "ETS" or "URDF".
24
27
25
28
- ``list(keywords=KW)`` as above, but only displays models that have a
@@ -34,7 +37,7 @@ def list(keywords=None, dof=None, mtype=None, border=None):
34
37
``KW`` and have ``N`` degrees of freedom.
35
38
"""
36
39
37
- import roboticstoolbox .models as m
40
+ import roboticstoolbox .models as models
38
41
39
42
# module = importlib.import_module(
40
43
# '.' + os.path.splitext(file)[0], package='bdsim.blocks')
@@ -57,14 +60,15 @@ def make_table(border=None):
57
60
border = border ,
58
61
)
59
62
60
- if mtype is not None :
61
- categories = [mtype ]
63
+ if type is not None :
64
+ categories = [type ]
62
65
else :
63
66
categories = ["DH" , "URDF" , "ETS" ]
64
67
for category in categories :
65
- group = m .__dict__ [category ]
68
+ # get all classes in this category
69
+ group = models .__dict__ [category ]
66
70
for cls in group .__dict__ .values ():
67
- if isinstance (cls , type ) and issubclass (cls , Robot ):
71
+ if inspect . isclass (cls ) and issubclass (cls , Robot ):
68
72
# we found a BaseRobot subclass, instantiate it
69
73
try :
70
74
robot = cls ()
0 commit comments