6 from tf
import transformations
7 from geometry_msgs.msg
import PoseWithCovarianceStamped
17 p = PoseWithCovarianceStamped()
18 p.header.frame_id =
"map" 19 p.header.stamp = self.
stamp 20 p.pose.pose.position.x = self.
pose[0]
21 p.pose.pose.position.y = self.
pose[1]
22 (p.pose.pose.orientation.x,
23 p.pose.pose.orientation.y,
24 p.pose.pose.orientation.z,
25 p.pose.pose.orientation.w) = transformations.quaternion_from_euler(0, 0, self.
pose[2])
26 p.pose.covariance[6*0+0] = 0.5 * 0.5
27 p.pose.covariance[6*1+1] = 0.5 * 0.5
28 p.pose.covariance[6*3+3] = math.pi/12.0 * math.pi/12.0
35 if __name__ ==
'__main__':
36 pose = map(float, rospy.myargv()[1:4])
37 t_stamp = rospy.Time()
38 t_publish = rospy.Time()
39 if len(rospy.myargv()) > 4:
40 t_stamp = rospy.Time.from_sec(float(rospy.myargv()[4]))
41 if len(rospy.myargv()) > 5:
42 t_publish = rospy.Time.from_sec(float(rospy.myargv()[5]))
43 rospy.init_node(
'pose_setter', anonymous=
True)
44 rospy.loginfo(
"Going to publish pose {} with stamp {} at {}".format(pose, t_stamp.to_sec(), t_publish.to_sec()))
45 pub = rospy.Publisher(
"initialpose", PoseWithCovarianceStamped,
PoseSetter(pose, stamp=t_stamp, publish_time=t_publish), queue_size=1)
def peer_subscribe(self, topic_name, topic_publish, peer_publish)
def __init__(self, pose, stamp, publish_time)