@@ -58,14 +58,14 @@ def __init__(self, marker_topic, marker_data_path, kinbody_path,
58
58
59
59
60
60
def __str__ (self ):
61
- return 'Apriltags'
61
+ return self . __class__ . __name__
62
62
63
63
def DetectObjects (self , env , object_names , ** kw_args ):
64
64
"""
65
65
This hack detects only the objects in object_names. Updates existing
66
66
objects, but only adds objects in the object_names list.
67
67
"""
68
- added_kinbodies , updated_kinbodies = self .DetectObjects ( robot , ** kw_args );
68
+ added_kinbodies , updated_kinbodies = self ._DetectObjects ( env , ** kw_args );
69
69
detected = [];
70
70
for body in added_kinbodies :
71
71
if not (body .GetName () in object_names ):
@@ -81,37 +81,29 @@ def DetectObject(self, env, object_name, **kw_args):
81
81
return (self ._DetectObjects ( env , object_names = [object_name ], ** kw_args ))[0 ][0 ];
82
82
83
83
84
- def _DetectObjects (self , env , ** kw_args ):
84
+ def _DetectObjects (self , env , marker_topic , marker_data_path , kinbody_path ,
85
+ detection_frame , destination_frame ,** kwargs ):
85
86
"""
86
87
Use the apriltags service to detect objects and add them to the
87
- environment
88
+ environment. Params are as in __init__.
88
89
"""
89
90
try :
90
91
# Allow caller to override any of the initial parameters
91
92
# loaded into the module
92
- if 'marker_data_path' in kw_args :
93
- marker_data_path = kw_args ['marker_data_path' ]
94
- else :
95
- marker_data_path = self .marker_data_path
93
+ if marker_topic is None :
94
+ marker_topic = self .marker_topic
96
95
97
- if 'kinbody_path' in kw_args :
98
- kinbody_path = kw_args ['kinbody_path' ]
99
- else :
96
+ if marker_data_path is None :
97
+ marker_data_path = self .marker_data_path
98
+
99
+ if kinbody_path is None :
100
100
kinbody_path = self .kinbody_path
101
-
102
- if 'marker_topic' in kw_args :
103
- marker_topic = kw_args ['marker_topic' ]
104
- else :
105
- marker_topic = self .marker_topic
101
+
106
102
107
- if 'detection_frame' in kw_args :
108
- detection_frame = kw_args ['detection_frame' ]
109
- else :
103
+ if detection_frame is None :
110
104
detection_frame = self .detection_frame
111
105
112
- if 'destination_frame' in kw_args :
113
- destination_frame = kw_args ['destination_frame' ]
114
- else :
106
+ if destination_frame is None :
115
107
destination_frame = self .destination_frame
116
108
117
109
# TODO: Creating detector is not instant...might want
0 commit comments