def run_drop(self, object_name):

        place_goal = PlaceGoal()
        place_goal.group_name = "left_arm"
        place_goal.attached_object_name = object_name
        place_goal.place_eef = True
        place_goal.place_locations = self.get_place_locations()
        place_goal.allowed_planning_time = 5.0
        place_goal.planning_options.planning_scene_diff.is_diff = True
        place_goal.planning_options.planning_scene_diff.robot_state.is_diff = True

        self.place_client.send_goal(place_goal)
        self.place_client.wait_for_result()
        place_result = self.place_client.get_result()
        print 'Place result: %d' % (place_result.error_code.val,)
        if place_result.error_code.val == 1:
            return True
        else:
            return False
Exemplo n.º 2
0
    def run_drop(self, object_name):

        place_goal = PlaceGoal()
        place_goal.group_name = "left_arm"
        place_goal.attached_object_name = object_name
        place_goal.place_eef = True
        place_goal.place_locations = self.get_place_locations()
        place_goal.allowed_planning_time = 5.0
        place_goal.planning_options.planning_scene_diff.is_diff = True
        place_goal.planning_options.planning_scene_diff.robot_state.is_diff = True

        self.place_client.send_goal(place_goal)
        self.place_client.wait_for_result()
        place_result = self.place_client.get_result()
        print 'Place result: %d' % (place_result.error_code.val, )
        if place_result.error_code.val == 1:
            return True
        else:
            return False
Exemplo n.º 3
0
    def place(self, name, locations, wait=True, **kwargs):
        # Check arguments
        supported_args = ("allow_gripper_support_collision",
                          "allowed_touch_objects", "goal_is_eef", "plan_only",
                          "planner_id", "planning_scene_diff", "planning_time",
                          "support_name")
        for arg in kwargs.keys():
            if not arg in supported_args:
                rospy.loginfo("place: unsupported argument: %s", arg)

        # Create goal
        g = PlaceGoal()

        # 1. Name of ARM planning group
        g.group_name = self._group

        # 2. Name of attached object to place
        g.attached_object_name = name

        # 3. Possible locations to place
        g.place_locations = locations

        # 4. If true, using eef pose (same as pick)
        try:
            g.place_eef = kwargs["goal_is_eef"]
        except KeyError:
            g.place_eef = False

        # 5. Fill in support surface
        try:
            g.support_surface_name = kwargs["support_name"]
        except KeyError:
            g.support_surface_name = ""

        # 6. Can gripper contact the support surface (named above)
        try:
            g.allow_gripper_support_collision = kwargs[
                "allow_gripper_support_collision"]
        except KeyError:
            g.allow_gripper_support_collision = True

        # 8. Fill in path_constraints

        # 9. Fill in planner id
        try:
            g.planner_id = kwargs["planner_id"]
        except KeyError:
            if self.planner_id:
                g.planner_id = self.planner_id

        # 10. List of obstacles that we are allowed to touch
        try:
            g.allowed_touch_objects = kwargs["allowed_touch_objects"]
        except KeyError:
            g.allowed_touch_objects = list()

        # 11. Planning time
        try:
            g.allowed_planning_time = kwargs["planning_time"]
        except KeyError:
            g.allowed_planning_time = self.allowed_planning_time

        # 12. Planning options
        try:
            g.planning_options.planning_scene_diff = kwargs[
                "planning_scene_diff"]
        except KeyError:
            g.planning_options.planning_scene_diff.is_diff = True
            g.planning_options.planning_scene_diff.robot_state.is_diff = True
        g.planning_options.plan_only = self._plan_only

        self._place_action.send_goal(g)
        if wait:
            self._place_action.wait_for_result()
            return self._place_action.get_result()
        else:
            return None
    def place(self, name, locations, wait=True, **kwargs):
        # Check arguments
        supported_args = ("allow_gripper_support_collision",
                          "allowed_touch_objects",
                          "goal_is_eef",
                          "plan_only",
                          "planner_id",
                          "planning_time",
                          "support_name")
        for arg in kwargs.keys():
            if not arg in supported_args:
                rospy.loginfo("place: unsupported argument: %s", arg)

        # Create goal
        g = PlaceGoal()

        # 1. Name of ARM planning group
        g.group_name = self._group

        # 2. Name of attached object to place
        g.attached_object_name = name

        # 3. Possible locations to place
        g.place_locations = locations

        # 4. If true, using eef pose (same as pick)
        try:
            g.place_eef = kwargs["goal_is_eef"]
        except KeyError:
            g.place_eef = False

        # 5. Fill in support surface
        try:
            g.support_surface_name = kwargs["support_name"]
        except KeyError:
            g.support_surface_name = ""

        # 6. Can gripper contact the support surface (named above)
        try:
            g.allow_gripper_support_collision = kwargs["allow_gripper_support_collision"]
        except KeyError:
            g.allow_gripper_support_collision = True

        # 8. Fill in path_constraints

        # 9. Fill in planner id
        try:
            g.planner_id = kwargs["planner_id"]
        except KeyError:
            if self.planner_id:
                g.planner_id = self.planner_id

        # 10. List of obstacles that we are allowed to touch
        try:
            g.allowed_touch_objects = kwargs["allowed_touch_objects"]
        except KeyError:
            g.allowed_touch_objects = list()

        # 11. Planning time
        try:
            g.allowed_planning_time = kwargs["planning_time"]
        except KeyError:
            g.allowed_planning_time = self.allowed_planning_time

        # 12. Planning options
        g.planning_options.planning_scene_diff.is_diff = True
        g.planning_options.planning_scene_diff.robot_state.is_diff = True
        g.planning_options.plan_only = self._plan_only

        self._place_action.send_goal(g)
        if wait:
            self._place_action.wait_for_result()
            return self._place_action.get_result()
        else:
            return None