11 visualization_msgs::msg::MarkerArray out;
13 rclcpp::Time stamp = rclcpp::Time(
static_cast<uint64_t
>(time * 1e9));
15 std::vector<Landmark> timekeepingLms;
18 timekeepingLms.push_back(pair.first);
19 timekeepingLms.push_back(pair.second);
22 for (
auto& list : lists)
26 visualization_msgs::msg::Marker marker;
27 marker.header.frame_id = frame;
28 marker.header.stamp = stamp;
31 marker.frame_locked =
false;
33 marker.type = visualization_msgs::msg::Marker::CYLINDER;
34 marker.action = visualization_msgs::msg::Marker::MODIFY;
35 marker.pose.position.x = lm.position.x();
36 marker.pose.position.y = lm.position.y();
37 marker.pose.orientation.x = 0.0;
38 marker.pose.orientation.y = 0.0;
39 marker.pose.orientation.z = 0.0;
40 marker.pose.orientation.w = 1.0;
41 marker.scale.x = 0.228;
42 marker.scale.y = 0.228;
43 marker.scale.z = 0.325;
44 marker.color.a = this->
alpha;
45 marker.color.r = 0.0 / 255.0;
46 marker.color.g = 153.0 / 255.0;
47 marker.color.b = 51.0 / 255.0;
51 marker.color.r = 51.0 / 255.0;
52 marker.color.g = 102.0 / 255.0;
53 marker.color.b = 255.0 / 255.0;
56 marker.color.r = 255.0 / 255.0;
57 marker.color.g = 255.0 / 255.0;
58 marker.color.b = 0.0 / 255.0;
61 marker.color.r = 255.0 / 255.0;
62 marker.color.g = 153.0 / 255.0;
63 marker.color.b = 0.0 / 255.0;
66 marker.color.r = 255.0 / 255.0;
67 marker.color.g = 153.0 / 255.0;
68 marker.color.b = 0.0 / 255.0;
69 marker.scale.x = 0.285;
70 marker.scale.y = 0.285;
74 marker.color.r = 204.0 / 255.0;
75 marker.color.g = 51.0 / 255.0;
76 marker.color.b = 153.0 / 255.0;
77 marker.scale.x = 0.285;
78 marker.scale.y = 0.285;
82 marker.color.r = 99.0 / 255.0;
83 marker.color.g = 100.0 / 255.0;
84 marker.color.b = 102.0 / 255.0;
87 marker.color.r = 0.0 / 255.0;
88 marker.color.g = 153.0 / 255.0;
89 marker.color.b = 51.0 / 255.0;
93 marker.pose.position.z = lm.position.z() + marker.scale.z * 0.5;
94 out.markers.push_back(marker);
101 visualization_msgs::msg::Marker marker;
102 marker.header.frame_id = frame;
103 marker.header.stamp = stamp;
106 marker.frame_locked =
false;
108 marker.type = visualization_msgs::msg::Marker::LINE_STRIP;
109 marker.action = visualization_msgs::msg::Marker::MODIFY;
110 geometry_msgs::msg::Point p1;
111 p1.x = line.first.position.x();
112 p1.y = line.first.position.y();
113 p1.z = line.first.position.z();
114 marker.points.push_back(p1);
115 geometry_msgs::msg::Point p2;
116 p2.x = line.second.position.x();
117 p2.y = line.second.position.y();
118 p2.z = line.second.position.z();
119 marker.points.push_back(p2);
120 marker.pose.position.x = 0.0;
121 marker.pose.position.y = 0.0;
122 marker.pose.position.z = 0.0;
123 marker.pose.orientation.x = 0.0;
124 marker.pose.orientation.y = 0.0;
125 marker.pose.orientation.z = 0.0;
126 marker.pose.orientation.w = 1.0;
127 marker.scale.x = 0.15;
128 marker.scale.y = 0.0;
129 marker.scale.z = 0.0;
130 marker.color.a = this->
alpha;
131 marker.color.r = 153.0 / 255.0;
132 marker.color.g = 0.0 / 255.0;
133 marker.color.b = 153.0 / 255.0;
137 marker.color.r = 0.0 / 255.0;
138 marker.color.g = 102.0 / 255.0;
139 marker.color.b = 0.0 / 255.0;
144 marker.color.r = 128.0 / 255.0;
145 marker.color.g = 0.0 / 255.0;
146 marker.color.b = 0.0 / 255.0;
148 out.markers.push_back(marker);
152 visualization_msgs::msg::Marker markerLeftLine;
153 markerLeftLine.header.frame_id = frame;
154 markerLeftLine.header.stamp = stamp;
156 markerLeftLine.id = id;
157 markerLeftLine.frame_locked =
false;
159 markerLeftLine.type = visualization_msgs::msg::Marker::LINE_STRIP;
160 markerLeftLine.action = visualization_msgs::msg::Marker::MODIFY;
161 markerLeftLine.pose.position.x = 0.0;
162 markerLeftLine.pose.position.y = 0.0;
163 markerLeftLine.pose.position.z = 0.0;
164 markerLeftLine.pose.orientation.x = 0.0;
165 markerLeftLine.pose.orientation.y = 0.0;
166 markerLeftLine.pose.orientation.z = 0.0;
167 markerLeftLine.pose.orientation.w = 1.0;
168 markerLeftLine.scale.x = 0.05;
169 markerLeftLine.scale.y = 0.0;
170 markerLeftLine.scale.z = 0.0;
171 markerLeftLine.color.a = this->
alpha;
172 markerLeftLine.color.r = 51.0 / 255.0;
173 markerLeftLine.color.g = 102.0 / 255.0;
174 markerLeftLine.color.b = 255.0 / 255.0;
177 geometry_msgs::msg::Point point;
178 point.x = p.position.x();
179 point.y = p.position.y();
180 point.z = p.position.z() + 0.5 * markerLeftLine.scale.z;
181 markerLeftLine.points.push_back(point);
185 geometry_msgs::msg::Point point;
187 point.x = p.position.x();
188 point.y = p.position.y();
189 point.z = p.position.z() + 0.5 * markerLeftLine.scale.z;
190 markerLeftLine.points.push_back(point);
192 out.markers.push_back(markerLeftLine);
195 visualization_msgs::msg::Marker markerRightLane;
196 markerRightLane.header.frame_id = frame;
197 markerRightLane.header.stamp = stamp;
199 markerRightLane.id = id;
200 markerRightLane.frame_locked =
false;
202 markerRightLane.type = visualization_msgs::msg::Marker::LINE_STRIP;
203 markerRightLane.action = visualization_msgs::msg::Marker::MODIFY;
204 markerRightLane.pose.position.x = 0.0;
205 markerRightLane.pose.position.y = 0.0;
206 markerRightLane.pose.position.z = 0.0;
207 markerRightLane.pose.orientation.x = 0.0;
208 markerRightLane.pose.orientation.y = 0.0;
209 markerRightLane.pose.orientation.z = 0.0;
210 markerRightLane.pose.orientation.w = 1.0;
211 markerRightLane.scale.x = 0.05;
212 markerRightLane.scale.y = 0.0;
213 markerRightLane.scale.z = 0.0;
214 markerRightLane.color.a = this->
alpha;
215 markerRightLane.color.r = 255.0 / 255.0;
216 markerRightLane.color.g = 255.0 / 255.0;
217 markerRightLane.color.b = 0.0 / 255.0;
220 geometry_msgs::msg::Point point;
221 point.x = p.position.x();
222 point.y = p.position.y();
223 point.z = p.position.z() + 0.5 * markerRightLane.scale.z;
224 markerRightLane.points.push_back(point);
228 geometry_msgs::msg::Point point;
230 point.x = p.position.x();
231 point.y = p.position.y();
232 point.z = p.position.z() + 0.5 * markerRightLane.scale.z;
233 markerRightLane.points.push_back(point);
235 out.markers.push_back(markerRightLane);
240 visualization_msgs::msg::Marker marker;
241 marker.header.frame_id = frame;
242 marker.header.stamp = stamp;
245 marker.action = visualization_msgs::msg::Marker::DELETE;
246 out.markers.push_back(marker);
266 const LandmarkList& sensorLms, std::string frameId,
double time)
268 pacsim::msg::PerceptionDetections lmsMsg;
269 lmsMsg.header.frame_id = frameId;
270 lmsMsg.header.stamp = rclcpp::Time(
static_cast<uint64_t
>(time * 1e9));
274 pacsim::msg::PerceptionDetection lmMsg;
275 lmMsg.header = lmsMsg.header;
276 lmMsg.pose.pose.position.x = lm.position.x();
277 lmMsg.pose.pose.position.y = lm.position.y();
278 lmMsg.pose.pose.position.z = lm.position.z();
279 lmMsg.pose.covariance[0] = lm.cov(0, 0);
280 lmMsg.pose.covariance[1] = lm.cov(0, 1);
281 lmMsg.pose.covariance[2] = lm.cov(0, 2);
282 lmMsg.pose.covariance[3 + 3] = lm.cov(1, 0);
283 lmMsg.pose.covariance[4 + 3] = lm.cov(1, 1);
284 lmMsg.pose.covariance[5 + 3] = lm.cov(1, 2);
285 lmMsg.pose.covariance[6 + 6] = lm.cov(2, 0);
286 lmMsg.pose.covariance[7 + 6] = lm.cov(2, 1);
287 lmMsg.pose.covariance[8 + 6] = lm.cov(2, 2);
289 lmMsg.pose.covariance[3 + 3 * 6] = -1;
290 lmMsg.pose.covariance[4 + 4 * 6] = -1;
291 lmMsg.pose.covariance[4 + 5 * 6] = -1;
293 lmMsg.class_probabilities[pacsim::msg::PerceptionDetection::CLASS_UNKNOWN]
295 lmMsg.class_probabilities[pacsim::msg::PerceptionDetection::CLASS_BLUE] = lm.typeWeights[
LandmarkType::BLUE];
296 lmMsg.class_probabilities[pacsim::msg::PerceptionDetection::CLASS_YELLOW]
298 lmMsg.class_probabilities[pacsim::msg::PerceptionDetection::CLASS_ORANGE]
300 lmMsg.class_probabilities[pacsim::msg::PerceptionDetection::CLASS_BIGORANGE]
302 lmMsg.class_probabilities[pacsim::msg::PerceptionDetection::CLASS_TIMEKEEPING]
304 lmMsg.class_probabilities[pacsim::msg::PerceptionDetection::CLASS_INVISIBLE]
307 lmMsg.detection_probability = lm.detection_probability;
308 lmsMsg.detections.push_back(lmMsg);