Prevent the floor from being selected as a target
This commit is contained in:
parent
71eac8d295
commit
37bef05d70
@ -103,6 +103,8 @@ class Simulation(BtSim):
|
|||||||
def select_target(self):
|
def select_target(self):
|
||||||
img = self.camera.get_image()
|
img = self.camera.get_image()
|
||||||
uids, counts = np.unique(img.mask, return_counts=True)
|
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)]
|
target_uid = uids[np.argmin(counts)]
|
||||||
p.changeVisualShape(target_uid, -1, rgbaColor=[1, 0, 0, 1])
|
p.changeVisualShape(target_uid, -1, rgbaColor=[1, 0, 0, 1])
|
||||||
return target_uid
|
return target_uid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user