Skip to content

Commit 71dc8cd

Browse files
author
Shushman Choudhury
committed
Last minor changes for merge
1 parent 41b0605 commit 71dc8cd

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/prpy/perception/apriltags.py

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ def __init__(self, marker_topic, marker_data_path, kinbody_path,
5858

5959

6060
def __str__(self):
61-
return 'Apriltags'
61+
return self.__class__.__name__
6262

6363
def DetectObjects(self, env, object_names, **kw_args):
6464
"""
6565
This hack detects only the objects in object_names. Updates existing
6666
objects, but only adds objects in the object_names list.
6767
"""
68-
added_kinbodies, updated_kinbodies = self.DetectObjects(robot, **kw_args);
68+
added_kinbodies, updated_kinbodies = self._DetectObjects(env, **kw_args);
6969
detected = [];
7070
for body in added_kinbodies:
7171
if not (body.GetName() in object_names):
@@ -81,37 +81,29 @@ def DetectObject(self, env, object_name, **kw_args):
8181
return (self._DetectObjects( env, object_names=[object_name], **kw_args))[0][0];
8282

8383

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):
8586
"""
8687
Use the apriltags service to detect objects and add them to the
87-
environment
88+
environment. Params are as in __init__.
8889
"""
8990
try:
9091
# Allow caller to override any of the initial parameters
9192
# 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
9695

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:
100100
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+
106102

107-
if 'detection_frame' in kw_args:
108-
detection_frame = kw_args['detection_frame']
109-
else:
103+
if detection_frame is None:
110104
detection_frame = self.detection_frame
111105

112-
if 'destination_frame' in kw_args:
113-
destination_frame = kw_args['destination_frame']
114-
else:
106+
if destination_frame is None:
115107
destination_frame = self.destination_frame
116108

117109
# TODO: Creating detector is not instant...might want

src/prpy/perception/block_detector.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def find_blocks(self,service_name="tools_server/find_blocks",
6363
@param segment_box: flag to discard points outside of (box_min, box_max)
6464
@param box_min: minimum coordinsates of search area in camera frame
6565
@param box_max: maximum coordinsates of search area in camera frame
66+
67+
@return list of blocks found, if any
6668
"""
6769

6870
logging.info("waiting for service...")
@@ -89,7 +91,13 @@ def find_blocks(self,service_name="tools_server/find_blocks",
8991
@PerceptionMethod
9092
def DetectBlocks(self, robot, table, blocks=None,timeout=10, **kw_args):
9193
"""
92-
Place blocks on the table
94+
Calls detector for blocks and places them on the table
95+
96+
@param robot: The robot instance using the detector
97+
@param table: The kinbody for the table on which the blocks are placed
98+
@blocks: List of blocks currently in the environment; if present, redetection not done
99+
100+
@return The list of blocks detected
93101
"""
94102
if blocks is not None and len(blocks) == 0:
95103
# Add all blocks

0 commit comments

Comments
 (0)