50 const double dAngularStepDegrees = 57,
51 const double dMaxRadius = 25,
52 const double dStartingHeadingDegrees = 0,
53 const double dStartSpacing = 1)
56 std::vector<geoops::Waypoint> vWaypoints;
57 double dAngularStepRadians = dAngularStepDegrees * M_PI / 180;
58 double dAngleRadians = (dStartingHeadingDegrees + 90) * M_PI / 180;
59 double dCurrentSpacingWindUp = 0.0;
60 double dStartingX = stStartingPoint.dEasting;
61 double dStartingY = stStartingPoint.dNorthing;
62 double dCurrentRadius = 0.0;
68 LOG_WARNING(logging::g_qSharedLogger,
"MaxRadius is less than 1 meter. Cannot create spiral pattern.");
73 while (dCurrentRadius <= dMaxRadius)
76 double dCurrentX = dStartingX + dCurrentSpacingWindUp *
cos(dAngleRadians);
77 double dCurrentY = dStartingY + dCurrentSpacingWindUp *
sin(dAngleRadians);
81 stCurrentCoordinate.dEasting = dCurrentX;
82 stCurrentCoordinate.dNorthing = dCurrentY;
83 geoops::Waypoint stCurrentWaypoint(stCurrentCoordinate, geoops::WaypointType::eNavigationWaypoint);
84 vWaypoints.push_back(stCurrentWaypoint);
87 dAngleRadians += dAngularStepRadians;
88 dCurrentSpacingWindUp += dStartSpacing;
95 std::string szSearchPatternPoints =
"Search Pattern Points (Spiral): ";
98 szSearchPatternPoints +=
99 "(" + std::to_string(stWaypoint.GetGPSCoordinate().dLatitude) +
", " + std::to_string(stWaypoint.GetGPSCoordinate().dLongitude) +
"), ";
102 LOG_DEBUG(logging::g_qSharedLogger,
"{}", szSearchPatternPoints);
125 const double dAngularStepDegrees = 57,
126 const double dMaxRadius = 25,
127 const double dStartingHeadingDegrees = 0,
128 const double dStartSpacing = 1)
131 std::vector<geoops::Waypoint> vWaypoints;
133 double dAngularStepRadians = dAngularStepDegrees * M_PI / 180;
134 double dAngleRadians = (dStartingHeadingDegrees + 90) * M_PI / 180;
135 double dCurrentSpacingWindUp = 0.0;
136 double dStartingX = stStartingPointUTM.dEasting;
137 double dStartingY = stStartingPointUTM.dNorthing;
138 double dCurrentRadius = 0.0;
144 LOG_WARNING(logging::g_qSharedLogger,
"MaxRadius is less than 1 meter. Cannot create spiral pattern.");
149 while (dCurrentRadius <= dMaxRadius)
152 double dCurrentX = dStartingX + dCurrentSpacingWindUp *
cos(dAngleRadians);
153 double dCurrentY = dStartingY + dCurrentSpacingWindUp *
sin(dAngleRadians);
157 stCurrentCoordinate.dEasting = dCurrentX;
158 stCurrentCoordinate.dNorthing = dCurrentY;
159 geoops::Waypoint stCurrentWaypoint(stCurrentCoordinate, geoops::WaypointType::eNavigationWaypoint);
160 vWaypoints.push_back(stCurrentWaypoint);
163 dAngleRadians += dAngularStepRadians;
164 dCurrentSpacingWindUp += dStartSpacing;
171 std::string szSearchPatternPoints =
"Search Pattern Points (Spiral): ";
174 szSearchPatternPoints +=
175 "(" + std::to_string(stWaypoint.GetGPSCoordinate().dLatitude) +
", " + std::to_string(stWaypoint.GetGPSCoordinate().dLongitude) +
"), ";
178 LOG_DEBUG(logging::g_qSharedLogger,
"{}", szSearchPatternPoints);
201 const double dWidth = 20.0,
202 const double dHeight = 20.0,
203 const double dSpacing = 1.0,
204 const bool bVertical =
true)
207 std::vector<geoops::Waypoint> vWaypoints;
208 double dStartingX = stCenterPoint.dEasting - (dWidth / 2);
209 double dStartingY = stCenterPoint.dNorthing - (dHeight / 2);
210 double dCurrentX = dStartingX;
211 double dCurrentY = dStartingY;
212 bool bZigNotZag =
true;
213 double bCalcSpacing = dSpacing;
216 if (dWidth < 1 || dHeight < 1 || dSpacing < 1)
219 LOG_WARNING(logging::g_qSharedLogger,
"Width or height or spacing is less than 1 meter. Cannot create zigzag pattern.");
224 if (bCalcSpacing > dWidth / 2.0)
227 LOG_WARNING(logging::g_qSharedLogger,
"Spacing is greater than width. Setting spacing to width / 2.");
229 bCalcSpacing = dWidth / 2.0 - 1.0;
231 if (bCalcSpacing > dHeight / 2.0)
234 LOG_WARNING(logging::g_qSharedLogger,
"Spacing is greater than height. Setting spacing to height / 2.");
236 bCalcSpacing = dHeight / 2.0 - 1.0;
240 while ((bVertical && dCurrentY <= dStartingY + dHeight) || (!bVertical && dCurrentX <= dStartingX + dWidth))
249 dCurrentX = dStartingX + (dWidth / 2);
254 dCurrentX = dStartingX - (dWidth / 2);
263 dCurrentY = dStartingY + (dHeight / 2);
268 dCurrentY = dStartingY - (dHeight / 2);
273 while ((bZigNotZag && bVertical && dCurrentX <= dStartingX + dWidth) || (!bZigNotZag && bVertical && dCurrentX >= dStartingX) ||
274 (bZigNotZag && !bVertical && dCurrentY <= dStartingY + dHeight) || (!bZigNotZag && !bVertical && dCurrentY >= dStartingY))
278 stCurrentCoordinate.dEasting = dCurrentX;
279 stCurrentCoordinate.dNorthing = dCurrentY;
280 geoops::Waypoint stCurrentWaypoint(stCurrentCoordinate, geoops::WaypointType::eNavigationWaypoint);
282 vWaypoints.push_back(stCurrentWaypoint);
288 dCurrentX += bZigNotZag ? bCalcSpacing : -bCalcSpacing;
293 dCurrentY += bZigNotZag ? bCalcSpacing : -bCalcSpacing;
300 dCurrentY += bCalcSpacing;
304 dCurrentX += bCalcSpacing;
308 bZigNotZag = !bZigNotZag;
318 std::vector<geoops::Waypoint> vFilterWaypoints;
320 vFilterWaypoints.push_back(vWaypoints[0]);
322 for (
size_t i = 0; i < vWaypoints.size() - 1; ++i)
326 if (stGeoMeasurement.dDistanceMeters > bCalcSpacing * 1.5)
329 vFilterWaypoints.push_back(vWaypoints[i]);
330 vFilterWaypoints.push_back(vWaypoints[i + 1]);
335 std::string szSearchPatternPoints =
"Search Pattern Points (Spiral): ";
338 szSearchPatternPoints +=
339 "(" + std::to_string(stWaypoint.GetGPSCoordinate().dLatitude) +
", " + std::to_string(stWaypoint.GetGPSCoordinate().dLongitude) +
"), ";
342 LOG_DEBUG(logging::g_qSharedLogger,
"{}", szSearchPatternPoints);
345 return vFilterWaypoints;
366 const double dWidth = 20.0,
367 const double dHeight = 20.0,
368 const double dSpacing = 1.0,
369 const bool bVertical =
true)
372 std::vector<geoops::Waypoint> vWaypoints;
374 double dStartingX = stCenterPointUTM.dEasting - (dWidth / 2);
375 double dStartingY = stCenterPointUTM.dNorthing - (dHeight / 2);
376 double dCurrentX = dStartingX;
377 double dCurrentY = dStartingY;
378 bool bZigNotZag =
true;
379 double bCalcSpacing = dSpacing;
382 if (dWidth < 1 || dHeight < 1 || dSpacing < 1)
385 LOG_WARNING(logging::g_qSharedLogger,
"Width or height or spacing is less than 1 meter. Cannot create zigzag pattern.");
390 if (bCalcSpacing > dWidth / 2.0)
393 LOG_WARNING(logging::g_qSharedLogger,
"Spacing is greater than width. Setting spacing to width / 2.");
395 bCalcSpacing = dWidth / 2.0 - 1.0;
397 if (bCalcSpacing > dHeight / 2.0)
400 LOG_WARNING(logging::g_qSharedLogger,
"Spacing is greater than height. Setting spacing to height / 2.");
402 bCalcSpacing = dHeight / 2.0 - 1.0;
406 while ((bVertical && dCurrentY <= dStartingY + dHeight) || (!bVertical && dCurrentX <= dStartingX + dWidth))
415 dCurrentX = dStartingX + bCalcSpacing;
420 dCurrentX = dStartingX - bCalcSpacing;
429 dCurrentY = dStartingY + bCalcSpacing;
434 dCurrentY = dStartingY - bCalcSpacing;
439 while ((bZigNotZag && bVertical && dCurrentX <= dStartingX + dWidth) || (!bZigNotZag && bVertical && dCurrentX >= dStartingX) ||
440 (bZigNotZag && !bVertical && dCurrentY <= dStartingY + dHeight) || (!bZigNotZag && !bVertical && dCurrentY >= dStartingY))
444 stCurrentCoordinate.dEasting = dCurrentX;
445 stCurrentCoordinate.dNorthing = dCurrentY;
446 geoops::Waypoint stCurrentWaypoint(stCurrentCoordinate, geoops::WaypointType::eNavigationWaypoint);
448 vWaypoints.push_back(stCurrentWaypoint);
454 dCurrentX += bZigNotZag ? bCalcSpacing : -bCalcSpacing;
459 dCurrentY += bZigNotZag ? bCalcSpacing : -bCalcSpacing;
466 dCurrentY += bCalcSpacing;
470 dCurrentX += bCalcSpacing;
474 bZigNotZag = !bZigNotZag;
484 std::vector<geoops::Waypoint> vFilterWaypoints;
486 vFilterWaypoints.push_back(vWaypoints[0]);
488 for (
size_t i = 0; i < vWaypoints.size() - 1; ++i)
492 if (stGeoMeasurement.dDistanceMeters > bCalcSpacing * 1.5)
495 vFilterWaypoints.push_back(vWaypoints[i]);
496 vFilterWaypoints.push_back(vWaypoints[i + 1]);
501 std::string szSearchPatternPoints =
"Search Pattern Points (Spiral): ";
504 szSearchPatternPoints +=
505 "(" + std::to_string(stWaypoint.GetGPSCoordinate().dLatitude) +
", " + std::to_string(stWaypoint.GetGPSCoordinate().dLongitude) +
"), ";
508 LOG_DEBUG(logging::g_qSharedLogger,
"{}", szSearchPatternPoints);
511 return vFilterWaypoints;