本文整理匯總了Python中rospy.DEBUG屬性的典型用法代碼示例。如果您正苦於以下問題:Python rospy.DEBUG屬性的具體用法?Python rospy.DEBUG怎麽用?Python rospy.DEBUG使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類rospy
的用法示例。
在下文中一共展示了rospy.DEBUG屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: beepMsg
# 需要導入模塊: import rospy [as 別名]
# 或者: from rospy import DEBUG [as 別名]
def beepMsg(self, msg):
if self.beepOn and msg.beep:
os.system("beep -f "+str(msg.f)+"-l "+str(msg.l)+" -r "+str(msg.r)+"&")
if msg.msg != "":
if msg.type == MSGTYPE.INFO:
rospy.loginfo(msg.msg)
elif msg.type == MSGTYPE.WARN:
rospy.logwarn(msg.msg)
elif msg.type == MSGTYPE.ERROR:
rospy.logerr(msg.msg)
elif msg.type == MSGTYPE.DEBUG:
rospy.logdebug(msg.msg)
else:
rospy.logerr("UNKNOWN MESSAGE TYPE: %s", msg.msg)
self.ui.statusbar.showMessage(msg.msg, 0)
示例2: run
# 需要導入模塊: import rospy [as 別名]
# 或者: from rospy import DEBUG [as 別名]
def run(self):
rospy.init_node('CrazyflieDriverUSB%d' % self.options.radio,
log_level=rospy.DEBUG if self.options.debug else rospy.INFO,
disable_signals=True,
anonymous=False)
示例3: __init__
# 需要導入模塊: import rospy [as 別名]
# 或者: from rospy import DEBUG [as 別名]
def __init__(self):
self.exit = True
self.callback_exit = True
# Connect sensors and buttons.
self.btn = Button()
self.ir = InfraredSensor()
self.ts = TouchSensor()
self.power = PowerSupply()
self.tank_drive = MoveTank(OUTPUT_A, OUTPUT_B)
print('EV3 Node init starting')
rospy.init_node('ev3_robot', anonymous=True, log_level=rospy.DEBUG)
print('EV3 Node init complete')
rospy.Subscriber('ev3/active_mode', String, self.active_mode_callback, queue_size=1)
self.power_init()
print('READY!')
示例4: __init__
# 需要導入模塊: import rospy [as 別名]
# 或者: from rospy import DEBUG [as 別名]
def __init__(self):
rospy.init_node('Arduino', log_level=rospy.DEBUG)
# Cleanup when termniating the node
rospy.on_shutdown(self.shutdown)
self.port = rospy.get_param("~port", "/dev/ttyACM0")
self.baud = int(rospy.get_param("~baud", 57600))
self.timeout = rospy.get_param("~timeout", 0.5)
self.base_frame = rospy.get_param("~base_frame", 'base_link')
# Overall loop rate: should be faster than fastest sensor rate
self.rate = int(rospy.get_param("~rate", 50))
r = rospy.Rate(self.rate)
# Rate at which summary SensorState message is published. Individual sensors publish
# at their own rates.
self.sensorstate_rate = int(rospy.get_param("~sensorstate_rate", 10))
self.use_base_controller = rospy.get_param("~use_base_controller", False)
# Set up the time for publishing the next SensorState message
now = rospy.Time.now()
self.t_delta_sensors = rospy.Duration(1.0 / self.sensorstate_rate)
self.t_next_sensors = now + self.t_delta_sensors
# Initialize a Twist message
self.cmd_vel = Twist()
# A cmd_vel publisher so we can stop the robot when shutting down
self.cmd_vel_pub = rospy.Publisher('cmd_vel', Twist, queue_size=5)
# Initialize the controlller
self.controller = Arduino(self.port, self.baud, self.timeout)
# Make the connection
self.controller.connect()
rospy.loginfo("Connected to Arduino on port " + self.port + " at " + str(self.baud) + " baud")
# Reserve a thread lock
mutex = thread.allocate_lock()
# Initialize the base controller if used
if self.use_base_controller:
self.myBaseController = BaseController(self.controller, self.base_frame)
# Start polling the sensors and base controller
while not rospy.is_shutdown():
if self.use_base_controller:
mutex.acquire()
self.myBaseController.poll()
mutex.release()
r.sleep()
示例5: main
# 需要導入模塊: import rospy [as 別名]
# 或者: from rospy import DEBUG [as 別名]
def main():
"""SDK Gripper Button Control Example
Connects cuff buttons to gripper open/close commands:
'Circle' Button - open gripper
'Dash' Button - close gripper
Cuff 'Squeeze' - turn on Nav lights
Run this example in the background or in another terminal
to be able to easily control the grippers by hand while
using the robot. Can be run in parallel with other code.
"""
rp = RobotParams()
valid_limbs = rp.get_limb_names()
if not valid_limbs:
rp.log_message(("Cannot detect any limb parameters on this robot. "
"Exiting."), "ERROR")
return
if len(valid_limbs) > 1:
valid_limbs.append("all_limbs")
arg_fmt = argparse.RawDescriptionHelpFormatter
parser = argparse.ArgumentParser(formatter_class=arg_fmt,
description=main.__doc__)
parser.add_argument('-g', '--gripper', dest='gripper', default=valid_limbs[0],
choices=[valid_limbs],
help='gripper limb to control (default: both)')
parser.add_argument('-n', '--no-lights', dest='lights',
action='store_false',
help='do not trigger lights on cuff grasp')
parser.add_argument('-v', '--verbose', dest='verbosity',
action='store_const', const=rospy.DEBUG,
default=rospy.INFO,
help='print debug statements')
args = parser.parse_args(rospy.myargv()[1:])
rospy.init_node('sdk_gripper_cuff_control_{0}'.format(args.gripper),
log_level=args.verbosity)
arms = (args.gripper,) if args.gripper != 'all_limbs' else valid_limbs[:-1]
grip_ctrls = [GripperConnect(arm, args.lights) for arm in arms]
print("Press cuff buttons for gripper control. Spinning...")
rospy.spin()
print("Gripper Button Control Finished.")
return 0