Change score function
This commit is contained in:
parent
6c0a39b175
commit
184b380ea9
@ -16,7 +16,7 @@ class InitialView(SingleViewPolicy):
|
||||
class TopView(SingleViewPolicy):
|
||||
def activate(self, bbox):
|
||||
super().activate(bbox)
|
||||
eye = np.r_[self.center[:2], self.center[2] + self.min_z_dist]
|
||||
eye = np.r_[self.center[:2], self.center[2] + 0.3]
|
||||
up = np.r_[1.0, 0.0, 0.0]
|
||||
self.x_d = look_at(eye, self.center, up)
|
||||
|
||||
@ -24,7 +24,7 @@ class TopView(SingleViewPolicy):
|
||||
class TopTrajectory(MultiViewPolicy):
|
||||
def activate(self, bbox):
|
||||
super().activate(bbox)
|
||||
eye = np.r_[self.center[:2], self.center[2] + self.min_z_dist]
|
||||
eye = np.r_[self.center[:2], self.center[2] + 0.3]
|
||||
up = np.r_[1.0, 0.0, 0.0]
|
||||
self.x_d = look_at(eye, self.center, up)
|
||||
|
||||
@ -42,7 +42,7 @@ class CircularTrajectory(MultiViewPolicy):
|
||||
def __init__(self, rate):
|
||||
super().__init__(rate)
|
||||
self.r = 0.12
|
||||
self.h = self.min_z_dist
|
||||
self.h = 0.3
|
||||
self.duration = 2.0 * np.pi * self.r / self.linear_vel
|
||||
self.m = scipy.interpolate.interp1d([0.0, self.duration], [np.pi, 3.0 * np.pi])
|
||||
|
||||
|
@ -121,6 +121,7 @@ class GraspController:
|
||||
rot = T_base_grasp.rotation
|
||||
if rot.as_matrix()[:, 0][0] < 0: # Ensure that the camera is pointing forward
|
||||
T_base_grasp.rotation = rot * Rotation.from_euler("z", np.pi)
|
||||
T_base_grasp *= Transform.t([0.0, 0.0, 0.01])
|
||||
return T_base_grasp
|
||||
|
||||
def collect_info(self, result):
|
||||
|
@ -1,7 +1,6 @@
|
||||
import itertools
|
||||
import numpy as np
|
||||
from numpy.lib.twodim_base import eye
|
||||
from scipy.ndimage.measurements import center_of_mass
|
||||
import rospy
|
||||
|
||||
from .policy import MultiViewPolicy
|
||||
from vgn.utils import look_at, spherical_to_cartesian
|
||||
@ -30,9 +29,9 @@ class NextBestView(MultiViewPolicy):
|
||||
i = np.argmax(utilities)
|
||||
nbv, ig = views[i], gains[i]
|
||||
|
||||
if ig < self.min_ig:
|
||||
self.done = True
|
||||
return np.zeros(6)
|
||||
# if ig < self.min_ig:
|
||||
# self.done = True
|
||||
# return np.zeros(6)
|
||||
|
||||
cmd = self.compute_velocity_cmd(*self.compute_error(nbv, x))
|
||||
|
||||
@ -51,7 +50,7 @@ class NextBestView(MultiViewPolicy):
|
||||
return cmd
|
||||
|
||||
def generate_views(self):
|
||||
r, h = 0.14, 0.2
|
||||
r, h = 0.18, 0.2
|
||||
thetas = np.arange(1, 4) * np.deg2rad(30)
|
||||
phis = np.arange(1, 6) * np.deg2rad(60)
|
||||
views = []
|
||||
|
@ -78,7 +78,8 @@ class Policy:
|
||||
return grasps[indices], scores[indices]
|
||||
|
||||
def score_fn(self, grasp):
|
||||
return grasp.quality
|
||||
# return grasp.quality
|
||||
return grasp.pose.translation[2]
|
||||
|
||||
def update(self, img, pose):
|
||||
raise NotImplementedError
|
||||
|
Loading…
x
Reference in New Issue
Block a user