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