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


Python rospy.signal_shutdown方法代码示例

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


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

示例1: _set_gripper

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [as 别名]
def _set_gripper(self, command_pos, wait=False):
        self._status_mutex.acquire()
        self._desired_gpos = command_pos
        if wait:
            if self.num_timeouts > MAX_TIMEOUT:
                rospy.signal_shutdown("MORE THAN {} GRIPPER TIMEOUTS".format(MAX_TIMEOUT))

            sem = Semaphore(value=0)  # use of semaphore ensures script will block if gripper dies during execution
            self.sem_list.append(sem)
            self._status_mutex.release()

            start = rospy.get_time()
            logging.getLogger('robot_logger').debug("gripper sem acquire, list len-{}".format(len(self.sem_list)))
            sem.acquire()
            logging.getLogger('robot_logger').debug("waited on gripper for {} seconds".format(rospy.get_time() - start))
        else:
            self._status_mutex.release() 
开发者ID:SudeepDasari,项目名称:visual_foresight,代码行数:19,代码来源:wsg50_gripper.py

示例2: __init__

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [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

示例3: store_latest_im

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [as 别名]
def store_latest_im(self, data):
        self._latest_image.mutex.acquire()
        self._proc_image(self._latest_image, data)

        current_hash = hashlib.sha256(self._latest_image.img_cv2.tostring()).hexdigest()
        if self._is_first_status:
            self._cam_height, self._cam_width = self._latest_image.img_cv2.shape[:2]
            self._is_first_status = False
            self._status_sem.release()
        elif self._last_hash == current_hash:
            if self._num_repeats < self.MAX_REPEATS:
                self._num_repeats += 1
            else:
                logging.getLogger('robot_logger').error('Too many repeated images. Check camera!')
                rospy.signal_shutdown('Too many repeated images. Check camera!')
        else:
            self._num_repeats = 0
        self._last_hash = current_hash

        if self._save_vides and self._saving:
            if self._latest_image.save_itr % self.TRACK_SKIP == 0:
                self._buffers.append(copy.deepcopy(self._latest_image.img_cv2)[:, :, ::-1])
            self._latest_image.save_itr += 1
        self._latest_image.mutex.release() 
开发者ID:SudeepDasari,项目名称:visual_foresight,代码行数:26,代码来源:camera_recorder.py

示例4: __init__

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [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

示例5: wobble

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [as 别名]
def wobble(self):
        self.set_neutral()
        """
        Performs the wobbling
        """
        command_rate = rospy.Rate(1)
        control_rate = rospy.Rate(100)
        start = rospy.get_time()
        while not rospy.is_shutdown() and (rospy.get_time() - start < 10.0):
            angle = random.uniform(-2.0, 0.95)
            while (not rospy.is_shutdown() and
                   not (abs(self._head.pan() - angle) <=
                       intera_interface.HEAD_PAN_ANGLE_TOLERANCE)):
                self._head.set_pan(angle, speed=0.3, timeout=0)
                control_rate.sleep()
            command_rate.sleep()

        self._done = True
        rospy.signal_shutdown("Example finished.") 
开发者ID:RethinkRobotics,项目名称:intera_sdk,代码行数:21,代码来源:head_wobbler.py

示例6: closeEvent

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [as 别名]
def closeEvent(self, event):
        """ Intercept shutdowns to cleanly disconnect from the flie and cleanly shut ROS down too """
        rospy.loginfo("Close Event")
        #self.autoRetryTimer.stop()

        # Shut Down the Flie
        if self.state < STATE.GEN_DISCONNECTED:
            rospy.loginfo("Triggering flie disconnect for shutdown")
            self.ui.pushButton_connect.setText("Shutting Down...")
            self.flie.requestDisconnect()

        # Clean up ROS
        rospy.signal_shutdown("User closed window")

        # Save State
        self.writeSettings()

        # Commence shutdown
        event.accept() 
开发者ID:omwdunkley,项目名称:crazyflieROS,代码行数:21,代码来源:driverWindow.py

示例7: __init__

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [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

示例8: __init__

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [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

示例9: destroy

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [as 别名]
def destroy(self):
        """
        Function to destroy this object.

        :return:
        """
        rospy.signal_shutdown("")
        self.debug_helper.destroy()
        self.shutdown.set()
        self.carla_weather_subscriber.unregister()
        self.carla_control_queue.put(CarlaControl.STEP_ONCE)
        if not self.carla_settings.synchronous_mode:
            if self.on_tick_id:
                self.carla_world.remove_on_tick(self.on_tick_id)
            self.update_actor_thread.join()
        self._update_actors(set())

        rospy.loginfo("Exiting Bridge") 
开发者ID:carla-simulator,项目名称:ros-bridge,代码行数:20,代码来源:bridge.py

示例10: __init__

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [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

示例11: __init__

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [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

示例12: __init__

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [as 别名]
def __init__(self):
        self._client = actionlib.SimpleActionClient(
            'movo/torso_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,代码来源:torso_action_client.py

示例13: __init__

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [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

示例14: __init__

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [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

示例15: exit_properly_runtime_test

# 需要导入模块: import rospy [as 别名]
# 或者: from rospy import signal_shutdown [as 别名]
def exit_properly_runtime_test():
    f = open("result.txt", "w")
    f.write("0")
    f.close()
    rospy.signal_shutdown("SUCCESS TEST")
    os.kill(os.getpid(), signal.SIGUSR1)
    sys.exit(0) 
开发者ID:microsoft,项目名称:AI-Robot-Challenge-Lab,代码行数:9,代码来源:runtime_test.py


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