Read nbv params from the rosparam server

This commit is contained in:
Michel Breyer 2021-10-08 15:41:50 +02:00
parent 5e1876432b
commit fcc5045671
4 changed files with 17 additions and 7 deletions

View File

@ -1,6 +1,6 @@
bt_sim: bt_sim:
gui: False gui: False
cam_noise: True cam_noise: False
scene: kitchen.yaml scene: kitchen.yaml
grasp_controller: grasp_controller:
@ -8,7 +8,6 @@ grasp_controller:
ee_grasp_offset: [0.0, 0.0, -0.383, 0.924, 0.0, 0.0, 0.065] # offset to panda_link8 ee_grasp_offset: [0.0, 0.0, -0.383, 0.924, 0.0, 0.0, 0.065] # offset to panda_link8
control_rate: 30 control_rate: 30
linear_vel: 0.05 linear_vel: 0.05
policy_rate: 2
camera: camera:
frame_id: camera_depth_optical_frame frame_id: camera_depth_optical_frame
info_topic: /camera/depth/camera_info info_topic: /camera/depth/camera_info
@ -19,3 +18,11 @@ vgn:
model: $(find vgn)/assets/models/vgn_conv.pth model: $(find vgn)/assets/models/vgn_conv.pth
finger_depth: 0.05 finger_depth: 0.05
qual_threshold: 0.9 qual_threshold: 0.9
policy:
rate: 2
window_size: 6
nbv_grasp:
max_views: 30
min_gain: 0.0

View File

@ -34,7 +34,7 @@ class GraspController:
self.min_z_dist = rospy.get_param("~camera/min_z_dist") self.min_z_dist = rospy.get_param("~camera/min_z_dist")
self.control_rate = rospy.get_param("~control_rate") self.control_rate = rospy.get_param("~control_rate")
self.linear_vel = rospy.get_param("~linear_vel") self.linear_vel = rospy.get_param("~linear_vel")
self.policy_rate = rospy.get_param("~policy_rate") self.policy_rate = rospy.get_param("policy/rate")
def init_service_proxies(self): def init_service_proxies(self):
self.reset_env = rospy.ServiceProxy("reset", Reset) self.reset_env = rospy.ServiceProxy("reset", Reset)

View File

@ -57,8 +57,8 @@ class NextBestView(MultiViewPolicy):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.min_z_dist = rospy.get_param("~camera/min_z_dist") self.min_z_dist = rospy.get_param("~camera/min_z_dist")
self.max_views = 50 self.max_views = rospy.get_param("nbv_grasp/max_views")
self.min_gain = 0.0 self.min_gain = rospy.get_param("nbv_grasp/min_gain")
def activate(self, bbox, view_sphere): def activate(self, bbox, view_sphere):
super().activate(bbox, view_sphere) super().activate(bbox, view_sphere)

View File

@ -118,9 +118,12 @@ class SingleViewPolicy(Policy):
class MultiViewPolicy(Policy): class MultiViewPolicy(Policy):
def __init__(self):
super().__init__()
self.T = rospy.get_param("policy/window_size")
def activate(self, bbox, view_sphere): def activate(self, bbox, view_sphere):
super().activate(bbox, view_sphere) super().activate(bbox, view_sphere)
self.T = 10 # Window size of grasp prediction history
self.qual_hist = np.zeros((self.T,) + (40,) * 3, np.float32) self.qual_hist = np.zeros((self.T,) + (40,) * 3, np.float32)
def integrate(self, img, x, q): def integrate(self, img, x, q):