beat_trigger.py
Go to the documentation of this file.
00001 import roslib
00002 roslib.load_manifest('trigger_msgs')
00003 import sys
00004 import rospy
00005 
00006 import trigger_msgs.msg
00007 
00008 rospy.init_node("trigger", anonymous=True)
00009 head_up = rospy.Publisher("head_up", trigger_msgs.msg.Trigger, latch = True)
00010 head_down = rospy.Publisher("head_down", trigger_msgs.msg.Trigger, latch = True)
00011 arm_on = rospy.Publisher("arm_on", trigger_msgs.msg.Trigger, latch = True)
00012 arm_off = rospy.Publisher("arm_off", trigger_msgs.msg.Trigger, latch = True)
00013 r = rospy.Rate(60/60.)
00014 
00015 i = 1
00016 while not rospy.is_shutdown():
00017     print '------------', i, '-------------'
00018 
00019     if i > 4:
00020         if i % 2 == 1:
00021             #Down
00022             print 'down'
00023             head_down.publish(rospy.get_rostime() + rospy.Duration(rospy.get_param("~delay", 0.0)), rospy.get_param("~event", ""))
00024 
00025         if i % 2 == 0:
00026             #Up
00027             print 'up'
00028             head_up.publish(rospy.get_rostime() + rospy.Duration(rospy.get_param("~delay", 0.0)), rospy.get_param("~event", ""))
00029 
00030     if i % 4 == 1:
00031         arm_on.publish(rospy.get_rostime() + rospy.Duration(rospy.get_param("~delay", 0.0)), rospy.get_param("~event", ""))
00032 
00033     if i % 4 == 3:
00034         arm_off.publish(rospy.get_rostime() + rospy.Duration(rospy.get_param("~delay", 0.0)), rospy.get_param("~event", ""))
00035 
00036 
00037     i = i+1
00038     r.sleep()


hai_sandbox
Author(s): Hai Nguyen
autogenerated on Wed Nov 27 2013 11:46:56