本文整理匯總了Python中std_srvs.srv.Empty方法的典型用法代碼示例。如果您正苦於以下問題:Python srv.Empty方法的具體用法?Python srv.Empty怎麽用?Python srv.Empty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類std_srvs.srv
的用法示例。
在下文中一共展示了srv.Empty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [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");
示例2: stop
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def stop(self):
"""Stop the sensor.
"""
# Check that everything is running
if not self._running:
logging.warning('PhoXi not running. Aborting stop')
return False
# Stop the subscribers
self._color_im_sub.unregister()
self._depth_im_sub.unregister()
self._normal_map_sub.unregister()
# Disconnect from the camera
rospy.ServiceProxy('phoxi_camera/disconnect_camera', Empty)()
self._running = False
return True
示例3: on_button_reset_pressed
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def on_button_reset_pressed(self):
self._num_pattern_detections = 0
self._calibration_output = ""
self._update_required = True
self.button_start.setEnabled( False )
try:
rospy.wait_for_service('dvs_calibration/reset', 1)
try:
reset_service = rospy.ServiceProxy('dvs_calibration/reset', Empty)
resp = reset_service()
except rospy.ServiceException, e:
print "Service call failed: %s"%e
except:
print "service not available..."
pass
示例4: service_server
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def service_server():
rospy.init_node('service_server')
s = rospy.Service('call_me', Empty, handle_service)
print "Ready to serve."
rospy.spin()
示例5: execute
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def execute(self, inputs, outputs, gvm):
service = "/clear"
rospy.wait_for_service(service)
clear_turtle_area_service = rospy.ServiceProxy(service, Empty)
resp1 = clear_turtle_area_service()
self.logger.info("ROS external module: executed the {} service".format(service))
return 0
示例6: GetDetectObjectsService
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def GetDetectObjectsService(srv='/costar_perception/segmenter'):
'''
Get a service that will update object positions
Parameters:
----------
srv: service, defaults to the correct name for costar
'''
return GetService(srv, EmptySrv)
示例7: GetCloseGripperService
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def GetCloseGripperService():
return GetService("/costar/gripper/close", EmptySrv)
示例8: GetOpenGripperService
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def GetOpenGripperService():
return GetService("/costar/gripper/open", EmptySrv)
示例9: __init__
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def __init__(self):
self.index = 0
self.gazeboModels = None
self.img_np = None
self.pose = Odometry()
self.action = Twist()
rospy.Subscriber(overheadImageTopic, Image, self.imageCallback)
rospy.Subscriber(huskyCmdVelTopic, Twist, self.cmdVelCallback)
self.listener = tf.TransformListener()
self.writer = NpzDataset('husky_data')
self.trans = None
self.rot = None
self.roll, self.pitch, self.yaw = 0., 0., 0.
self.trans_threshold = 0.25
rospy.wait_for_service("/gazebo/pause_physics")
self.pause = rospy.ServiceProxy("/gazebo/pause_physics", EmptySrv)
self.unpause = rospy.ServiceProxy("/gazebo/unpause_physics", EmptySrv)
self.set_model_state = rospy.ServiceProxy("/gazebo/set_model_state",
SetModelState)
self.set_link_state = rospy.ServiceProxy("/gazebo/set_link_state",
SetLinkState)
self.get_link_state = rospy.ServiceProxy("/gazebo/get_link_state",
GetLinkState)
self.pose = None
示例10: call_service
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def call_service():
rospy.loginfo('waiting service')
rospy.wait_for_service('call_me')
try:
service = rospy.ServiceProxy('call_me', Empty)
response = service()
except rospy.ServiceException, e:
print "Service call failed: %s" % e
示例11: __init__
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def __init__(self, rate=20.0, id_mask='F1804'):
"""Initialize the weight publisher.
Parameters
----------
id_mask : str
A template for the first n digits of the device IDs for valid load cells.
"""
self._rate = rospy.Rate(rate)
self._pub = rospy.Publisher('~weights', Float32MultiArray, queue_size=10)
rospy.loginfo('Connecting serial')
self._serials = self._connect(id_mask)
if len(self._serials) == 0:
raise ValueError('Error -- No loadstar weight sensors connected to machine!')
# Tare the sensor
rospy.loginfo('Tareing')
self._tare()
# Flush the sensor's communications
self._flush()
# Set up Tare service
self._tare_service = rospy.Service('~tare', Empty, self._handle_tare)
# Main loop -- read and publish
while not rospy.is_shutdown():
weights = self._read_weights()
self._pub.publish(Float32MultiArray(data=weights))
self._rate.sleep()
示例12: frames
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def frames(self):
"""Retrieve a new frame from the PhoXi and convert it to a ColorImage,
a DepthImage, and an IrImage.
Returns
-------
:obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray`
The ColorImage, DepthImage, and IrImage of the current frame.
"""
# Run a software trigger
times = []
rospy.ServiceProxy('phoxi_camera/start_acquisition', Empty)()
rospy.ServiceProxy('phoxi_camera/trigger_image', TriggerImage)()
self._cur_color_im = None
self._cur_depth_im = None
self._cur_normal_map = None
rospy.ServiceProxy('phoxi_camera/get_frame', GetFrame)(-1)
max_time = 5.0
time_waiting = 0.0
while self._cur_color_im is None or self._cur_depth_im is None or self._cur_normal_map is None:
time.sleep(0.05)
time_waiting += 0.05
if time_waiting > max_time:
raise SensorUnresponsiveException('PhoXi sensor seems to be non-responsive')
return self._cur_color_im, self._cur_depth_im, None
示例13: tare
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def tare(self):
"""Zero out (tare) the sensor.
"""
if not self._running:
raise ValueError('Weight sensor is not running!')
rospy.ServiceProxy('weight_sensor/tare', Empty)()
示例14: on_button_start_calibration_pressed
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def on_button_start_calibration_pressed(self):
self.button_start.setEnabled( False )
try:
rospy.wait_for_service('dvs_calibration/start', 1)
try:
start_calibration_service = rospy.ServiceProxy('dvs_calibration/start', Empty)
resp = start_calibration_service()
except rospy.ServiceException, e:
print "Service call failed: %s"%e
except:
print "service not available..."
pass
示例15: on_button_save_calibration_pressed
# 需要導入模塊: from std_srvs import srv [as 別名]
# 或者: from std_srvs.srv import Empty [as 別名]
def on_button_save_calibration_pressed(self):
try:
rospy.wait_for_service('dvs_calibration/save', 1)
try:
save_calibration_service = rospy.ServiceProxy('dvs_calibration/save', Empty)
resp = save_calibration_service()
except rospy.ServiceException, e:
print "Service call failed: %s"%e
except:
print "service not available..."
pass