From 18e3d7583696331b5304dbd16efe717d12da8244 Mon Sep 17 00:00:00 2001 From: ManifoldFR Date: Thu, 13 Nov 2025 16:14:31 +0100 Subject: [PATCH 1/2] core/traj-opt-problem : have `replaceStageCircular()` return ejected knot + bring behaviour closer to FIFO-style queue --- include/aligator/core/traj-opt-problem.hpp | 8 +++++--- include/aligator/core/traj-opt-problem.hxx | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/aligator/core/traj-opt-problem.hpp b/include/aligator/core/traj-opt-problem.hpp index ccd3304d7..ef33a2cba 100644 --- a/include/aligator/core/traj-opt-problem.hpp +++ b/include/aligator/core/traj-opt-problem.hpp @@ -210,9 +210,11 @@ template struct TrajOptProblemTpl { std::size_t num_threads = 1, bool compute_second_order = true) const; - /// @brief Pop out the first StageModel and replace by the supplied one; - /// updates the supplied problem data (TrajOptDataTpl) object. - void replaceStageCircular(const xyz::polymorphic &model); + /// @brief Advance each stage model by one slot after inserting a new stage, + /// pop out the first model. + /// @returns The first StageModel. + xyz::polymorphic + replaceStageCircular(const xyz::polymorphic &model); bool checkIntegrity() const; diff --git a/include/aligator/core/traj-opt-problem.hxx b/include/aligator/core/traj-opt-problem.hxx index 942637551..a57c9ecb3 100644 --- a/include/aligator/core/traj-opt-problem.hxx +++ b/include/aligator/core/traj-opt-problem.hxx @@ -164,11 +164,13 @@ inline std::size_t TrajOptProblemTpl::numSteps() const { } template -void TrajOptProblemTpl::replaceStageCircular( - const xyz::polymorphic &model) { +auto TrajOptProblemTpl::replaceStageCircular( + const xyz::polymorphic &model) -> xyz::polymorphic { addStage(model); rotate_vec_left(stages_); + auto last = std::move(stages_.back()); stages_.pop_back(); + return last; } template From a76d81e7cdcd7a0357b0537ac85a87b29557f6d7 Mon Sep 17 00:00:00 2001 From: ManifoldFR Date: Thu, 13 Nov 2025 16:15:59 +0100 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c39099863..b95a1e7ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- core : have `replaceStageCircular()` return ejected knot (https://github.com/Simple-Robotics/aligator/pull/376) - python : do not import utils.plotting automatically (https://github.com/Simple-Robotics/aligator/pull/369) - ci: display ccache statistics (https://github.com/Simple-Robotics/aligator/pull/369) - pixi: update environments (https://github.com/Simple-Robotics/aligator/pull/369)