Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
SearchPattern.cc File Reference

Unit test for SearchPattern algorithm namespace. More...

Include dependency graph for SearchPattern.cc:

Classes

class  SearchPatternTests
 Unit Test Class for the SearchPattern. More...

Functions

 TEST_F (SearchPatternTests, SpiralPatternShapeGPS)
 Test SearchPattern algorithm functionality.
 TEST_F (SearchPatternTests, SpiralPatternShapeUTM)
 Test SearchPattern algorithm functionality.
 TEST_F (SearchPatternTests, ZigZagPatternShapeGPS)
 Test SearchPattern algorithm functionality.
 TEST_F (SearchPatternTests, ZigZagPatternShapeGPSHorizontal)
 Test SearchPattern algorithm functionality.
 TEST_F (SearchPatternTests, ZigZagPatternShapeUTM)
 Test SearchPattern algorithm functionality.
 TEST_F (SearchPatternTests, ZigZagPatternShapeUTMHorizontal)
 Test SearchPattern algorithm functionality.
 TEST_F (SearchPatternTests, SpiralPatternRadiusTooSmall)
 Test SearchPattern algorithm functionality.
 TEST_F (SearchPatternTests, ZigZagPatternRadiusTooSmall)
 Test SearchPattern algorithm functionality.
 TEST_F (SearchPatternTests, ZigZagPatternLimitSpacing)
 Test SearchPattern algorithm functionality.
 TEST_F (SearchPatternTests, SnakePatternShape)
 Test SearchPattern algorithm functionality.

Detailed Description

Unit test for SearchPattern algorithm namespace.

Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2024-03-01

Function Documentation

◆ TEST_F() [1/10]

TEST_F ( SearchPatternTests ,
SpiralPatternShapeGPS  )

Test SearchPattern algorithm functionality.

Author
ClayJay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-10-12
203{
204 // Create a new GPS coordinate.
205 geoops::GPSCoordinate stGPSRollaCoordinate(37.951766, -91.778187);
206
207 // Use this for generating a search pattern with default params.
208 std::vector<geoops::Waypoint> vSearchPatternPath = searchpattern::CalculateSpiralPatternWaypoints(stGPSRollaCoordinate);
209
210 // Check if the outward half resembles an outward spiral pattern.
211 std::vector<geoops::Waypoint> vOutwardHalf(vSearchPatternPath.begin(), vSearchPatternPath.begin() + vSearchPatternPath.size() / 2);
212 EXPECT_TRUE(IsOutwardSpiral(vOutwardHalf));
213}
std::vector< geoops::Waypoint > CalculateSpiralPatternWaypoints(const geoops::Waypoint &stStartingPoint, const double dAngularStepDegrees=57, const double dMaxRadius=25, const double dStartingHeadingDegrees=0, const double dStartSpacing=1)
Perform a spiral search pattern starting from a given point.
Definition SearchPattern.hpp:49
This struct stores/contains information about a GPS data.
Definition GeospatialOperations.hpp:100
Here is the call graph for this function:

◆ TEST_F() [2/10]

TEST_F ( SearchPatternTests ,
SpiralPatternShapeUTM  )

Test SearchPattern algorithm functionality.

Author
ClayJay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-10-12
223{
224 // Create a new GPS coordinate.
225 geoops::UTMCoordinate stUTMRollaCoordinate(607344.14, 4201167.33, 15, true);
226
227 // Use this for generating a search pattern with default params.
228 std::vector<geoops::Waypoint> vSearchPatternPath = searchpattern::CalculateSpiralPatternWaypoints(stUTMRollaCoordinate);
229
230 // Check if the outward half resembles an outward spiral pattern.
231 std::vector<geoops::Waypoint> vOutwardHalf(vSearchPatternPath.begin(), vSearchPatternPath.begin() + vSearchPatternPath.size() / 2);
232 EXPECT_TRUE(IsOutwardSpiral(vOutwardHalf));
233}
This struct stores/contains information about a UTM coordinate.
Definition GeospatialOperations.hpp:211
Here is the call graph for this function:

◆ TEST_F() [3/10]

TEST_F ( SearchPatternTests ,
ZigZagPatternShapeGPS  )

Test SearchPattern algorithm functionality.

Author
ClayJay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2024-04-01
243{
244 // Create a new GPS coordinate.
245 geoops::GPSCoordinate stGPSRollaCoordinate(37.951766, -91.778187);
246
247 // Use this for generating a search pattern with default params.
248 std::vector<geoops::Waypoint> vSearchPatternPath = searchpattern::CalculateZigZagPatternWaypoints(stGPSRollaCoordinate);
249
250 // Check if the returned path resembles an outward spiral pattern.
251 EXPECT_TRUE(IsZigZag(vSearchPatternPath));
252}
std::vector< geoops::Waypoint > CalculateZigZagPatternWaypoints(const geoops::Waypoint &stCenterPoint, const double dWidth=20.0, const double dHeight=20.0, const double dSpacing=1.0, const bool bVertical=true)
Calculate waypoints for a zigzag pattern. This function generates waypoints for a zigzag pattern star...
Definition SearchPattern.hpp:143
Here is the call graph for this function:

◆ TEST_F() [4/10]

TEST_F ( SearchPatternTests ,
ZigZagPatternShapeGPSHorizontal  )

Test SearchPattern algorithm functionality.

Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2025-01-06
262{
263 // Create a new GPS coordinate.
264 geoops::GPSCoordinate stGPSRollaCoordinate(37.951766, -91.778187);
265
266 // Use this for generating a search pattern with default params.
267 std::vector<geoops::Waypoint> vSearchPatternPath = searchpattern::CalculateZigZagPatternWaypoints(stGPSRollaCoordinate, 20.0, 20.0, 1.0, false);
268
269 // Check if the returned path resembles an outward spiral pattern.
270 EXPECT_TRUE(IsZigZag(vSearchPatternPath));
271}
Here is the call graph for this function:

◆ TEST_F() [5/10]

TEST_F ( SearchPatternTests ,
ZigZagPatternShapeUTM  )

Test SearchPattern algorithm functionality.

Author
ClayJay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2024-04-01
281{
282 // Create a new GPS coordinate.
283 geoops::UTMCoordinate stUTMRollaCoordinate(607344.14, 4201167.33, 15, true);
284
285 // Use this for generating a search pattern with default params.
286 std::vector<geoops::Waypoint> vSearchPatternPath = searchpattern::CalculateZigZagPatternWaypoints(stUTMRollaCoordinate);
287
288 // Check if the returned path resembles an outward spiral pattern.
289 EXPECT_TRUE(IsZigZag(vSearchPatternPath));
290}
Here is the call graph for this function:

◆ TEST_F() [6/10]

TEST_F ( SearchPatternTests ,
ZigZagPatternShapeUTMHorizontal  )

Test SearchPattern algorithm functionality.

Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2025-01-06
300{
301 // Create a new GPS coordinate.
302 geoops::UTMCoordinate stUTMRollaCoordinate(607344.14, 4201167.33, 15, true);
303
304 // Use this for generating a search pattern with default params.
305 std::vector<geoops::Waypoint> vSearchPatternPath = searchpattern::CalculateZigZagPatternWaypoints(stUTMRollaCoordinate, 20.0, 20.0, 2.0, false);
306 std::vector<geoops::Waypoint> vSearchPatternPath2 = searchpattern::CalculateZigZagPatternWaypoints(stUTMRollaCoordinate, 20.0, 20.0, 2.0, true);
307
308 // Check if the returned path resembles an outward spiral pattern.
309 EXPECT_TRUE(IsZigZag(vSearchPatternPath));
310}
Here is the call graph for this function:

◆ TEST_F() [7/10]

TEST_F ( SearchPatternTests ,
SpiralPatternRadiusTooSmall  )

Test SearchPattern algorithm functionality.

Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2025-01-06
320{
321 // Create a new GPS coordinate.
322 geoops::GPSCoordinate stGPSRollaCoordinate(37.951766, -91.778187);
323 // Use this for generating a search pattern with default params.
324 std::vector<geoops::Waypoint> vSearchPatternPath = searchpattern::CalculateSpiralPatternWaypoints(stGPSRollaCoordinate, 57, 0);
325
326 // Create a new UTm coordinate.
327 geoops::UTMCoordinate stUTMRollaCoordinate(607344.14, 4201167.33, 15, true);
328 // Use this for generating a search pattern with default params.
329 std::vector<geoops::Waypoint> vSearchPatternPathUTM = searchpattern::CalculateSpiralPatternWaypoints(stUTMRollaCoordinate, 57, 0);
330
331 // Check if the returned path resembles an outward spiral pattern.
332 EXPECT_TRUE(vSearchPatternPath.empty());
333 EXPECT_TRUE(vSearchPatternPathUTM.empty());
334}
Here is the call graph for this function:

◆ TEST_F() [8/10]

TEST_F ( SearchPatternTests ,
ZigZagPatternRadiusTooSmall  )

Test SearchPattern algorithm functionality.

Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2025-01-06
344{
345 // Create a new GPS coordinate.
346 geoops::GPSCoordinate stGPSRollaCoordinate(37.951766, -91.778187);
347 // Use this for generating a search pattern with default params.
348 std::vector<geoops::Waypoint> vSearchPatternPath = searchpattern::CalculateZigZagPatternWaypoints(stGPSRollaCoordinate, 20.0, 20.0, 0);
349
350 // Create a new UTm coordinate.
351 geoops::UTMCoordinate stUTMRollaCoordinate(607344.14, 4201167.33, 15, true);
352 // Use this for generating a search pattern with default params.
353 std::vector<geoops::Waypoint> vSearchPatternPathUTM = searchpattern::CalculateZigZagPatternWaypoints(stUTMRollaCoordinate, 20.0, 20.0, 0);
354
355 // Check if the returned path resembles an outward spiral pattern.
356 EXPECT_TRUE(vSearchPatternPath.empty());
357 EXPECT_TRUE(vSearchPatternPathUTM.empty());
358}
Here is the call graph for this function:

◆ TEST_F() [9/10]

TEST_F ( SearchPatternTests ,
ZigZagPatternLimitSpacing  )

Test SearchPattern algorithm functionality.

Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2025-01-06
368{
369 // Create a new GPS coordinate.
370 geoops::GPSCoordinate stGPSRollaCoordinate(37.951766, -91.778187);
371 // Use this for generating a search pattern with default params.
372 std::vector<geoops::Waypoint> vSearchPatternPath = searchpattern::CalculateZigZagPatternWaypoints(stGPSRollaCoordinate, 20.0, 20.0, 30.0);
373 // Create a new UTm coordinate.
374 geoops::UTMCoordinate stUTMRollaCoordinate(607344.14, 4201167.33, 15, true);
375 // Use this for generating a search pattern with default params.
376 std::vector<geoops::Waypoint> vSearchPatternPathUTM = searchpattern::CalculateZigZagPatternWaypoints(stUTMRollaCoordinate, 20.0, 20.0, 30.0);
377
378 // Use this for generating a search pattern with default params.
379 std::vector<geoops::Waypoint> vSearchPatternPath2 = searchpattern::CalculateZigZagPatternWaypoints(stGPSRollaCoordinate, 60.0, 20.0, 30.0);
380 // Use this for generating a search pattern with default params.
381 std::vector<geoops::Waypoint> vSearchPatternPathUTM2 = searchpattern::CalculateZigZagPatternWaypoints(stUTMRollaCoordinate, 60.0, 20.0, 30.0);
382
383 // Both paths should be zigzags.
384 EXPECT_TRUE(IsZigZag(vSearchPatternPath));
385 EXPECT_TRUE(IsZigZag(vSearchPatternPathUTM));
386 EXPECT_TRUE(IsZigZag(vSearchPatternPath2));
387 EXPECT_TRUE(IsZigZag(vSearchPatternPathUTM2));
388}
Here is the call graph for this function:

◆ TEST_F() [10/10]

TEST_F ( SearchPatternTests ,
SnakePatternShape  )

Test SearchPattern algorithm functionality.

Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2025-04-14
398{
399 // Create a new GPS coordinate.
400 geoops::GPSCoordinate stGPSRollaCoordinate(37.951766, -91.778187);
401 // Generate a bunch of snake patterns with different parameters.
402 std::vector<geoops::Waypoint> vSearchPatternPath1 = searchpattern::CalculateSnakeSearchPattern(stGPSRollaCoordinate, 40.0, 40.0, 1.0, 2.0, true);
403 std::vector<geoops::Waypoint> vSearchPatternPath2 = searchpattern::CalculateSnakeSearchPattern(stGPSRollaCoordinate, 40.0, 40.0, 1.0, 2.0, false);
404 std::vector<geoops::Waypoint> vSearchPatternPath3 = searchpattern::CalculateSnakeSearchPattern(stGPSRollaCoordinate, 10.0, 10.0, 1.0, 4.0, true);
405 std::vector<geoops::Waypoint> vSearchPatternPath4 = searchpattern::CalculateSnakeSearchPattern(stGPSRollaCoordinate, 10.0, 10.0, 1.0, 4.0, false);
406 std::vector<geoops::Waypoint> vSearchPatternpath5 = searchpattern::CalculateSnakeSearchPattern(stGPSRollaCoordinate, 20.0, 10.0, 1.0, 4.0, true);
407 std::vector<geoops::Waypoint> vSearchPatternPath6 = searchpattern::CalculateSnakeSearchPattern(stGPSRollaCoordinate, 20.0, 10.0, 1.0, 4.0, false);
408 std::vector<geoops::Waypoint> vSearchPatternPath7 = searchpattern::CalculateSnakeSearchPattern(stGPSRollaCoordinate, 10.0, 20.0, 1.0, 4.0, true);
409 std::vector<geoops::Waypoint> vSearchPatternPath8 = searchpattern::CalculateSnakeSearchPattern(stGPSRollaCoordinate, 10.0, 20.0, 1.0, 4.0, false);
410 std::vector<geoops::Waypoint> vSearchPatternpath9 = searchpattern::CalculateSnakeSearchPattern(stGPSRollaCoordinate, 5.0, 5.0, 0.5, 4.0, true);
411 std::vector<geoops::Waypoint> vSearchPatternPath10 = searchpattern::CalculateSnakeSearchPattern(stGPSRollaCoordinate, 5.0, 5.0, 0.5, 4.0, false);
412 std::vector<geoops::Waypoint> vSearchPatternPath11 = searchpattern::CalculateSnakeSearchPattern(stGPSRollaCoordinate, 0.5, 0.5, 0.5, 4.0, true);
413
414 // Check if the returned path resembles a snake pattern.
415 EXPECT_TRUE(!vSearchPatternPath1.empty());
416 EXPECT_TRUE(!vSearchPatternPath2.empty());
417 EXPECT_TRUE(!vSearchPatternPath3.empty());
418 EXPECT_TRUE(!vSearchPatternPath4.empty());
419 EXPECT_TRUE(!vSearchPatternpath5.empty());
420 EXPECT_TRUE(!vSearchPatternPath6.empty());
421 EXPECT_TRUE(!vSearchPatternPath7.empty());
422 EXPECT_TRUE(!vSearchPatternPath8.empty());
423 EXPECT_TRUE(!vSearchPatternpath9.empty());
424 EXPECT_TRUE(!vSearchPatternPath10.empty());
425 EXPECT_TRUE(vSearchPatternPath11.empty());
426}
std::vector< geoops::Waypoint > CalculateSnakeSearchPattern(const geoops::Waypoint &stStartCoord, const double dWidth=20.0, const double dHeight=20.0, const double dSpacing=1.0, const int nNumberOfSlithers=1.0, const bool bVertical=true)
Calculate waypoints for a snake search pattern.
Definition SearchPattern.hpp:305
Here is the call graph for this function: