Prevent the floor from being selected as a target

This commit is contained in:
Michel Breyer 2021-07-07 10:44:57 +02:00
parent 71eac8d295
commit 37bef05d70

View File

@ -103,6 +103,8 @@ class Simulation(BtSim):
def select_target(self):
img = self.camera.get_image()
uids, counts = np.unique(img.mask, return_counts=True)
mask = np.isin(uids, self.object_uids) # remove ids of the floor, table, etc
uids, counts = uids[mask], counts[mask]
target_uid = uids[np.argmin(counts)]
p.changeVisualShape(target_uid, -1, rgbaColor=[1, 0, 0, 1])
return target_uid