-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_1_path.py
More file actions
35 lines (24 loc) · 771 Bytes
/
Copy pathcreate_1_path.py
File metadata and controls
35 lines (24 loc) · 771 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
#!/usr/bin/env python
import rospy
from nav_msgs.msg import Path
import csv
from geometry_msgs.msg import PoseStamped
rospy.init_node("create_1_path")
plan_publisher = rospy.Publisher('/create_1_waypoints', Path, queue_size=10)
rate = rospy.Rate(10.0)
def publish_plan():
new_plan = Path()
new_plan.header.frame_id = 'map'
with open('way_points.csv') as csvfile:
points_reader = csv.reader(csvfile, delimiter = ',')
for row in points_reader:
point = PoseStamped()
point.pose.position.x = float(row[0])
point.pose.position.y = float(row[1])
new_plan.poses.append(point)
print "Publishing a new plan..."
plan_publisher.publish(new_plan)
print new_plan
while not rospy.is_shutdown():
raw_input("Press enter to continue: ")
publish_plan()