Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cicd] upgrade format tool for support #319

Merged
merged 1 commit into from
May 6, 2023
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
5 changes: 4 additions & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ jobs:
- name: "Install"
run: |
pip install cmakelang
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 16 all
- name: "Test"
run: |
find . -iname "*.hpp" -o -iname "*.tpp" -o -iname "*.cpp" -o -iwholename "./support/format" | xargs \
clang-format-14 --Werror --dry-run --verbose -style=file
clang-format-16 --Werror --dry-run --verbose -style=file
cmake-format --check CMakeLists.txt
33 changes: 18 additions & 15 deletions include/fcarouge/internal/kalman.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,16 @@ template <typename State, typename Output, typename Input, typename UpdateTypes,
"discarded.")]] inline constexpr auto
kalman<State, Output, Input, UpdateTypes, PredictionTypes>::u() const
-> const input &requires(not std::is_same_v<Input, void>) {
return filter.u;
}
return filter.u;
}

template <typename State, typename Output, typename Input, typename UpdateTypes,
typename PredictionTypes>
[[nodiscard("The returned estimated covariance matrix P is unexpectedly "
"discarded.")]] inline constexpr auto
kalman<State, Output, Input, UpdateTypes, PredictionTypes>::p() const
-> const estimate_uncertainty & {
"discarded.")]] inline constexpr auto kalman<State, Output, Input,
UpdateTypes,
PredictionTypes>::p()
const -> const estimate_uncertainty & {
return filter.p;
}

Expand Down Expand Up @@ -244,24 +245,26 @@ template <typename State, typename Output, typename Input, typename UpdateTypes,
"discarded.")]] inline constexpr auto
kalman<State, Output, Input, UpdateTypes, PredictionTypes>::g() const
-> const input_control &requires(not std::is_same_v<Input, void>) {
return filter.g;
}
return filter.g;
}

template <typename State, typename Output, typename Input, typename UpdateTypes,
typename PredictionTypes>
[[nodiscard("The returned control transition matrix G is unexpectedly "
"discarded.")]] inline constexpr auto
kalman<State, Output, Input, UpdateTypes, PredictionTypes>::g()
"discarded.")]] inline constexpr auto kalman<State, Output, Input,
UpdateTypes,
PredictionTypes>::g()
-> input_control &requires(not std::is_same_v<Input, void>) {
return filter.g;
}
return filter.g;
}

template <typename State, typename Output, typename Input, typename UpdateTypes,
typename PredictionTypes>
inline constexpr void
kalman<State, Output, Input, UpdateTypes, PredictionTypes>::g(
const auto &value,
const auto &...values) requires(not std::is_same_v<Input, void>) {
inline constexpr void kalman<State, Output, Input, UpdateTypes,
PredictionTypes>::g(const auto &value,
const auto &...values)
requires(not std::is_same_v<Input, void>)
{
if constexpr (std::is_convertible_v<decltype(value), input_control>) {
filter.g = std::move(input_control{value, values...});
} else {
Expand Down
14 changes: 7 additions & 7 deletions include/fcarouge/internal/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ template <typename Type>
concept algebraic = not arithmetic<Type>;

template <typename Type>
concept eigen = requires {
typename Type::PlainMatrix;
};
concept eigen = requires { typename Type::PlainMatrix; };

struct empty {
inline constexpr explicit empty([[maybe_unused]] auto &&...any) noexcept {
Expand All @@ -65,7 +63,9 @@ template <typename...> struct pack {};

using empty_pack = pack<>;

template <typename Type> struct repack { using type = Type; };
template <typename Type> struct repack {
using type = Type;
};

template <template <typename...> typename From, typename... Types>
struct repack<From<Types...>> {
Expand Down Expand Up @@ -94,7 +94,7 @@ template <arithmetic Arithmetic>
inline constexpr Arithmetic identity_v<Arithmetic>{1};

template <typename Matrix>
requires requires(Matrix value) { value.Identity(); }
requires requires(Matrix value) { value.Identity(); }
inline const auto identity_v<Matrix>{Matrix::Identity()};

template <typename Type>
Expand All @@ -106,7 +106,7 @@ template <arithmetic Arithmetic>
inline constexpr Arithmetic zero_v<Arithmetic>{0};

template <typename Matrix>
requires requires(Matrix value) { value.Zero(); }
requires requires(Matrix value) { value.Zero(); }
inline const auto zero_v<Matrix>{Matrix::Zero()};

struct transpose final {
Expand All @@ -117,7 +117,7 @@ struct transpose final {
}

template <typename Matrix>
requires requires(Matrix value) { value.transpose(); }
requires requires(Matrix value) { value.transpose(); }
[[nodiscard]] inline constexpr auto operator()(const Matrix &value) const {
return value.transpose();
}
Expand Down
5 changes: 2 additions & 3 deletions include/fcarouge/kalman.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,8 @@ class kalman final {
//! control transition matrix G.
//!
//! @complexity Constant.
inline constexpr void
g(const auto &value,
const auto &...values) requires(not std::is_same_v<Input, void>);
inline constexpr void g(const auto &value, const auto &...values)
requires(not std::is_same_v<Input, void>);

//! @brief Returns the gain matrix K.
//!
Expand Down