Skip to content

Commit e5086db

Browse files
committed
Debug odp service
1 parent e56b21a commit e5086db

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

src/apc_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def execute_perception(self, bin_name, target_object):
144144

145145
timestamp = utils.datetime_now_string()
146146

147-
perception_file = '{}.json'.format(timestamp)
147+
perception_file = osp.join(self.perception_request_dir, '{}.json'.format(timestamp))
148148

149149
with open(perception_file, 'w') as f:
150150
json.dump(perception_request, f)

src/perception/apc_odp_service.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ def process_detections(self, cloud_path, feature_path, calib_path, hypothesis_na
162162
full_pcd = cloud_path
163163
feat = feature_path
164164
caminfo = calib_path
165-
js = self.detector.process(img, mask, pcd, full_pcd, feat, caminfo, '', '',
166-
str(','.join(hypothesis_names)))
165+
js = self.detector.process_apc(img, mask, pcd, full_pcd, feat, caminfo, '', '',
166+
str(','.join(hypothesis_names)))
167167

168168
# check_call(['rm', pcd])
169169
# check_call(['rm', pcd.replace('.pcd', '.jpg')])
@@ -234,8 +234,8 @@ def detect_scene(self, image_path, depth_map_path, cloud_path, segment_base, det
234234
obj_ids.append(obj_id)
235235
poses.append(d['zz_pose_map'][obj_id])
236236

237-
viz_img = APCDetector.viz_detections(image_path, obj_ids, poses, rgb_K)
238-
imsave('detections.png', viz_img)
237+
# viz_img = APCDetector.viz_detections(image_path, obj_ids, poses, rgb_K)
238+
# imsave('detections.png', viz_img)
239239

240240
return obj_ids, poses
241241

@@ -287,7 +287,10 @@ def run_pipeline(self, image_file, depth_file, transform_file, cubbyhole, hypoth
287287
poses = [self.get_pose_matrix(pose) for pose in poses]
288288

289289
# Remove data
290-
check_call(['rm', 'cloud.pcd', 'features.h5', 'detection_out.json', 'detections.png'])
290+
check_call(['rm',
291+
# 'cloud.pcd',
292+
'features.h5',
293+
'detection_out.json'])
291294

292295
return obj_ids, poses
293296

@@ -359,10 +362,14 @@ def process_cubbyhole(self, event):
359362
print e
360363
return
361364

362-
object_poses_json = {obj_id: pose for obj_id, pose in zip(obj_ids, poses)}
363-
object_poses_file = os.path.join(self.object_poses_directory, '{}.json'.format(cubbyhole_name))
365+
object_poses_json = {obj_id: np.array(pose).tolist() for obj_id, pose in zip(obj_ids, poses)}
366+
object_poses_file = os.path.join(self.object_poses_directory,
367+
os.path.basename(event.src_path))
364368
with open(object_poses_file, 'w') as f:
365-
json.dump(object_poses_json, f)
369+
json.dump({
370+
'bin_name': cubbyhole_name,
371+
'object_poses': object_poses_json
372+
}, f)
366373
if self.ssh_object_poses_directory is not None:
367374
check_call(['scp', object_poses_file, self.ssh_object_poses_directory])
368375

src/rviz_marker_pose_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def on_modified(self, event):
8080
if not event.is_directory:
8181
with open(event.src_path, 'r') as f:
8282
bin = json.load(f)
83-
bin_name = osp.splitext(osp.basename(event.src_path))[0]
84-
self.bins[bin_name] = bin
83+
bin_name = bin['bin_name']
84+
self.bins[bin_name] = bin['object_poses']
8585

8686
def handle_get_object_pose(self, req):
8787
bin_name = req.bin_name

0 commit comments

Comments
 (0)