Python rospy.signal_shutdown() Examples
The following are 30
code examples of rospy.signal_shutdown().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
rospy
, or try the search function
.
Example #1
Source File: pose_manager.py From naoqi_bridge with BSD 3-Clause "New" or "Revised" License | 7 votes |
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");
Example #2
Source File: camera_recorder.py From visual_foresight with MIT License | 6 votes |
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()
Example #3
Source File: driverWindow.py From crazyflieROS with GNU General Public License v2.0 | 6 votes |
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()
Example #4
Source File: head_wobbler.py From intera_sdk with Apache License 2.0 | 6 votes |
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.")
Example #5
Source File: joint_trajectory_client.py From intera_sdk with Apache License 2.0 | 6 votes |
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)
Example #6
Source File: common.py From baxter_demos with Apache License 2.0 | 6 votes |
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)
Example #7
Source File: calibrate_arm.py From intera_sdk with Apache License 2.0 | 6 votes |
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)
Example #8
Source File: bridge.py From ros-bridge with MIT License | 6 votes |
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")
Example #9
Source File: wsg50_gripper.py From visual_foresight with MIT License | 6 votes |
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()
Example #10
Source File: jaco_action_client.py From kinova-movo with BSD 3-Clause "New" or "Revised" License | 6 votes |
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)
Example #11
Source File: head_action_client.py From kinova-movo with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()
Example #12
Source File: torso_action_client.py From kinova-movo with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()
Example #13
Source File: gripper_action_client.py From kinova-movo with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()
Example #14
Source File: head_jtas_test.py From kinova-movo with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()
Example #15
Source File: jaco_jtas_test.py From kinova-movo with BSD 3-Clause "New" or "Revised" License | 6 votes |
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)
Example #16
Source File: torso_jtas_test.py From kinova-movo with BSD 3-Clause "New" or "Revised" License | 6 votes |
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()
Example #17
Source File: listener.py From intel-iot-refkit with MIT License | 5 votes |
def callback(data): rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.data) rospy.signal_shutdown("Success")
Example #18
Source File: dal_ros_aml.py From dal with MIT License | 5 votes |
def quit_sequence(self): self.wrap_up() if self.args.jay1 or self.args.gazebo: rospy.logwarn("Quit") rospy.signal_shutdown("Quit") exit()
Example #19
Source File: nao_walker.py From nao_robot with BSD 3-Clause "New" or "Revised" License | 5 votes |
def handleCmdVel(self, data): rospy.logdebug("Walk cmd_vel: %f %f %f, frequency %f", data.linear.x, data.linear.y, data.angular.z, self.stepFrequency) if data.linear.x != 0 or data.linear.y != 0 or data.angular.z != 0: self.gotoStartWalkPose() try: eps = 1e-3 # maybe 0,0,0 is a special command in motionProxy... if abs(data.linear.x)<eps and abs(data.linear.y)<eps and abs(data.angular.z)<eps: self.motionProxy.setWalkTargetVelocity(0,0,0,0.5) else: self.motionProxy.setWalkTargetVelocity(data.linear.x, data.linear.y, data.angular.z, self.stepFrequency, self.footGaitConfig) except RuntimeError,e: # We have to assume there's no NaoQI running anymore => exit! rospy.logerr("Exception caught in handleCmdVel:\n%s", e) rospy.signal_shutdown("No NaoQI available anymore")
Example #20
Source File: pose_controller.py From naoqi_bridge with BSD 3-Clause "New" or "Revised" License | 5 votes |
def run(self): while self.is_looping(): try: if self.getLifeStatePub.get_num_connections() > 0: get_life_state_msg = String() get_life_state_msg.data = self.lifeProxy.getState() self.getLifeStatePub.publish(get_life_state_msg) except RuntimeError, e: print "Error accessing ALMotion, ALRobotPosture, ALAutonomousLife, exiting...\n" print e rospy.signal_shutdown("No NaoQI available anymore") self.rate.sleep()
Example #21
Source File: Crazyflie.py From GtS with MIT License | 5 votes |
def signal_handler(self, sig, frame): if self.cf_active: self.cmd_estop() self.stop_sig = True rospy.signal_shutdown("CtrlC") #killing os.kill(os.getpgrp(), signal.SIGKILL) ## CALLBACKS ##
Example #22
Source File: automated_res.py From fssim with MIT License | 5 votes |
def signal_handler(self, signal, frame): self.terminate_all_launched_commands() rospy.logwarn('####################################################################') rospy.logwarn('########################## EXITING FSSIM! ##########################') rospy.logwarn('####################################################################') rospy.signal_shutdown("EXIT AUTOMATED RES")
Example #23
Source File: uwb_tracker_node.py From uwb_tracker_ros with MIT License | 5 votes |
def stop(self): rospy.signal_shutdown('User request')
Example #24
Source File: uwb_multi_range_node.py From uwb_tracker_ros with MIT License | 5 votes |
def stop(self): if self.show_plots: import pyqtgraph pyqtgraph.QtGui.QApplication.quit() else: rospy.signal_shutdown('User request')
Example #25
Source File: dal_ros_aml.py From dal with MIT License | 5 votes |
def quit_sequence(self): self.wrap_up() if self.args.jay1 or self.args.gazebo: rospy.logwarn("Quit") rospy.signal_shutdown("Quit") exit()
Example #26
Source File: runtime_test.py From AI-Robot-Challenge-Lab with MIT License | 5 votes |
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)
Example #27
Source File: flieTracker.py From crazyflieROS with GNU General Public License v2.0 | 5 votes |
def ros2cv(self, data, dt="mono8"): try: cv_image = self.bridge.imgmsg_to_cv2(data, dt) except CvBridgeError, err: rospy.logerr("Converting image error: %s", err) rospy.signal_shutdown("Converting image error: "+ str(err))
Example #28
Source File: motion_controller_action_client.py From intera_sdk with Apache License 2.0 | 5 votes |
def __init__(self): """ Constructor - creates a new motion controller action client and waits for a connection to the motion controller action server. """ self._waypointSequenceId = 0 self._client = actionlib.SimpleActionClient( '/motion/motion_command', intera_motion_msgs.msg.MotionCommandAction) if not self._client.wait_for_server(rospy.Duration(10.0)): rospy.logerr("Timed out waiting for Motion Controller" " Server to connect. Check your ROS networking" " and/or reboot the robot.") rospy.signal_shutdown("Timed out waiting for Action Server")
Example #29
Source File: google_client.py From dialogflow_ros with MIT License | 5 votes |
def signal_handler(signal, frame): rospy.signal_shutdown("Order 66 Received") exit("Order 66 Received")
Example #30
Source File: projection.py From ros_people_object_detection_tensorflow with Apache License 2.0 | 5 votes |
def shutdown(self): """ Shuts down the node """ rospy.signal_shutdown("See ya!")