34 from threading
import Lock
39 from tf.listener
import TransformListener
40 from tf.transformations
import quaternion_matrix
42 from actionlib_msgs.msg
import GoalStatus, GoalStatusArray
43 from control_msgs.msg
import PointHeadAction, PointHeadGoal
44 from geometry_msgs.msg
import PointStamped
45 from nav_msgs.msg
import Path
60 self.
client.wait_for_server()
67 for status
in msg.status_list:
68 if status.status == GoalStatus.ACTIVE:
75 pose_stamped = msg.poses[-1]
76 pose = pose_stamped.pose
79 R = quaternion_matrix([pose.orientation.x, pose.orientation.y, pose.orientation.z, pose.orientation.w])
84 p.header.frame_id = pose_stamped.header.frame_id
85 p.header.stamp = rospy.Time(0)
86 p.point.x += pose_stamped.pose.position.x + M[0,0]
87 p.point.y += pose_stamped.pose.position.y + M[1,0]
88 p.point.z += pose_stamped.pose.position.z + M[2,0]
91 p = self.
listener.transformPoint(
"base_link", p)
101 elif p.point.y < -0.5:
107 while not rospy.is_shutdown():
109 goal = PointHeadGoal()
110 goal.target.header.stamp = rospy.Time.now()
111 goal.target.header.frame_id =
"base_link" 113 goal.target.point.x = self.
x 114 goal.target.point.y = self.
y 117 goal.target.point.z = 0.0
118 goal.min_duration = rospy.Duration(1.0)
120 self.
client.send_goal(goal)
121 self.
client.wait_for_result()
124 goal.target.point.x = self.
x 125 goal.target.point.y = self.
y 128 goal.target.point.z = 0.75
130 self.
client.send_goal(goal)
131 self.
client.wait_for_result()
135 if __name__==
"__main__":
136 rospy.init_node(
"tilt_head_node")
def statCallback(self, msg)
def planCallback(self, msg)