-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTutorial_9_sequential_goal.py
68 lines (55 loc) · 2.02 KB
/
Tutorial_9_sequential_goal.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#author: Ts. Khai
#Bizbot Technology
#This is simple action server for moving robot to specific goal sequence
import actionlib
import rospy
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal, MoveBaseFeedback, MoveBaseResult
rospy.init_node('send_client_goal')
client = actionlib.SimpleActionClient('/move_base', MoveBaseAction)
rospy.loginfo("Waiting for move base server")
client.wait_for_server()
#move robot to goal 1
goal = MoveBaseGoal()
goal.target_pose.header.frame_id = 'map'
goal.target_pose.pose.position.x = 0.359075546265
goal.target_pose.pose.position.y = -2.03587222099
goal.target_pose.pose.orientation.z = 1.0
goal.target_pose.pose.orientation.w = 0.000
rospy.loginfo("Sedang mencari GOAL 1")
client.send_goal(goal)
client.wait_for_result()
rospy.loginfo("Goal 1 reached")
#move robot to goal 2
goal = MoveBaseGoal()
goal.target_pose.header.frame_id = 'map'
goal.target_pose.pose.position.x = 1.06313192844
goal.target_pose.pose.position.y = -0.293134450912
goal.target_pose.pose.orientation.z = 1.0
goal.target_pose.pose.orientation.w = 0.000
rospy.loginfo("Sedang mencari GOAL 2")
client.send_goal(goal)
client.wait_for_result()
rospy.loginfo("Goal 2 reached")
#move robot to goal 3
goal = MoveBaseGoal()
goal.target_pose.header.frame_id = 'map'
goal.target_pose.pose.position.x = 3.84633827209
goal.target_pose.pose.position.y = -1.25584077835
goal.target_pose.pose.orientation.z = 1.0
goal.target_pose.pose.orientation.w = 0.000
rospy.loginfo("Sedang mencari GOAL 3")
client.send_goal(goal)
client.wait_for_result()
rospy.loginfo("Goal 3 reached")
#move robot to goal 4
goal = MoveBaseGoal()
goal.target_pose.header.frame_id = 'map'
goal.target_pose.pose.position.x = 2.91423511505
goal.target_pose.pose.position.y = -3.9102845192
goal.target_pose.pose.orientation.z = 1.0
goal.target_pose.pose.orientation.w = 0.000
rospy.loginfo("Sedang mencari GOAL 4")
client.send_goal(goal)
client.wait_for_result()
rospy.loginfo("Goal 4 reached")
rospy.loginfo("Sequential GOAL navigation program completed!!.... Now terminated..")