Go to the documentation of this file.00001
00002
00003 """ Example code of how to move a robot forward for 3 seconds. """
00004
00005
00006 import roslib; roslib.load_manifest('mini_max_tutorials')
00007 import rospy
00008
00009
00010
00011 from geometry_msgs.msg import Twist
00012
00013 x_speed = 0.1
00014
00015
00016
00017 if __name__=="__main__":
00018
00019
00020 rospy.init_node('move')
00021
00022
00023 p = rospy.Publisher('cmd_vel', Twist)
00024
00025
00026 twist = Twist()
00027 twist.linear.x = x_speed;
00028 twist.linear.y = 0; twist.linear.z = 0;
00029 twist.angular.x = 0; twist.angular.y = 0;
00030 twist.angular.z = 0;
00031
00032
00033 rospy.loginfo("About to be moving forward!")
00034 for i in range(30):
00035 p.publish(twist)
00036 rospy.sleep(0.1)
00037
00038
00039 twist = Twist()
00040
00041
00042 rospy.loginfo("Stopping!")
00043 p.publish(twist)
00044
00045
00046