Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
Remove TrajoptUtilTest cases
Browse files Browse the repository at this point in the history
  • Loading branch information
shueja committed Jun 22, 2024
1 parent d51c071 commit a30fe94
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions test/src/SwerveTrajoptUtilTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,46 +52,3 @@ TEST_CASE("SwerveTrajoptUtil - SolveNetTorque()", "[SwerveTrajoptUtil]") {

CHECK(tau_net.Value() == Catch::Approx(0.6553658).margin(1e-3));
}

TEST_CASE("SwerveTrajoptUtil - ApplyKinematicsConstraints()",
"[SwerveTrajoptUtil]") {
TestOpti opti;
// 0 0 1 0 1 2 3
std::vector<double> x{1.0, -1.0, 9.0, -19.0, 33.0, 101.0, 41.0};
std::vector<double> v{1.0, -1.0, 5.0, -7.0, 13.0, 17.0, -15.0};
std::vector<double> a{1.0, -1.0, 3.0, -3.0, 5.0, 1.0, -8.0};
// dt{ 2.0, 2.0, 4.0, 4.0, 4.0, 4.0}
std::vector<double> dt{2.0, 4.0};
std::vector<size_t> N{2, 4};

std::vector<double> xcos;
xcos.reserve(x.size());
std::transform(x.cbegin(), x.cend(), std::back_inserter(xcos),
std::cos<double>);
std::vector<double> xsin;
xsin.reserve(x.size());
std::transform(x.cbegin(), x.cend(), std::back_inserter(xsin),
std::sin<double>);
trajopt::ApplyKinematicsConstraints(opti, x, x, xcos, xsin, v, v, v, a, a, a,
dt, N);

CHECK_FALSE(opti.IsViolating());
}

TEST_CASE("SwerveTrajoptUtil - ApplyDynamicsConstraints()",
"[SwerveTrajoptUtil]") {
TestOpti opti;
constexpr double ax = 1.0;
constexpr double ay = -2.0;
constexpr double alpha = 9.0;
constexpr double Fx_net = 45.0;
constexpr double Fy_net = -90.0;
constexpr double tau_net = 54.0;
constexpr double mass = 45.0;
constexpr double moi = 6.0;

trajopt::ApplyDynamicsConstraints(opti, ax, ay, alpha, Fx_net, Fy_net,
tau_net, mass, moi);

CHECK_FALSE(opti.IsViolating());
}

0 comments on commit a30fe94

Please sign in to comment.