8 from tf
import TransformListener
9 from geometry_msgs.msg
import PoseStamped
13 rospy.init_node(
'demo', anonymous=
True)
14 self.
worldFrame = rospy.get_param(
"~worldFrame",
"/world")
15 self.
frame = rospy.get_param(
"~frame")
16 self.
pubGoal = rospy.Publisher(
'goal', PoseStamped, queue_size=1)
22 self.listener.waitForTransform(self.
worldFrame, self.
frame, rospy.Time(), rospy.Duration(5.0))
26 while not rospy.is_shutdown():
28 goal.header.stamp = rospy.Time.now()
32 quaternion = tf.transformations.quaternion_from_euler(0, 0, self.
goals[self.
goalIndex][3])
33 goal.pose.orientation.x = quaternion[0]
34 goal.pose.orientation.y = quaternion[1]
35 goal.pose.orientation.z = quaternion[2]
36 goal.pose.orientation.w = quaternion[3]
38 self.pubGoal.publish(goal)
42 position, quaternion = self.listener.lookupTransform(self.
worldFrame, self.
frame, t)
43 rpy = tf.transformations.euler_from_quaternion(quaternion)
47 and math.fabs(rpy[2] - self.
goals[self.
goalIndex][3]) < math.radians(10) \
def __init__(self, goals)