Minimum gain and max duration stopping criteria
This commit is contained in:
parent
d3e0d58c05
commit
327826de90
@ -9,6 +9,8 @@ from vgn.utils import look_at, spherical_to_cartesian
|
|||||||
class NextBestView(BasePolicy):
|
class NextBestView(BasePolicy):
|
||||||
def __init__(self, rate, filter_grasps):
|
def __init__(self, rate, filter_grasps):
|
||||||
super().__init__(rate, filter_grasps)
|
super().__init__(rate, filter_grasps)
|
||||||
|
self.max_viewpoints = 20
|
||||||
|
self.min_gain = 10.0
|
||||||
|
|
||||||
def activate(self, bbox):
|
def activate(self, bbox):
|
||||||
super().activate(bbox)
|
super().activate(bbox)
|
||||||
@ -29,9 +31,10 @@ class NextBestView(BasePolicy):
|
|||||||
self.visualizer.views(self.base_frame, self.intrinsic, views, utilities)
|
self.visualizer.views(self.base_frame, self.intrinsic, views, utilities)
|
||||||
|
|
||||||
# Determine next-best-view
|
# Determine next-best-view
|
||||||
nbv = views[np.argmax(utilities)]
|
i = np.argmax(utilities)
|
||||||
|
nbv, g = views[i], gains[i]
|
||||||
|
|
||||||
if self.check_done():
|
if self.check_done(g):
|
||||||
self.best_grasp = self.compute_best_grasp()
|
self.best_grasp = self.compute_best_grasp()
|
||||||
self.done = True
|
self.done = True
|
||||||
return
|
return
|
||||||
@ -114,5 +117,5 @@ class NextBestView(BasePolicy):
|
|||||||
def compute_cost(self, view):
|
def compute_cost(self, view):
|
||||||
return 1.0
|
return 1.0
|
||||||
|
|
||||||
def check_done(self):
|
def check_done(self, gain):
|
||||||
return len(self.viewpoints) == 4
|
return len(self.viewpoints) > self.max_viewpoints or gain < self.min_gain
|
||||||
|
Loading…
x
Reference in New Issue
Block a user