#!/usr/bin/env python
# coding UTF-8

import yaml
import rospy

from goal_sender_msgs.msg import GoalSequence
from goal_sender_msgs.msg import Waypoint

def read_yaml(path):
    f = open(path, 'r')
    waypoints = yaml.load(f)
    f.close()
    return waypoints

def pub_data():
    pub = rospy.Publisher('goal_sequence', GoalSequence, queue_size=10)
    rospy.init_node('yaml_reader', anonymous=True)
    msg = GoalSequence()
    for waypoint_data in read_yaml(rospy.get_param('~path', 'waypoints.yaml')):
        waypoint = Waypoint(name = waypoint_data.get('name', ""),
                            x = waypoint_data['x'], # required
                            y = waypoint_data['y'], # required
                            radius = waypoint_data['radius'], # required
                            importance = waypoint_data.get('importance', 0),
                            drag = waypoint_data.get('drag', 0))
        msg.waypoints.append(waypoint)
    pub.publish(msg)

if __name__ == '__main__':
    try:
        pub_data()
    except rospy.ROSInterruptException:
        pass

@@ -43,16 +43,17 @@
 rt yaml%0A
+%0A
 import r
@@ -57,16 +57,59 @@
 t rospy%0A
+from goal_sender_msgs.srv import ApplyGoals
 %0Afrom go
@@ -308,150 +308,37 @@
 def 
-pub_data():%0A    pub = rospy.Publisher('goal_sequence', GoalSequence, queue_size=10)%0A    rospy.init_node('yaml_reader', anonymous=True)%0A    msg
+get_waypoints():%0A    sequence
  = G
@@ -846,19 +846,24 @@
         
-msg
+sequence
 .waypoin
@@ -890,24 +890,23 @@
     
-pub.publish(msg)
+return sequence
 %0A%0Aif
@@ -938,31 +938,278 @@
     
-try:%0A        pub_data()
+rospy.init_node('yaml_reader', anonymous=True)%0A    goal_sequence = get_waypoints()%0A    rospy.wait_for_service('apply_goals')%0A    try:%0A        apply_goals = rospy.ServiceProxy('apply_goals', ApplyGoals)%0A        resp = apply_goals(goal_sequence)%0A        print resp.message
 %0A   
@@ -1226,20 +1226,15 @@
 spy.
-ROSInterrupt
+Service
 Exce
@@ -1238,16 +1238,19 @@
 xception
+, e
 :%0A      
@@ -1256,8 +1256,11 @@
    p
-ass
+rint e
 %0A

Change goals passage with service (from message)