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
GetNearbyLiDAR.hpp File Reference

Example usage of the LiDARHandler class. More...

Include dependency graph for GetNearbyLiDAR.hpp:

Go to the source code of this file.

Functions

void RunExample ()
 Example function to demonstrate the usage of LiDARHandler.
 

Detailed Description

Example usage of the LiDARHandler class.

Demonstrates how to query a prebuilt SQLite LiDAR database for nearby points within a specified radius of a UTM coordinate. Results are printed to the console in a readable format.

Author
ClayJay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om), Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2025-05-20

Function Documentation

◆ RunExample()

void RunExample ( )

Example function to demonstrate the usage of LiDARHandler.

Author
ClayJay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om), Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2025-05-20
30{
31 // Create and initialize handler
32 LiDARHandler handler;
33 if (!handler.OpenDB(constants::LIDAR_HANDLER_DB_PATH))
34 {
35 std::cerr << "Failed to initialize LiDARHandler.\n";
36 return;
37 }
38
39 // Define test location and radius
40 double dTestEasting = 614058.84;
41 double dTestNorthing = 4189968.85;
42 double dRadiusMeters = 3.0;
43 double dMinTravScore = 0.95;
44
45 LOG_INFO(logging::g_qSharedLogger, "Querying for points within {} meters of ({}, {}, {}):", dRadiusMeters, dTestEasting, dTestNorthing, dMinTravScore);
46
47 // Execute query
48 std::vector<LiDARHandler::PointRow> vPoints =
49 handler.GetLiDARData({.dEasting = dTestEasting,
50 .dNorthing = dTestNorthing,
51 .dRadius = dRadiusMeters,
52 .dTraversalScore = std::optional<LiDARHandler::PointFilter::Range<double>>({dMinTravScore, 1.0})});
53
54 // Print results
55 if (vPoints.empty())
56 {
57 LOG_INFO(logging::g_qSharedLogger, "No points found in that radius.");
58 }
59 else
60 {
61 // Loop through and print each point
62 for (const LiDARHandler::PointRow& stPoint : vPoints)
63 {
64 // Assemble a string to print point data.
65 std::string szPointInfo = "Point ID: " + std::to_string(stPoint.nID) + "\n";
66 szPointInfo += "Easting: " + std::to_string(stPoint.dEasting) + "\n";
67 szPointInfo += "Northing: " + std::to_string(stPoint.dNorthing) + "\n";
68 szPointInfo += "Altitude: " + std::to_string(stPoint.dAltitude) + "\n";
69 szPointInfo += "Zone: " + stPoint.szZone + "\n";
70 szPointInfo += "Classification: " + stPoint.szClassification + "\n";
71 szPointInfo +=
72 "Normal Vector: (" + std::to_string(stPoint.dNormalX) + ", " + std::to_string(stPoint.dNormalY) + ", " + std::to_string(stPoint.dNormalZ) + ")\n";
73 szPointInfo += "Slope: " + std::to_string(stPoint.dSlope) + "\n";
74 szPointInfo += "Roughness: " + std::to_string(stPoint.dRoughness) + "\n";
75 szPointInfo += "Curvature: " + std::to_string(stPoint.dCurvature) + "\n";
76 szPointInfo += "Traversal Score: " + std::to_string(stPoint.dTraversalScore) + "\n";
77 szPointInfo += "-----------------------------------\n";
78
79 // Submit logger message.
80 LOG_NOTICE(logging::g_qSharedLogger, "{}", szPointInfo);
81 }
82
83 LOG_INFO(logging::g_qSharedLogger, "Query complete. {} result(s) returned.", vPoints.size());
84 }
85}
Definition LiDARHandler.h:31
std::vector< PointRow > GetLiDARData(const PointFilter &stPointFilter)
Retrieves LiDAR data points from the database based on the specified filter.
Definition LiDARHandler.cpp:155
bool OpenDB(const std::string &szDBPath)
Initializes the LiDARHandler by opening the SQLite database and preparing the query.
Definition LiDARHandler.cpp:60
Definition LiDARHandler.h:38
Here is the call graph for this function: