3 import roslib; roslib.load_manifest(
'marker_rviz_plugin' )
4 from math
import cos, sin, pi
5 from geometry_msgs.msg
import PoseWithCovarianceStamped, PoseStamped, Pose
6 from marker_msgs.msg
import Marker, MarkerDetection, MarkerWithCovariance, MarkerWithCovarianceArray, MarkerWithCovarianceStamped
11 publisher_detection = rospy.Publisher(
'marker_detection', MarkerDetection, queue_size=5 )
12 publisher_cov = rospy.Publisher(
'marker_with_cov', MarkerWithCovarianceStamped, queue_size=5 )
14 rospy.init_node(
'test_marker_covariance' )
19 rate = rospy.Rate(100)
27 while not rospy.is_shutdown():
28 stamp = rospy.Time.now()
31 marker_detection = MarkerDetection()
32 marker_detection.header.frame_id =
"/base_link" 33 marker_detection.header.stamp = stamp
34 marker_detection.type =
"bch" 38 marker.ids_confidence.append(1)
40 marker.pose.position.x = 4.5
41 marker.pose.position.y = 4.0
42 marker.pose.position.z = 0.0
43 ori = marker.pose.orientation
44 ori.x, ori.y, ori.z, ori.w = tf.transformations.quaternion_from_euler(r, p, y + cos(10 * angle))
47 marker_detection.markers.append(marker)
49 publisher_detection.publish( marker_detection )
54 markerc.ids_confidence.append(1)
56 markerc.pose.position.x = 6.03287422834
57 markerc.pose.position.y = 4.93379116194
58 markerc.pose.position.z = 0.0
59 ori = markerc.pose.orientation
63 ori.w = 0.985817765219
65 marker_with_cov_s = MarkerWithCovarianceStamped()
66 marker_with_cov_s.header.frame_id =
"/base_link" 67 marker_with_cov_s.header.stamp = stamp
69 marker_with_cov_s.marker = MarkerWithCovariance()
70 marker_with_cov_s.marker.marker = markerc
71 marker_with_cov_s.marker.covariance = [0.011241161991539792, -0.011615365449532622, 0.0, 0.0, 0.0, -0.002759911553295745, -0.011615365449532622, 0.01903682230368378, 0.0, 0.0, 0.0, 0.00390837573140233, 0.0, 0.0, 0.00203078279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.00203078279, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.00203078279, 0.0, -0.002759911553295745, 0.00390837573140233, 0.0, 0.0, 0.0, 0.01827704518]
73 publisher_cov.publish( marker_with_cov_s )
76 br.sendTransform((marker.pose.position.x, marker.pose.position.y, marker.pose.position.z),
77 (ori.x, ori.y, ori.z, ori.w),
94 child_frame_id: /odom_msg 106 covariance: [0.9919999999999933, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.030461741978670857, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.030461741978670857, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2741556778080377] 122 ids_confidence: [1.0] 133 covariance: [5.145585936373751e-06, 3.5465074498143265e-06, 0.0, 0.0, 0.0, 7.763297496781882e-09, 3.5465074498143265e-06, 2.7218408354024943e-06, 0.0, 0.0, 0.0, 6.08589337627961e-09, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.763297496781882e-09, 6.08589337627961e-09, 0.0, 0.0, 0.0, 2.1112777137113703e-08] 137 ids_confidence: [1.0] 146 z: -0.000658593183246 148 covariance: [9.593501938212036e-05, -2.22641412848119e-05, 0.0, 0.0, 0.0, 4.916769263738688e-07, -2.22641412848119e-05, 5.104665830981123e-05, 0.0, 0.0, 0.0, -2.248132132389405e-06, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.916769263738688e-07, -2.248132132389405e-06, 0.0, 0.0, 0.0, 1.7013588091485252e-06] 152 ids_confidence: [1.0] 161 z: -0.000983026938579 163 covariance: [0.00013515838629420734, 9.920123763170366e-07, 0.0, 0.0, 0.0, 6.020879714999367e-06, 9.920123763170366e-07, 1.3787290943207972e-05, 0.0, 0.0, 0.0, 3.510932706789802e-06, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.020879714999367e-06, 3.510932706789802e-06, 0.0, 0.0, 0.0, 2.10976565686069e-06] 167 ids_confidence: [1.0] 178 covariance: [0.011241161991539792, -0.011615365449532622, 0.0, 0.0, 0.0, -0.002759911553295745, -0.011615365449532622, 0.01903682230368378, 0.0, 0.0, 0.0, 0.00390837573140233, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.002759911553295745, 0.00390837573140233, 0.0, 0.0, 0.0, 0.0008458541363815106] 181 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 182 0.0, 0.001, 0.0, 0.0, 0.0, 0.0, 183 0.0, 0.0, 0.001, 0.0, 0.0, 0.0, 184 0.0, 0.0, 0.0, 0.030461741978670857, 0.0, 0.0, 185 0.0, 0.0, 0.0, 0.0, 0.030461741978670857, 0.0, 186 0.0, 0.0, 0.0, 0.0, 0.0, 0.2741556778080377