-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtriangle.py
More file actions
40 lines (32 loc) · 713 Bytes
/
triangle.py
File metadata and controls
40 lines (32 loc) · 713 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
#!/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(3):
v.linear.x = 2.0
v.linear.y = 2.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 i in range(2):
v.linear.x = 0.0
v.linear.y = 4.0
v.angular.z = 0.0
pub.publish(v)
rate.sleep()
v.linear.x = 0.0
v.linear.y = 0.0
v.angular.z = 0.0
pub.publish(v)
rate.sleep()
if __name__== '__main__':
move()