@@ -58,14 +58,17 @@ 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
+
68
+ @param env: The current OpenRAVE environment
69
+ @param object_names: The list of names of objects to detect
67
70
"""
68
- added_kinbodies , updated_kinbodies = self .DetectObjects ( robot , ** kw_args );
71
+ added_kinbodies , updated_kinbodies = self ._DetectObjects ( env , ** kw_args );
69
72
detected = [];
70
73
for body in added_kinbodies :
71
74
if not (body .GetName () in object_names ):
@@ -81,37 +84,38 @@ def DetectObject(self, env, object_name, **kw_args):
81
84
return (self ._DetectObjects ( env , object_names = [object_name ], ** kw_args ))[0 ][0 ];
82
85
83
86
84
- def _DetectObjects (self , env , ** kw_args ):
87
+ def _DetectObjects (self , env , marker_topic , marker_data_path , kinbody_path ,
88
+ detection_frame , destination_frame ,** kw_args ):
85
89
"""
86
90
Use the apriltags service to detect objects and add them to the
87
- environment
91
+ environment. Params are as in __init__.
92
+
93
+ @param env: The current OpenRAVE environment
94
+ @param marker_topic The ROS topic to read markers from. Typically the output topic for April Tags
95
+ @param marker_data_path The json file where the association between tag and object is stored
96
+ @param kinbody_path The path to the folder where kinbodies are stored
97
+ @param detection_frame The TF frame of the camera
98
+ @param destination_frame The desired world TF frame
99
+
100
+ @return The list of kinbodies associated with the detected apriltags
88
101
"""
89
102
try :
90
103
# Allow caller to override any of the initial parameters
91
104
# 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
105
+ if marker_topic is None :
106
+ marker_topic = self .marker_topic
96
107
97
- if 'kinbody_path' in kw_args :
98
- kinbody_path = kw_args ['kinbody_path' ]
99
- else :
108
+ if marker_data_path is None :
109
+ marker_data_path = self .marker_data_path
110
+
111
+ if kinbody_path is None :
100
112
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
113
+
106
114
107
- if 'detection_frame' in kw_args :
108
- detection_frame = kw_args ['detection_frame' ]
109
- else :
115
+ if detection_frame is None :
110
116
detection_frame = self .detection_frame
111
117
112
- if 'destination_frame' in kw_args :
113
- destination_frame = kw_args ['destination_frame' ]
114
- else :
118
+ if destination_frame is None :
115
119
destination_frame = self .destination_frame
116
120
117
121
# TODO: Creating detector is not instant...might want
0 commit comments