本文整理汇总了Python中std_msgs.msg.Empty方法的典型用法代码示例。如果您正苦于以下问题:Python msg.Empty方法的具体用法?Python msg.Empty怎么用?Python msg.Empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std_msgs.msg
的用法示例。
在下文中一共展示了msg.Empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def __init__(self, configs, wait_time=3):
"""
The constructor for LoCoBotGripper class.
:param configs: configurations for gripper
:param wait_time: waiting time for opening/closing gripper
:type configs: YACS CfgNode
:type wait_time: float
"""
super(LoCoBotGripper, self).__init__(configs=configs)
self._gripper_state_lock = threading.RLock()
self._gripper_state = None
# Publishers and subscribers
self.wait_time = wait_time
self.pub_gripper_close = rospy.Publisher(
self.configs.GRIPPER.ROSTOPIC_GRIPPER_CLOSE, Empty, queue_size=1
)
self.pub_gripper_open = rospy.Publisher(
self.configs.GRIPPER.ROSTOPIC_GRIPPER_OPEN, Empty, queue_size=1
)
rospy.Subscriber(
self.configs.GRIPPER.ROSTOPIC_GRIPPER_STATE,
Int8,
self._callback_gripper_state,
)
示例2: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def __init__(self):
self._behavior_started = False
self._preempt_requested = False
self._current_state = None
self._active_behavior_id = None
self._pub = rospy.Publisher('flexbe/start_behavior', BehaviorSelection, queue_size=100)
self._preempt_pub = rospy.Publisher('flexbe/command/preempt', Empty, queue_size=100)
self._status_sub = rospy.Subscriber('flexbe/status', BEStatus, self._status_cb)
self._state_sub = rospy.Subscriber('flexbe/behavior_update', String, self._state_cb)
self._as = actionlib.SimpleActionServer('flexbe/execute_behavior', BehaviorExecutionAction, None, False)
self._as.register_preempt_callback(self._preempt_cb)
self._as.register_goal_callback(self._goal_cb)
self._rp = RosPack()
self._behavior_lib = BehaviorLibrary()
# start action server after all member variables have been initialized
self._as.start()
rospy.loginfo("%d behaviors available, ready for start request." % self._behavior_lib.count_behaviors())
示例3: _initSubscribers
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def _initSubscribers(self):
"""
INTERNAL METHOD, initializes the ROS subscribers
"""
rospy.Subscriber(
'/joint_angles',
JointAnglesWithSpeed,
self._jointAnglesCallback)
rospy.Subscriber(
'/cmd_vel',
Twist,
self._velocityCallback)
rospy.Subscriber(
'/move_base_simple/goal',
MovetoPose,
self._moveToCallback)
rospy.Subscriber(
'/move_base_simple/cancel',
Empty,
self._killMoveCallback)
示例4: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def __init__(self, reconfig_server, limb = "right"):
self._dyn = reconfig_server
# control parameters
self._rate = 1000.0 # Hz
self._missed_cmds = 20.0 # Missed cycles before triggering timeout
# create our limb instance
self._limb = intera_interface.Limb(limb)
# initialize parameters
self._springs = dict()
self._damping = dict()
self._start_angles = dict()
# create cuff disable publisher
cuff_ns = 'robot/limb/' + limb + '/suppress_cuff_interaction'
self._pub_cuff_disable = rospy.Publisher(cuff_ns, Empty, queue_size=1)
# verify robot is enabled
print("Getting robot state... ")
self._rs = intera_interface.RobotEnable(CHECK_VERSION)
self._init_state = self._rs.state().enabled
print("Enabling robot... ")
self._rs.enable()
print("Running. Ctrl-c to quit")
示例5: reset_controller
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def reset_controller(self):
msg = Empty()
self.reset_controller_pub.publish(msg)
# very important delay to avoid unexpected issues from ros_control
rospy.sleep(0.05)
示例6: get_calibration_camera
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def get_calibration_camera(self):
service_name = self.__services_name['get_calibration_camera_service']
rospy.wait_for_service(service_name)
try:
calibra_service = rospy.ServiceProxy(service_name, GetCalibrationCam)
res = calibra_service(Empty())
return res
except rospy.ServiceException, e:
print "Service call failed: %s" % e
示例7: __trigger_update
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def __trigger_update(self):
# Let ROS handle the threading for me.
self.update_pub.publish(Empty())
示例8: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def __init__(self):
# Publishers and subscribers
self.pub_gripper_close = rospy.Publisher(
ROSTOPIC_GRIPPER_CLOSE, Empty, queue_size=1
)
self.pub_gripper_open = rospy.Publisher(
ROSTOPIC_GRIPPER_OPEN, Empty, queue_size=1
)
示例9: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def __init__(self, base):
self.should_stop = False
self.bumper = False
self.cliff = False
self.wheel_drop = False
self.subscribers = []
if base == "create":
s = rospy.Subscriber(
self.configs.BASE.ROSTOPIC_BUMPER, Bumper, self.bumper_callback_create
)
self.subscribers.append(s)
s = rospy.Subscriber(
self.configs.BASE.ROSTOPIC_CLIFF, Empty, self.cliff_callback
)
self.subscribers.append(s)
s = rospy.Subscriber(
self.configs.BASE.ROSTOPIC_WHEELDROP, Empty, self.wheeldrop_callback
)
self.subscribers.append(s)
else:
s = rospy.Subscriber(
self.configs.BASE.ROSTOPIC_BUMPER,
BumperEvent,
self.bumper_callback_kobuki,
)
self.subscribers.append(s)
s = rospy.Subscriber(
self.configs.BASE.ROSTOPIC_CLIFF, CliffEvent, self.cliff_callback
)
self.subscribers.append(s)
s = rospy.Subscriber(
self.configs.BASE.ROSTOPIC_WHEELDROP,
WheelDropEvent,
self.wheeldrop_callback,
)
self.subscribers.append(s)
示例10: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def __init__(self,
json_model_path,
weights_path, target_size=(200, 200),
crop_size=(150, 150),
imgs_rootpath="../models"):
self.pub = rospy.Publisher("cnn_predictions", CNN_out, queue_size=5)
self.feedthrough_sub = rospy.Subscriber("state_change", Bool, self.callback_feedthrough, queue_size=1)
self.land_sub = rospy.Subscriber("land", Empty, self.callback_land, queue_size=1)
self.use_network_out = False
self.imgs_rootpath = imgs_rootpath
# Set keras utils
K.set_learning_phase(TEST_PHASE)
# Load json and create model
model = utils.jsonToModel(json_model_path)
# Load weights
model.load_weights(weights_path)
print("Loaded model from {}".format(weights_path))
model.compile(loss='mse', optimizer='sgd')
self.model = model
self.target_size = target_size
self.crop_size = crop_size
示例11: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def __init__(self):
# Define parameters
self.joy_state_prev = GamepadState()
# if None then not in agent mode, otherwise contains time of latest enable/ping
self.agent_mode_t = None
self.flip_dir = 0
# Start ROS node
rospy.init_node('gamepad_marshall_node')
# Load parameters
self.agent_mode_timeout_sec = rospy.get_param(
'~agent_mode_timeout_sec', 1.0)
self.pub_takeoff = rospy.Publisher(
'takeoff', Empty, queue_size=1, latch=False)
self.pub_throw_takeoff = rospy.Publisher(
'throw_takeoff', Empty, queue_size=1, latch=False)
self.pub_land = rospy.Publisher(
'land', Empty, queue_size=1, latch=False)
self.pub_palm_land = rospy.Publisher(
'palm_land', Empty, queue_size=1, latch=False)
self.pub_reset = rospy.Publisher(
'reset', Empty, queue_size=1, latch=False)
self.pub_flattrim = rospy.Publisher(
'flattrim', Empty, queue_size=1, latch=False)
self.pub_flip = rospy.Publisher(
'flip', UInt8, queue_size=1, latch=False)
self.pub_cmd_out = rospy.Publisher(
'cmd_vel', Twist, queue_size=10, latch=False)
self.pub_fast_mode = rospy.Publisher(
'fast_mode', Bool, queue_size=1, latch=False)
self.sub_agent_cmd_in = rospy.Subscriber(
'agent_cmd_vel_in', Twist, self.agent_cmd_cb)
self.sub_joy = rospy.Subscriber('/joy', Joy, self.joy_cb)
rospy.loginfo('Gamepad marshall node initialized')
示例12: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def __init__(self, topic):
'''
Constructor
'''
super(PublisherEmptyState, self).__init__(outcomes=['done'])
self._topic = topic
self._pub = ProxyPublisher({self._topic: Empty})
示例13: on_enter
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def on_enter(self, userdata):
self._pub.publish(self._topic, Empty())
示例14: __init__
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def __init__(self):
'''
Constructor
'''
self._sm = None
smach.set_loggers (
rospy.logdebug, # hide SMACH transition log spamming
rospy.logwarn,
rospy.logdebug,
rospy.logerr
)
# set up proxys for sm <--> GUI communication
# publish topics
self._pub = ProxyPublisher({'flexbe/behavior_update': String,
'flexbe/request_mirror_structure': Int32})
self._running = False
self._stopping = False
self._active_id = 0
self._starting_path = None
self._current_struct = None
self._sync_lock = threading.Lock()
self._outcome_topic = 'flexbe/mirror/outcome'
self._struct_buffer = list()
# listen for mirror message
self._sub = ProxySubscriberCached()
self._sub.subscribe(self._outcome_topic, UInt8)
self._sub.enable_buffer(self._outcome_topic)
self._sub.subscribe('flexbe/mirror/structure', ContainerStructure, self._mirror_callback)
self._sub.subscribe('flexbe/status', BEStatus, self._status_callback)
self._sub.subscribe('flexbe/mirror/sync', BehaviorSync, self._sync_callback)
self._sub.subscribe('flexbe/mirror/preempt', Empty, self._preempt_callback)
示例15: _enable_ros_control
# 需要导入模块: from std_msgs import msg [as 别名]
# 或者: from std_msgs.msg import Empty [as 别名]
def _enable_ros_control(self):
super(PreemptableState, self)._enable_ros_control()
self._pub.createPublisher(self._feedback_topic, CommandFeedback)
self._sub.subscribe(self._preempt_topic, Empty)
PreemptableState.preempt = False