我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用rospy.INFO。
def main(): rospy.init_node('mobile_robot_tracker', log_level=rospy.INFO) rospy.loginfo("Starting tracking node...") try: tracker = MobileTracker() except rospy.ROSInterruptException: pass rospy.spin()
def main(): rospy.init_node('system_calibrator', log_level=rospy.INFO) rospy.loginfo("Calibration node started") rospy.loginfo("Press 'c' to begin calibration") try: calibrator = SystemCalibrator() except rospy.ROSInterruptException: pass rospy.spin()
def __init__(self): super(RosCommunicationProxy, self).__init__('RosCommunicationProxy') self.log_level_map = {LOG_LEVEL_DEBUG: rospy.DEBUG, LOG_LEVEL_INFO: rospy.INFO, LOG_LEVEL_WARN: rospy.WARN, LOG_LEVEL_ERROR: rospy.ERROR, LOG_LEVEL_FATAL: rospy.FATAL}
def info(self, msg): if LOG_LEVEL_INFO >= self.log_level: print(self._get_formatted_msg(msg, 'INFO'), file=sys.stdout)
def main(): rospy.init_node('check_collisions_node', log_level=rospy.INFO) rospy.loginfo("Starting up collision checking demo node") try: coll_checker = CheckCollisionState() except rospy.ROSInterruptException: pass rospy.spin()
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