Beispiel #1
0
    def move(self,
             width: float,
             speed: float = 0.05,
             wait_for_result: bool = False) -> bool:
        """Moves the gripper fingers to a specified width.

        Args:
            width (float): Intended opening width [m].
            speed (float, optionnal): Closing speed [m/s]. Default to 0.05.
            wait_for_result (bool): If True, this method will block until
                response is recieved from server.

        Returns:
            bool: Whether command was successful.
        """
        width = self._clip_width(width)
        goal = MoveGoal()
        goal.width = width
        goal.speed = speed
        self._move_action_client.send_goal(goal)
        if wait_for_result:
            return self._move_action_client.wait_for_result(
                timeout=rospy.Duration(15.0))
        else:
            return True
Beispiel #2
0
    def move_joints(self, width, speed=None, wait_for_result=True):
        """
        Moves the gripper fingers to a specified width.
       
        :param width: Intended opening width. [m]
        :param speed: Closing speed. [m/s]
        :param wait_for_result: if True, this method will block till response is 
                                    recieved from server

        :type width: float
        :type speed: float
        :type wait_for_result: bool
       
        :return: True if command was successful, False otherwise.
        :rtype: bool
        """
        self._caller = "move_joints"

        goal = MoveGoal()
        if not speed:
            speed = self._gripper_speed
        goal.width = width
        goal.speed = speed

        self._move_action_client.send_goal(goal,
                                           done_cb=self._done_cb,
                                           active_cb=self._active_cb,
                                           feedback_cb=self._feedback_cb)

        if wait_for_result:
            result = self._move_action_client.wait_for_result(
                rospy.Duration(15.))
            return result

        return True
Beispiel #3
0
 def moveGripper(self, width, speed=0.5):
     width_normalized = self._normalize(width, self._MIN_WIDTH, self._MAX_WIDTH)
     if self._real_robot:
         # Create goal
         goal = MoveGoal()
         goal.width = self.safe_width(width_normalized)
         goal.speed = speed
         # Send goal
         self._client_move.send_goal_and_wait(goal, rospy.Duration.from_sec(self._timeout))
     else:
         self._moveHand(width_normalized)
     self._current_width = width_normalized
Beispiel #4
0
    def btn_left_gripper_open_on_click(self):
        req = MoveGoal(width=0.075, speed=0.1)

        if self.panda_gripper_grasp_client.wait_for_server(
                rospy.Duration(1.0)):
            self.panda_gripper_move_client.send_goal(req)
            self._widget.textBrowser.append("LEFT: gripper_open")
        else:
            self._widget.textBrowser.append(
                "SERVER NOT WORKING -- LEFT: gripper_open")
Beispiel #5
0
 def gripper_move(self,
                  width,
                  epsilon_inner=0.05,
                  epsilon_outer=0.05,
                  speed=0.1,
                  force=60):
     goal = MoveGoal(width=width, speed=speed)
     rospy.loginfo('Moving gripper:\n{}'.format(goal))
     self._gripper_move.send_goal(goal)
     self._gripper_move.wait_for_result()
     if not self._gripper_move.get_result().success:
         rospy.logerr("Couldn't move gripper")
         sys.exit(1)
Beispiel #6
0
def open_gripper():
    """Opens robot gripper

    If using ``real_panda`` then call move gripper action server. If using gazebo then publish desired
    grip width to */franka/gripper_width* topic.

    Returns:
        bool: returns True when done.

      """

    if real_panda:
        client = actionlib.SimpleActionClient('/franka_gripper/move', MoveAction)
        client.wait_for_server()
        goal = MoveGoal(width = 0.08, speed = 0.04)
        client.send_goal(goal)
        client.wait_for_result(rospy.Duration.from_sec(5.0))
    else:
        pub_gripper.publish(0.12)
        rospy.sleep(2)
    return True
Beispiel #7
0
 def gripper_action_client(self, width, speed=0.1):
     '''moves to a target width with the defined speed.'''
     self.gripper_client.send_goal(MoveGoal(width, speed))
     self.gripper_client.wait_for_result()
     self._feedback_publisher.publish(Action(status=0))
     return self.gripper_client.get_result()
Beispiel #8
0
#!/usr/bin/env python2

import rospy
import actionlib
from franka_gripper.msg import MoveGoal, MoveAction, GraspAction, StopAction, GraspGoal, StopGoal
import curses

if __name__ == '__main__':
    rospy.init_node('Franka_gripper_move_action')
    client = actionlib.SimpleActionClient('/franka_gripper/move', MoveAction)
    client.wait_for_server()
    goal = MoveGoal(width=0.1, speed=0.04)
    client.send_goal(goal)
    client.wait_for_result(rospy.Duration.from_sec(5.0))

    max_open = 0.1
    min_open = 0
    set_width = 0.1
    #step_size = 0.01
    grasp = 0.07
    release = 0.09

    # get the curses screen window
    screen = curses.initscr()

    # turn off input echoing
    curses.noecho()

    # respond to keys immediately (don't wait for enter)
    curses.cbreak()