Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions glider/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ include_directories(
add_library(${PROJECT_NAME} SHARED
src/parameters.cpp
src/time.cpp
src/gps_heading.cpp
src/differential_gps.cpp
src/odometry.cpp
src/odometry_with_covariance.cpp
Expand Down Expand Up @@ -160,13 +159,6 @@ if (BUILD_TESTS)
${PROJECT_NAME}
)

add_executable(heading_test test/test_heading.cpp)
target_link_libraries(heading_test
GTest::GTest
GTest::Main
${PROJECT_NAME}
)

add_executable(params_test test/test_params.cpp)
target_link_libraries(params_test
GTest::GTest
Expand Down Expand Up @@ -202,6 +194,14 @@ if (BUILD_TESTS)
${PROJECT_NAME}
)

add_executable(diff_gps_test test/test_differential_gps.cpp)
target_link_libraries(diff_gps_test
GTest::GTest
GTest::Main
${PROJECT_NAME}
)


add_executable(ros_conversion_test test/test_ros_conversions.cpp)
target_link_libraries(ros_conversion_test
GTest::GTest
Expand All @@ -212,11 +212,11 @@ if (BUILD_TESTS)

include(GoogleTest)
gtest_discover_tests(utm_test)
gtest_discover_tests(heading_test)
gtest_discover_tests(params_test)
gtest_discover_tests(manager_test)
gtest_discover_tests(glider_test)
gtest_discover_tests(odometry_test)
gtest_discover_tests(odometry_with_cov_test)
gtest_discover_tests(diff_gps_test)
gtest_discover_tests(ros_conversion_test)
endif()
1 change: 1 addition & 0 deletions glider/include/glider/core/differential_gps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class DifferentialGpsFromMotion
void setLastGps(const Eigen::Vector3d& gps);
bool isInitialized() const;
double getVelocityThreshold() const;
bool isIntegratable(const Eigen::Vector3d& vel) const;

private:

Expand Down
39 changes: 0 additions & 39 deletions glider/include/glider/utils/gps_heading.hpp

This file was deleted.

6 changes: 6 additions & 0 deletions glider/src/differential_gps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,9 @@ double DifferentialGpsFromMotion::headingRadiansToDegrees(const double heading)
heading_deg = std::fmod(std::fmod(heading_deg, 360.0) + 360.0, 360.0);
return heading_deg;
}

bool DifferentialGpsFromMotion::isIntegratable(const Eigen::Vector3d& velocity) const
{
double vel = velocity.head(2).norm();
return vel > vel_threshold_;
}
1 change: 0 additions & 1 deletion glider/src/factor_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "glider/core/factor_manager.hpp"
#include "glider/utils/geodetics.hpp"
#include "glider/utils/gps_heading.hpp"

#include <gtsam/slam/expressions.h>

Expand Down
38 changes: 0 additions & 38 deletions glider/src/gps_heading.cpp

This file was deleted.

100 changes: 100 additions & 0 deletions glider/test/test_differential_gps.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*!
* Jason Hughes
* October 2025
*
* test the differential gps
* object
*/

#include <gtest/gtest.h>

#include "glider/core/differential_gps.hpp"

static const double LAT = 32.925;
static const double LON = -75.199;
static const double ALT = 10.0;
static const double VEL = 1.0;

TEST(DifferentialGpsTestSuite, TestInitialization)
{
Glider::Geodetics::DifferentialGpsFromMotion dgps("enu", VEL);
Eigen::Vector3d gps(LAT, LON, ALT);

dgps.setLastGps(gps);

ASSERT_TRUE(dgps.isInitialized());
}

TEST(DifferentialGpsTestSuite, TestNorthHeading)
{
Glider::Geodetics::DifferentialGpsFromMotion dgps("enu", VEL);

double nlat = 39.942136;
double nlon = -75.19969;
double slat = 39.942041;
double slon = -75.199694;

dgps.setLastGps(Eigen::Vector3d(slat, slon, ALT));

double heading = dgps.getHeading(Eigen::Vector3d(nlat, nlon, ALT));

ASSERT_NEAR(heading, M_PI/2, 0.1);
}

TEST(DifferentialGpsTestSuite, TestSouthHeading)
{
Glider::Geodetics::DifferentialGpsFromMotion dgps("enu", VEL);

double nlat = 39.942136;
double nlon = -75.19969;
double slat = 39.942041;
double slon = -75.199694;

dgps.setLastGps(Eigen::Vector3d(nlat, nlon, ALT));

double heading = dgps.getHeading(Eigen::Vector3d(slat, slon, ALT));

ASSERT_NEAR(heading, 3*M_PI/2, 0.1);
}

TEST(DifferentialGpsTestSuite, TestEastHeading)
{
Glider::Geodetics::DifferentialGpsFromMotion dgps("enu", VEL);

double wlat = 39.942197;
double wlon = -75.199524;
double elat = 39.942193;
double elon = -75.199374;

dgps.setLastGps(Eigen::Vector3d(wlat, wlon, ALT));

double heading = dgps.getHeading(Eigen::Vector3d(elat, elon, ALT));

ASSERT_NEAR(heading, 2*M_PI, 0.1);
}

TEST(DifferentialGpsTestSuite, TestWestHeading)
{
Glider::Geodetics::DifferentialGpsFromMotion dgps("enu", VEL);

double wlat = 39.942197;
double wlon = -75.199524;
double elat = 39.942193;
double elon = -75.199374;

dgps.setLastGps(Eigen::Vector3d(elat, elon, ALT));

double heading = dgps.getHeading(Eigen::Vector3d(wlat, wlon, ALT));

ASSERT_NEAR(heading, M_PI, 0.1);
}

TEST(DifferentialGpsTestSuite, TestVelocityThreshold)
{
Glider::Geodetics::DifferentialGpsFromMotion dgps("enu", VEL);

ASSERT_EQ(VEL, dgps.getVelocityThreshold());

ASSERT_TRUE(dgps.isIntegratable(Eigen::Vector3d(2.0, 0.0, 0.0)));
ASSERT_FALSE(dgps.isIntegratable(Eigen::Vector3d(0.5, 0.0, 0.0)));
}