-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tutorial_1_Sequential_goal.py
67 lines (55 loc) · 2.09 KB
/
Tutorial_1_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: Bizbot Technology
#This is simple action server for moving robot to specific goal sequence
#Toget the actual value of pose.position x,y or z please echo the topics pose
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 (home)
goal = MoveBaseGoal()
goal.target_pose.header.frame_id = 'map'
goal.target_pose.pose.position.x = 0.159249559045
goal.target_pose.pose.position.y = 0.159249559045
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.2387996912
goal.target_pose.pose.position.y = -2.37061619759
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 = 0.482237994671
goal.target_pose.pose.position.y = -2.21642422676
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 = 1.44501769543
goal.target_pose.pose.position.y = 0.224104806781
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..")