def do_perception(self, req): rospy.loginfo("[grasp_obj_button] Perceiving object buttons...") # perceive object on table self.objects = self.obj_seg_srv().objects for i in range(len(self.objects)): self.objects[i].color.r = 256 self.objects[i].color.g = 0 self.objects[i].color.b = 0 self.objects[i].color.a = 256 # return object buttons resp = PerceiveButtonsResponse() resp.buttons = self.objects return resp
def do_perception(self, req): # segment surfaces rospy.loginfo("[move_floor_button] Segmenting floor") self.surfaces = self.floor_seg_srv().surfaces for i in range(len(self.surfaces)): self.surfaces[i].color.r = 0 self.surfaces[i].color.g = 0 self.surfaces[i].color.b = 256 self.surfaces[i].color.a = 256 if len(self.surfaces) != 0: self.percept_pub.publish(self.surfaces[0]) resp = PerceiveButtonsResponse() resp.buttons = self.surfaces return resp
def do_perception(self, req): # capture a few clouds rate = rospy.Rate(5) for i in range(5): self.pc_capture_srv() rate.sleep() # segment surfaces self.surfaces = self.table_seg_srv().surfaces for i in range(len(self.surfaces)): self.surfaces[i].color.r = 0 self.surfaces[i].color.g = 256 self.surfaces[i].color.b = 0 self.surfaces[i].color.a = 256 self.percept_pub.publish(self.surfaces[0]) resp = PerceiveButtonsResponse() resp.buttons = self.surfaces return resp
def do_perception(self, req): rospy.loginfo("[place_object] Perceiving table...") # capture a few clouds rate = rospy.Rate(5) for i in range(5): self.pc_capture_srv() rate.sleep() # segment surfaces self.surfaces = self.table_seg_srv().surfaces for i in range(len(self.surfaces)): self.surfaces[i].color.r = 256 self.surfaces[i].color.g = 0 self.surfaces[i].color.b = 256 self.surfaces[i].color.a = 256 resp = PerceiveButtonsResponse() resp.buttons = self.surfaces return resp