-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathwaypoint.py
41 lines (37 loc) · 1.01 KB
/
waypoint.py
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
#!/usr/bin/env python
# license removed for brevity
import rospy
import std_msgs.msg
from nav_msgs.msg import Path
from geometry_msgs.msg import PoseStamped
def waypoints():
pub = rospy.Publisher('waypoints_out', Path, queue_size=10)
rospy.init_node('waypoints', anonymous=True)
rate = rospy.Rate(1) # 10hz
pose = PoseStamped()
pose1 = PoseStamped()
path = Path()
path.poses = []
h = std_msgs.msg.Header()
pose.pose.position.x = 0
pose.pose.position.y = 0
pose.pose.position.z = 0
pose.pose.orientation.x = 0
h.stamp = rospy.Time.now()
pose.header = h
path.poses.append(pose)
pose1.pose.position.x = 0
pose1.pose.position.y = 1
pose1.pose.position.z = 0
pose1.pose.orientation.x = 0
h.stamp = rospy.Time.now()
pose1.header = h
path.poses.append(pose1)
while not rospy.is_shutdown():
pub.publish(path)
rate.sleep()
if __name__ == '__main__':
try:
waypoints()
except rospy.ROSInterruptException:
pass