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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- gar : fix missing move assignment operator in `LqrProblemTpl`
- Fix C++20 support. Fix `consteval` compilation errors related to fmt

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ struct AngularAccelerationResidualTpl : StageFunctionTpl<_Scalar> {
, force_size_(force_size) {
if (contact_map.size_ != nk_) {
ALIGATOR_DOMAIN_ERROR(
fmt::format("Contact ids and nk should be the same: now "
"({} and {}).",
contact_map.size_, nk_));
"Contact ids and nk should be the same ({:d} and {:d}).",
contact_map.size_, nk_);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ struct CentroidalAccelerationResidualTpl : StageFunctionTpl<_Scalar> {
, force_size_(force_size) {
if (contact_map.size_ != nk_) {
ALIGATOR_DOMAIN_ERROR(
fmt::format("Contact ids and nk should be the same: now "
"({} and {}).",
contact_map.size_, nk_));
"Contact ids and nk should be the same ({:d} and {:d}).",
contact_map.size_, nk_);
}
}

Expand Down
6 changes: 3 additions & 3 deletions include/aligator/modelling/contact-map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ template <typename _Scalar> struct ContactMapTpl {
, contact_poses_(contact_poses) {
if (contact_states.size() != contact_poses.size()) {
ALIGATOR_DOMAIN_ERROR(
fmt::format("contact_states and contact_poses should have same size, "
"currently ({} and {}).",
contact_states.size(), contact_poses.size()));
"Contact_states and contact_poses should have same size, "
"currently ({:d} and {:d}).",
contact_states.size(), contact_poses.size());
}
size_ = contact_states_.size();
}
Expand Down
9 changes: 3 additions & 6 deletions include/aligator/modelling/costs/sum-of-costs.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,16 @@ CostStackTpl<Scalar>::CostStackTpl(xyz::polymorphic<Manifold> space,
const std::vector<Scalar> &weights)
: CostBase(space, nu) {
if (comps.size() != weights.size()) {
auto msg = fmt::format(
ALIGATOR_RUNTIME_ERROR(
"Inconsistent number of components ({:d}) and weights ({:d}).",
comps.size(), weights.size());
ALIGATOR_RUNTIME_ERROR(msg);
} else {
for (std::size_t i = 0; i < comps.size(); i++) {
if (!this->checkDimension(*comps[i])) {
auto msg = fmt::format("Component #{:d} has wrong input dimensions "
"({:d}, {:d}) (expected "
"({:d}, {:d}))",
ALIGATOR_RUNTIME_ERROR("Component #{:d} has wrong input dimensions "
"({:d}, {:d}) (expected ({:d}, {:d}))",
i, comps[i]->ndx(), comps[i]->nu, this->ndx(),
this->nu);
ALIGATOR_RUNTIME_ERROR(msg);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ MultibodyConstraintFwdDynamicsTpl<Scalar>::MultibodyConstraintFwdDynamicsTpl(
const int nv = state.getModel().nv;
if (nv != actuation.rows()) {
ALIGATOR_DOMAIN_ERROR(
fmt::format("actuation matrix should have number of rows = pinocchio "
"model nv ({} and {}).",
actuation.rows(), nv));
"Actuation matrix should have number of rows = pinocchio "
"model nv ({} and {}).",
actuation.rows(), nv);
}
}

Expand Down
6 changes: 3 additions & 3 deletions include/aligator/modelling/dynamics/multibody-free-fwd.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ MultibodyFreeFwdDynamicsTpl<Scalar>::MultibodyFreeFwdDynamicsTpl(
const int nv = space().getModel().nv;
if (nv != actuation.rows()) {
ALIGATOR_DOMAIN_ERROR(
fmt::format("actuation matrix should have number of rows = pinocchio "
"model nv ({} and {}).",
actuation.rows(), nv));
"Actuation matrix should have number of rows = pinocchio "
"model nv ({} and {}).",
actuation.rows(), nv);
}
act_matrix_rank = lu_decomp_.rank();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ CentroidalMomentumDerivativeResidualTpl<Scalar>::
mass_ = pinocchio::computeTotalMass(model);
if (contact_ids_.size() != contact_states_.size()) {
ALIGATOR_DOMAIN_ERROR(
fmt::format("contact_ids and contact_states should have same size: "
"now ({} and {}).",
contact_ids_.size(), contact_states_.size()));
"contact_ids and contact_states should have same size ({:d} and {:d}).",
contact_ids_.size(), contact_states_.size());
}
}

Expand Down
7 changes: 3 additions & 4 deletions include/aligator/modelling/multibody/contact-force.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ struct ContactForceResidualTpl : StageFunctionTpl<_Scalar> {
, fref_(fref)
, force_size_(fref.size()) {
if (model.nv != actuation.rows()) {
ALIGATOR_DOMAIN_ERROR(
fmt::format("actuation matrix should have number of rows = pinocchio "
"model nv ({} and {}).",
actuation.rows(), model.nv));
ALIGATOR_DOMAIN_ERROR("Actuation matrix should have number of rows = "
"model.nv ({:d} and {:d}).",
actuation.rows(), model.nv);
}
contact_id_ = -1;
for (std::size_t i = 0; i < constraint_models.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ struct MultibodyFrictionConeResidualTpl : StageFunctionTpl<_Scalar> {
, prox_settings_(prox_settings)
, mu_(mu) {
if (model.nv != actuation.rows()) {
ALIGATOR_DOMAIN_ERROR(
fmt::format("actuation matrix should have number of rows = pinocchio "
"model nv ({} and {}).",
actuation.rows(), model.nv));
ALIGATOR_DOMAIN_ERROR("Actuation matrix should have number of rows = "
"model.nv ({:d} and {:d}).",
actuation.rows(), model.nv);
}
contact_id_ = -1;
for (std::size_t i = 0; i < constraint_models.size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ struct MultibodyWrenchConeResidualTpl : StageFunctionTpl<_Scalar> {
, hL_(half_length)
, hW_(half_width) {
if (model.nv != actuation.rows()) {
ALIGATOR_DOMAIN_ERROR(
fmt::format("actuation matrix should have number of rows = pinocchio "
"model nv ({} and {}).",
actuation.rows(), model.nv));
ALIGATOR_DOMAIN_ERROR("Actuation matrix should have number of rows = "
"model.nv ({:d} and {:d}).",
actuation.rows(), model.nv);
}
contact_id_ = -1;
for (std::size_t i = 0; i < constraint_models.size(); i++) {
Expand Down
15 changes: 9 additions & 6 deletions src/utils/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ void Logger::finish(bool conv) {
if (!active)
return;

auto ts = fmt::fg(conv ? fmt::color::dodger_blue : fmt::color::red);
const char *msg = conv ? "Successfully converged." : "Convergence failure.";
fmt::print(ts, msg);
fmt::print("\n");
fmt::text_style ts =
fmt::fg(conv ? fmt::color::dodger_blue : fmt::color::red);
if (conv) {
fmt::print(ts, "Successfully converged\n");
} else {
fmt::print(ts, "Convergence failure\n");
}
}

void Logger::addColumn(std::string_view name, uint width,
Expand All @@ -55,12 +58,12 @@ void Logger::addColumn(std::string_view name, uint width,

void Logger::addEntry(std::string_view name, double val) {
const auto spec = m_colSpecs[name];
m_currentLine[name] = fmt::format(spec.second, val, spec.first);
m_currentLine[name] = fmt::format(fmt::runtime(spec.second), val, spec.first);
}

void Logger::addEntry(std::string_view name, size_t val) {
const auto spec = m_colSpecs[name];
m_currentLine[name] = fmt::format(spec.second, val, spec.first);
m_currentLine[name] = fmt::format(fmt::runtime(spec.second), val, spec.first);
}

} // namespace aligator
Loading