move_servo.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 """ Example code of how to move a servo. """
00004 
00005 # We always import roslib, and load the manifest to handle dependencies
00006 import roslib; roslib.load_manifest('mini_max_tutorials')
00007 import rospy
00008 
00009 # Servo commands are sent in radians as a Float64
00010 from std_msgs.msg import Float64
00011 
00012 if __name__=="__main__":
00013 
00014     # first thing, init a node!
00015     rospy.init_node('move_servo')
00016 
00017     # create a publisher to move the head tilt servo
00018     tilt = rospy.Publisher('head_tilt_joint/command', Float64)
00019     
00020     # from now until the end of time:
00021     while not rospy.is_shutdown():
00022         # move head around
00023         tilt.publish(Float64(0.1))
00024         rospy.sleep(1.0)
00025         tilt.publish(Float64(0.0))
00026         rospy.sleep(1.0)
00027         tilt.publish(Float64(-0.1))
00028         rospy.sleep(1.0)
00029         tilt.publish(Float64(0.0))
00030         rospy.sleep(1.0)
00031 
00032 


mini_max_tutorials
Author(s): Michael Ferguson
autogenerated on Mon Jan 6 2014 11:26:48