Skip to content

Commit

Permalink
Remove TODO comment from OCPSolver tests (#615)
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul authored Jul 27, 2024
1 parent 8817f89 commit 5e67d8e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
16 changes: 8 additions & 8 deletions include/sleipnir/control/OCPSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,21 +308,21 @@ class SLEIPNIR_DLLEXPORT OCPSolver : public OptimizationProblem {
}

/**
* Convenience function to set an upper bound on the timestep.
* Convenience function to set a lower bound on the timestep.
*
* @param maxTimestep The maximum timestep.
* @param minTimestep The minimum timestep.
*/
void SetMaxTimestep(std::chrono::duration<double> maxTimestep) {
SubjectTo(DT() <= maxTimestep.count());
void SetMinTimestep(std::chrono::duration<double> minTimestep) {
SubjectTo(DT() >= minTimestep.count());
}

/**
* Convenience function to set a lower bound on the timestep.
* Convenience function to set an upper bound on the timestep.
*
* @param minTimestep The minimum timestep.
* @param maxTimestep The maximum timestep.
*/
void SetMinTimestep(std::chrono::duration<double> minTimestep) {
SubjectTo(DT() >= minTimestep.count());
void SetMaxTimestep(std::chrono::duration<double> maxTimestep) {
SubjectTo(DT() <= maxTimestep.count());
}

/**
Expand Down
4 changes: 2 additions & 2 deletions jormungandr/cpp/control/BindOCPSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ void BindOCPSolver(nb::enum_<TranscriptionMethod>& transcription_method,
&OCPSolver::SetUpperInputBound<VariableMatrix>, "upper_bound"_a,
DOC(sleipnir, OCPSolver, SetUpperInputBound));

cls.def("set_max_timestep", &OCPSolver::SetMaxTimestep, "max_timestep"_a,
DOC(sleipnir, OCPSolver, SetMaxTimestep));
cls.def("set_min_timestep", &OCPSolver::SetMinTimestep, "min_timestep"_a,
DOC(sleipnir, OCPSolver, SetMinTimestep));
cls.def("set_max_timestep", &OCPSolver::SetMaxTimestep, "max_timestep"_a,
DOC(sleipnir, OCPSolver, SetMaxTimestep));

cls.def("X", &OCPSolver::X, DOC(sleipnir, OCPSolver, X));
cls.def("U", &OCPSolver::U, DOC(sleipnir, OCPSolver, U));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ def test_ocp_solver_differential_drive():
problem.set_lower_input_bound(u_min)
problem.set_upper_input_bound(u_max)

# TODO: Solver is unhappy when more than one minimum timestep is constrained.
# Detect this in either OptimizationProblem or OCPSolver.
problem.set_min_timestep(min_timestep)
problem.set_max_timestep(3.0)

Expand Down
2 changes: 0 additions & 2 deletions test/src/control/OCPSolverTest_DifferentialDrive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ TEST_CASE("OCPSolver - Differential drive", "[OCPSolver]") {
problem.SetLowerInputBound(u_min);
problem.SetUpperInputBound(u_max);

// TODO: Solver is unhappy when more than one minimum timestep is constrained.
// Detect this in either OptimizationProblem or OCPSolver.
problem.SetMinTimestep(minTimestep);
problem.SetMaxTimestep(3s);

Expand Down

0 comments on commit 5e67d8e

Please sign in to comment.