当前位置: 首页>>代码示例>>Python>>正文


Python actionlib.SimpleActionClient方法代码示例

本文整理汇总了Python中actionlib.SimpleActionClient方法的典型用法代码示例。如果您正苦于以下问题:Python actionlib.SimpleActionClient方法的具体用法?Python actionlib.SimpleActionClient怎么用?Python actionlib.SimpleActionClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在actionlib的用法示例。


在下文中一共展示了actionlib.SimpleActionClient方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def __init__(self, limb="right"):
        """
        @param limb: Limb to run CalibrateArm on arm side.
        """
        self._limb=limb
        self._client = actionlib.SimpleActionClient('/calibration_command',
                                   CalibrationCommandAction)
        # Waits until the action server has started up and started
        # listening for goals.
        server_up = self._client.wait_for_server(rospy.Duration(10.0))
        if not server_up:
            rospy.logerr("Timed out waiting for Calibration"
                         " Server to connect. Check your ROS networking"
                         "  and/or reboot the robot.")
            rospy.signal_shutdown("Timed out waiting for Action Server")
            sys.exit(1) 
开发者ID:RethinkRobotics,项目名称:intera_sdk,代码行数:18,代码来源:calibrate_arm.py

示例2: __init__

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def __init__(self, pr2, lr):
        assert isinstance(pr2, PR2)
        self.pr2 = pr2
        self.lr = lr
        self.controller_name = "%s_gripper_controller" % self.lr
        self.joint_names = [rospy.get_param("/%s/joint" % self.controller_name)]
        self.n_joints = len(self.joint_names)

        msg = self.pr2.get_last_joint_message()
        self.ros_joint_inds = [msg.name.index(name) for name in self.joint_names]
        self.rave_joint_inds = [pr2.robot.GetJointIndex(name) for name in self.joint_names]

        self.controller_pub = rospy.Publisher("%s/command" % self.controller_name, pcm.Pr2GripperCommand)

        self.grip_client = actionlib.SimpleActionClient('%s_gripper_controller/gripper_action' % lr,
                                                        pcm.Pr2GripperCommandAction)
        # self.grip_client.wait_for_server()
        self.vel_limits = [.033]
        self.acc_limits = [inf]

        self.diag_pub = rospy.Publisher("/%s_gripper_traj_diagnostic" % lr, tm.JointTrajectory)
        # XXX
        self.closed_angle = 0 
开发者ID:alexlee-gk,项目名称:visual_dynamics,代码行数:25,代码来源:PR2.py

示例3: __init__

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def __init__(self, limb, joint_names):
        self._joint_names = joint_names
        ns = 'robot/limb/' + limb + '/'
        self._client = actionlib.SimpleActionClient(
            ns + "follow_joint_trajectory",
            FollowJointTrajectoryAction,
        )
        self._goal = FollowJointTrajectoryGoal()
        self._goal_time_tolerance = rospy.Time(0.1)
        self._goal.goal_time_tolerance = self._goal_time_tolerance
        server_up = self._client.wait_for_server(timeout=rospy.Duration(10.0))
        if not server_up:
            rospy.logerr("Timed out waiting for Joint Trajectory"
                         " Action Server to connect. Start the action server"
                         " before running example.")
            rospy.signal_shutdown("Timed out waiting for Action Server")
            sys.exit(1)
        self.clear(limb) 
开发者ID:RethinkRobotics,项目名称:intera_sdk,代码行数:20,代码来源:joint_trajectory_client.py

示例4: send_matlab_goal

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def send_matlab_goal(self, cmd, cmd_type):
        self.action_client_matlab = actionlib.SimpleActionClient('/niryo_one/commander/robot_action',
                                                                 niryo_one_msgs.msg.RobotMoveAction)
        rospy.loginfo("waiting for action server: niryo_one/robot_action....")
        self.action_client_matlab.wait_for_server()
        rospy.loginfo("Found action server : niryo_one/robot_action")
        goal = RobotMoveGoal()
        goal.cmd.joints = cmd
        goal.cmd.cmd_type = cmd_type
        self.action_client_matlab.send_goal(goal)
        rospy.loginfo("waiting for result")
        self.action_client_matlab.wait_for_result()
        response = self.action_client_matlab.get_result()
        rospy.loginfo("..........result.................")
        rospy.loginfo(response)
        result = self.create_response(response.status, response.message)
        return response 
开发者ID:NiryoRobotics,项目名称:niryo_one_ros,代码行数:19,代码来源:matlab_manager.py

示例5: grasp

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def grasp(self, width=0, e_inner=0.1, e_outer=0.1, speed=0.1, force=1):
        """
        Wrapper around the franka_gripper/grasp action.
        http://docs.ros.org/kinetic/api/franka_gripper/html/action/Grasp.html
        :param width: Width (m) to grip
        :param e_inner: epsilon inner
        :param e_outer: epsilon outer
        :param speed: Move velocity (m/s)
        :param force: Force to apply (N)
        :return: Bool success
        """
        client = actionlib.SimpleActionClient('franka_gripper/grasp', franka_gripper.msg.GraspAction)
        client.wait_for_server()
        client.send_goal(
            franka_gripper.msg.GraspGoal(
                width,
                franka_gripper.msg.GraspEpsilon(e_inner, e_outer),
                speed,
                force
            )
        )
        return client.wait_for_result() 
开发者ID:dougsm,项目名称:mvp_grasp,代码行数:24,代码来源:panda_commander.py

示例6: __init__

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def __init__(self, limb):
        self.waiting = False
        self.jointnames = ['s0', 's1', 'e0', 'e1', 'w0', 'w1', 'w2']
        ns = 'robot/limb/' + limb + '/'
        self._client = actionlib.SimpleActionClient(
            ns + "follow_joint_trajectory",
            FollowJointTrajectoryAction,
        )
        self._goal = FollowJointTrajectoryGoal()
        server_up = self._client.wait_for_server(timeout=rospy.Duration(10.0))
        if not server_up:
            rospy.logerr("Timed out waiting for Joint Trajectory"
                         " Action Server to connect. Start the action server"
                         " before running example.")
            rospy.signal_shutdown("Timed out waiting for Action Server")
            sys.exit(1)
        self.clear(limb) 
开发者ID:osrf,项目名称:baxter_demos,代码行数:19,代码来源:common.py

示例7: __init__

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def __init__(self):
        # ROS initialization:
        rospy.init_node('pose_manager')

        self.poseLibrary = dict()
        self.readInPoses()
        self.poseServer = actionlib.SimpleActionServer("body_pose", BodyPoseAction,
                                                       execute_cb=self.executeBodyPose,
                                                       auto_start=False)
        self.trajectoryClient = actionlib.SimpleActionClient("joint_trajectory", JointTrajectoryAction)
        if self.trajectoryClient.wait_for_server(rospy.Duration(3.0)):
            try:
                rospy.wait_for_service("stop_walk_srv", timeout=2.0)
                self.stopWalkSrv = rospy.ServiceProxy("stop_walk_srv", Empty)
            except:
                rospy.logwarn("stop_walk_srv not available, pose_manager will not stop the walker before executing a trajectory. "
                          +"This is normal if there is no nao_walker running.")
            self.stopWalkSrv = None
            self.poseServer.start()

            rospy.loginfo("pose_manager running, offering poses: %s", self.poseLibrary.keys());

        else:
            rospy.logfatal("Could not connect to required \"joint_trajectory\" action server, is the nao_controller node running?");
            rospy.signal_shutdown("Required component missing"); 
开发者ID:ros-naoqi,项目名称:naoqi_bridge,代码行数:27,代码来源:pose_manager.py

示例8: fibonacci_client

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def fibonacci_client():
    # Creates the SimpleActionClient, passing the type of the action
    # (FibonacciAction) to the constructor.
    client = actionlib.SimpleActionClient('fibonacci', actionlib_tutorials.msg.FibonacciAction)

    # Waits until the action server has started up and started
    # listening for goals.
    client.wait_for_server()

    # Creates a goal to send to the action server.
    goal = actionlib_tutorials.msg.FibonacciGoal(order=20)

    # Sends the goal to the action server.
    client.send_goal(goal)

    # Waits for the server to finish performing the action.
    client.wait_for_result()

    # Prints out the result of executing the action
    return client.get_result()  # A FibonacciResult 
开发者ID:toddsampson,项目名称:ros-docker,代码行数:22,代码来源:fibonacci_client.py

示例9: setupClient

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def setupClient(self, topic, msg_type, wait_duration=10):
        """
        Tries to set up an action client for calling it later.

        @type topic: string
        @param topic: The topic of the action to call.

        @type msg_type: msg type
        @param msg_type: The type of messages of this action client.

        @type wait_duration: int
        @param wait_duration: Defines how long to wait for the given client if it is not available right now.
        """
        if topic not in ProxyActionClient._clients:
            ProxyActionClient._clients[topic] = actionlib.SimpleActionClient(topic, msg_type)
            self._check_topic_available(topic, wait_duration) 
开发者ID:team-vigir,项目名称:flexbe_behavior_engine,代码行数:18,代码来源:proxy_action_client.py

示例10: __init__

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def __init__(self, position, orientation):
        State.__init__(self, outcomes=['success'])

        # Get an action client
        self.client = actionlib.SimpleActionClient('move_base', MoveBaseAction)
        self.client.wait_for_server()

        # Define the goal
        self.goal = MoveBaseGoal()
        self.goal.target_pose.header.frame_id = 'map'
        self.goal.target_pose.pose.position.x = position[0]
        self.goal.target_pose.pose.position.y = position[1]
        self.goal.target_pose.pose.position.z = 0.0
        self.goal.target_pose.pose.orientation.x = orientation[0]
        self.goal.target_pose.pose.orientation.y = orientation[1]
        self.goal.target_pose.pose.orientation.z = orientation[2]
        self.goal.target_pose.pose.orientation.w = orientation[3] 
开发者ID:osrf,项目名称:rosbook,代码行数:19,代码来源:patrol_fsm.py

示例11: __init__

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def __init__(self,
                 group="arm",
                 ee_group="gripper",
                 plan_only=False,
                 verbose=False):
        self._verbose = verbose
        self._group = group
        self._effector = ee_group
        if self._verbose:
            rospy.loginfo("Connecting to pickup action...")
        self._pick_action = actionlib.SimpleActionClient("pickup",
                                                         PickupAction)
        self._pick_action.wait_for_server()
        if self._verbose:
            rospy.loginfo("...connected")
            rospy.loginfo("Connecting to place action...")
        self._place_action = actionlib.SimpleActionClient("place",
                                                          PlaceAction)
        self._place_action.wait_for_server()
        if self._verbose:
            rospy.loginfo("...connected")
        self._plan_only = plan_only
        self.planner_id = None
        self.allowed_planning_time = 30.0 
开发者ID:Kinovarobotics,项目名称:kinova-movo,代码行数:26,代码来源:pick_place_interface.py

示例12: __init__

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def __init__(self, arm='right', dof=''):
        if ''==dof:
            rospy.logerr('DoF parameter needs to be set 6 or 7')
            return

        self._client = actionlib.SimpleActionClient(
            'movo/%s_arm_controller/follow_joint_trajectory'%arm,
            FollowJointTrajectoryAction,
        )
        self._goal = FollowJointTrajectoryGoal()
        self._goal_time_tolerance = rospy.Time(0.1)
        self._goal.goal_time_tolerance = self._goal_time_tolerance
        self.dof = dof
        server_up = self._client.wait_for_server(timeout=rospy.Duration(10.0))
        if not server_up:
            rospy.logerr("Timed out waiting for Joint Trajectory"
                         " Action Server to connect. Start the action server"
                         " before running example.")
            rospy.signal_shutdown("Timed out waiting for Action Server")
            sys.exit(1)
        self.clear(arm) 
开发者ID:Kinovarobotics,项目名称:kinova-movo,代码行数:23,代码来源:jaco_action_client.py

示例13: __init__

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def __init__(self):
        self._client = actionlib.SimpleActionClient(
            'movo/head_controller/follow_joint_trajectory',
            FollowJointTrajectoryAction,
        )
        self._goal = FollowJointTrajectoryGoal()
        self._goal_time_tolerance = rospy.Time(0.1)
        self._goal.goal_time_tolerance = self._goal_time_tolerance
        self.total_time = 0.0
        server_up = self._client.wait_for_server(timeout=rospy.Duration(10.0))
        if not server_up:
            rospy.logerr("Timed out waiting for Joint Trajectory"
                         " Action Server to connect. Start the action server"
                         " before running example.")
            rospy.signal_shutdown("Timed out waiting for Action Server")
            sys.exit(1)
        self.clear() 
开发者ID:Kinovarobotics,项目名称:kinova-movo,代码行数:19,代码来源:head_action_client.py

示例14: __init__

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def __init__(self,prefix="right"):
        
        self._prefix = prefix
        self._client = actionlib.SimpleActionClient(
            '/movo/%s_gripper_controller/gripper_cmd'%self._prefix,
            GripperCommandAction,
        )
        self._goal = GripperCommandGoal()
        server_up = self._client.wait_for_server(timeout=rospy.Duration(10.0))
        if not server_up:
            rospy.logerr("Timed out waiting for Gripper Command"
                         " Action Server to connect. Start the action server"
                         " before running example.")
            rospy.signal_shutdown("Timed out waiting for Action Server")
            sys.exit(1)
        self.clear() 
开发者ID:Kinovarobotics,项目名称:kinova-movo,代码行数:18,代码来源:gripper_action_client.py

示例15: __init__

# 需要导入模块: import actionlib [as 别名]
# 或者: from actionlib import SimpleActionClient [as 别名]
def __init__(self, arm='right', dof='6dof'):
        self._client = actionlib.SimpleActionClient(
            'movo/%s_arm_controller/follow_joint_trajectory'%arm,
            FollowJointTrajectoryAction,
        )
        self._goal = FollowJointTrajectoryGoal()
        self._goal_time_tolerance = rospy.Time(0.1)
        self._goal.goal_time_tolerance = self._goal_time_tolerance
        self.dof = dof
        server_up = self._client.wait_for_server(timeout=rospy.Duration(10.0))
        if not server_up:
            rospy.logerr("Timed out waiting for Joint Trajectory"
                         " Action Server to connect. Start the action server"
                         " before running example.")
            rospy.signal_shutdown("Timed out waiting for Action Server")
            sys.exit(1)
        self.clear(arm) 
开发者ID:Kinovarobotics,项目名称:kinova-movo,代码行数:19,代码来源:jaco_jtas_test.py


注:本文中的actionlib.SimpleActionClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。