-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrectangle.py
More file actions
59 lines (48 loc) · 963 Bytes
/
rectangle.py
File metadata and controls
59 lines (48 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
def move():
rospy.init_node("move", anonymous = True)
pub = rospy.Publisher("/turtle1/cmd_vel",Twist, queue_size = 10)
rate = rospy.Rate(1)
v = Twist()
for i in range(2):
v.linear.x = 1.0
v.linear.y = 0.0
v.angular.z = 0.0
pub.publish(v)
rate.sleep()
v.linear.x = 0.0
v.linear.y =0.0
v.angular.z = 1.57
pub.publish(v)
rate.sleep()
for j in range(1):
v.linear.x = 4.0
v.linear.y = 0.0
v.angular.z = 0.0
pub.publish(v)
rate.sleep()
v.linear.x = 0.0
v.linear.y = 0.0
v.angular.z = 1.57
pub.publish(v)
rate.sleep()
for k in range(1):
v.linear.x = 1.0
v.linear.y = 0.0
v.angular.z = 0.0
pub.publish(v)
rate.sleep()
v.linear.x = 0.0
v.linear.y = 0.0
v.angular.z = 1.57
pub.publish(v)
rate.sleep()
v.linear.x = 4.0
v.linear.y = 0.0
v.angular.z =0.0
pub.publish(v)
rate.sleep()
if __name__== '__main__':
move()