diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 733a842865802..f8273cebdd578 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -94,4 +94,4 @@ repos:
args: [--quiet]
exclude: .cu
-exclude: .svg|control/trajectory_follower|control/trajectory_follower_nodes|common/autoware_auto_cmake|common/autoware_auto_common|common/autoware_auto_geometry|common/autoware_auto_tf2|common/autoware_testing|common/fake_test_node|common/had_map_utils|common/motion_common|common/motion_testing|common/time_utils|common/vehicle_constants_manager|common/autoware_auto_perception_rviz_plugin|common/osqp_interface|simulator/simple_planning_simulator|planning/freespace_planner|planning/astar_search|planning/costmap_generator
+exclude: .svg
diff --git a/common/autoware_auto_cmake/design/autoware_auto_cmake-design.md b/common/autoware_auto_cmake/design/autoware_auto_cmake-design.md
index 62c82d6dd7db2..8946a02f8d951 100644
--- a/common/autoware_auto_cmake/design/autoware_auto_cmake-design.md
+++ b/common/autoware_auto_cmake/design/autoware_auto_cmake-design.md
@@ -1,10 +1,8 @@
-autoware_auto_cmake {#autoware-auto-cmake-design}
-===========
+# autoware_auto_cmake {#autoware-auto-cmake-design}
This is the design document for the `autoware_auto_cmake` package.
-
-# Purpose
+## Purpose
Provide common CMake variables and functions to Autoware packages.
@@ -13,17 +11,17 @@ Those include:
- Setting the language standard
- Getting user-provided variables
- Providing functions to:
- + set compiler flags
- + turn off optimizations
+ - set compiler flags
+ - turn off optimizations
-# Design
+## Design
-## Usage
+### Usage
Add `autoware_auto_cmake` as a "build_depend" in the dependent packages.
-### CMake variables {#cmake-config-variables}
+#### CMake variables {#cmake-config-variables}
-|Name|Type|Descritpion|Default|
-|----|----|-----------|-------|
-|`DOWNLOAD_ARTIFACTS`|*BOOL*|Allow downloading artifacts at build time.|`OFF`|
+| Name | Type | Descritpion | Default |
+| -------------------- | ------ | ------------------------------------------ | ------- |
+| `DOWNLOAD_ARTIFACTS` | _BOOL_ | Allow downloading artifacts at build time. | `OFF` |
diff --git a/common/autoware_auto_cmake/package.xml b/common/autoware_auto_cmake/package.xml
index 6d8163eae6018..6c3df541c4095 100644
--- a/common/autoware_auto_cmake/package.xml
+++ b/common/autoware_auto_cmake/package.xml
@@ -12,11 +12,11 @@
ros_environment
- ament_cmake_core
- ament_cmake_lint_cmake
ament_cmake_copyright
+ ament_cmake_core
ament_cmake_cppcheck
ament_cmake_cpplint
+ ament_cmake_lint_cmake
ament_cmake_uncrustify
ament_cmake_lint_cmake
diff --git a/common/autoware_auto_common/CMakeLists.txt b/common/autoware_auto_common/CMakeLists.txt
index 45284843f5644..54407c7a0facf 100644
--- a/common/autoware_auto_common/CMakeLists.txt
+++ b/common/autoware_auto_common/CMakeLists.txt
@@ -32,7 +32,6 @@ if(BUILD_TESTING)
# Temporarily disable cpplint and uncrustify
list(APPEND AMENT_LINT_AUTO_EXCLUDE
ament_cmake_cpplint
- ament_cmake_uncrustify
)
ament_lint_auto_find_test_dependencies()
@@ -46,10 +45,6 @@ if(BUILD_TESTING)
find_package(ament_cmake_cpplint)
ament_cpplint(${FILES_MINUS_SOME})
- # Re-enable uncrustify
- find_package(ament_cmake_uncrustify)
- ament_uncrustify(${FILES_MINUS_SOME})
-
# Unit tests
set(TEST_COMMON test_common_gtest)
ament_add_gtest(${TEST_COMMON}
diff --git a/common/autoware_auto_common/design/comparisons.md b/common/autoware_auto_common/design/comparisons.md
index 6e1d2eb9db35e..d8c1ef6de17e8 100644
--- a/common/autoware_auto_common/design/comparisons.md
+++ b/common/autoware_auto_common/design/comparisons.md
@@ -1,5 +1,4 @@
-Comparisons {#helper-comparisons}
-===========
+# Comparisons {#helper-comparisons}
The `float_comparisons.hpp` library is a simple set of functions for performing approximate numerical comparisons.
There are separate functions for performing comparisons using absolute bounds and relative bounds. Absolute comparison checks are prefixed with `abs_` and relative checks are prefixed with `rel_`.
@@ -8,19 +7,19 @@ The `bool_comparisons.hpp` library additionally contains an XOR operator.
The intent of the library is to improve readability of code and reduce likelihood of typographical errors when using numerical and boolean comparisons.
-# Target use cases
+## Target use cases
The approximate comparisons are intended to be used to check whether two numbers lie within some absolute or relative interval.
The `exclusive_or` function will test whether two values cast to different boolean values.
-# Assumptions
+## Assumptions
-* The approximate comparisons all take an `epsilon` parameter.
-The value of this parameter must be >= 0.
-* The library is only intended to be used with floating point types.
-A static assertion will be thrown if the library is used with a non-floating point type.
+- The approximate comparisons all take an `epsilon` parameter.
+ The value of this parameter must be >= 0.
+- The library is only intended to be used with floating point types.
+ A static assertion will be thrown if the library is used with a non-floating point type.
-# Example Usage
+## Example Usage
```c++
#include "common/bool_comparisons.hpp"
diff --git a/common/autoware_auto_common/include/common/type_traits.hpp b/common/autoware_auto_common/include/common/type_traits.hpp
index ed0ab1709d92c..44dfe92681017 100644
--- a/common/autoware_auto_common/include/common/type_traits.hpp
+++ b/common/autoware_auto_common/include/common/type_traits.hpp
@@ -41,28 +41,32 @@ namespace type_traits
///
/// @return A boolean that should be false for any type passed into this function.
///
-template
+template
constexpr inline autoware::common::types::bool8_t COMMON_PUBLIC impossible_branch() noexcept
{
return sizeof(T) == 0;
}
/// Find an index of a type in a tuple
-template
+template
struct COMMON_PUBLIC index
{
static_assert(!std::is_same>::value, "Could not find QueryT in given tuple");
};
/// Specialization for a tuple that starts with the HeadT type. End of recursion.
-template
+template
struct COMMON_PUBLIC index>
- : std::integral_constant {};
+: std::integral_constant
+{
+};
/// Specialization for a tuple with a type different to QueryT that calls the recursive step.
-template
+template
struct COMMON_PUBLIC index>
- : std::integral_constant>::value> {};
+: std::integral_constant>::value>
+{
+};
///
/// @brief Visit every element in a tuple.
@@ -75,13 +79,17 @@ struct COMMON_PUBLIC index>
///
/// @return Does not return anything. Capture variables in a lambda to return any values.
///
-template
-COMMON_PUBLIC inline constexpr typename std::enable_if_t
-visit(std::tuple &, Callable) noexcept {}
+template
+COMMON_PUBLIC inline constexpr typename std::enable_if_t visit(
+ std::tuple &, Callable) noexcept
+{
+}
/// @brief Same as the previous specialization but for const tuple.
-template
-COMMON_PUBLIC inline constexpr typename std::enable_if_t
-visit(const std::tuple &, Callable) noexcept {}
+template
+COMMON_PUBLIC inline constexpr typename std::enable_if_t visit(
+ const std::tuple &, Callable) noexcept
+{
+}
///
/// @brief Visit every element in a tuple.
@@ -98,32 +106,37 @@ visit(const std::tuple &, Callable) noexcept {}
///
/// @return Does not return anything. Capture variables in a lambda to return any values.
///
-template
-COMMON_PUBLIC inline constexpr typename std::enable_if_t
-visit(std::tuple & tuple, Callable callable) noexcept
+template
+COMMON_PUBLIC inline constexpr typename std::enable_if_t visit(
+ std::tuple & tuple, Callable callable) noexcept
{
callable(std::get(tuple));
visit(tuple, callable);
}
/// @brief Same as the previous specialization but for const tuple.
-template
-COMMON_PUBLIC inline constexpr typename std::enable_if_t
-visit(const std::tuple & tuple, Callable callable) noexcept
+template
+COMMON_PUBLIC inline constexpr typename std::enable_if_t visit(
+ const std::tuple & tuple, Callable callable) noexcept
{
callable(std::get(tuple));
visit(tuple, callable);
}
/// @brief A class to compute a conjunction over given traits.
-template
-struct COMMON_PUBLIC conjunction : std::true_type {};
+template
+struct COMMON_PUBLIC conjunction : std::true_type
+{
+};
/// @brief A conjunction of another type shall derive from that type.
-template
-struct COMMON_PUBLIC conjunction: TraitT {};
-template
+template
+struct COMMON_PUBLIC conjunction : TraitT
+{
+};
+template
struct COMMON_PUBLIC conjunction
- : std::conditional_t(TraitT::value), conjunction, TraitT> {};
-
+: std::conditional_t(TraitT::value), conjunction, TraitT>
+{
+};
///
/// @brief A trait to check if a tuple has a type.
@@ -133,7 +146,7 @@ struct COMMON_PUBLIC conjunction
/// @tparam QueryT A query type.
/// @tparam TupleT A tuple to search the type in.
///
-template
+template
struct has_type;
///
@@ -142,8 +155,10 @@ struct has_type;
///
/// @tparam QueryT Any type.
///
-template
-struct has_type>: std::false_type {};
+template
+struct has_type> : std::false_type
+{
+};
///
/// @brief Recursive override of the main trait.
@@ -152,8 +167,10 @@ struct has_type>: std::false_type {};
/// @tparam HeadT Head type in the tuple.
/// @tparam TailTs Rest of the tuple types.
///
-template
-struct has_type>: has_type> {};
+template
+struct has_type> : has_type>
+{
+};
///
/// @brief End of recursion for the main `has_type` trait. Becomes a `true_type` when the first
@@ -162,9 +179,10 @@ struct has_type>: has_type
-struct has_type>: std::true_type {};
-
+template
+struct has_type> : std::true_type
+{
+};
///
/// @brief A trait used to intersect types stored in tuples at compile time. The resulting
@@ -176,7 +194,7 @@ struct has_type>: std::true_type {};
/// @tparam TupleT1 Tuple 1
/// @tparam TupleT2 Tuple 2
///
-template
+template
struct intersect
{
///
@@ -185,18 +203,16 @@ struct intersect
/// @details This function "iterates" over the types in TupleT1 and checks if those are in
/// TupleT2. If this is true, these types are concatenated into a new tuple.
///
- template
+ template
static constexpr auto make_intersection(std::index_sequence)
{
- return std::tuple_cat(
- std::conditional_t<
- has_type, TupleT2>::value,
- std::tuple>,
- std::tuple<>>{} ...);
+ return std::tuple_cat(std::conditional_t<
+ has_type, TupleT2>::value,
+ std::tuple>, std::tuple<>>{}...);
}
/// The resulting tuple type.
using type =
- decltype(make_intersection(std::make_index_sequence::value> {}));
+ decltype(make_intersection(std::make_index_sequence::value>{}));
};
} // namespace type_traits
diff --git a/common/autoware_auto_common/include/common/types.hpp b/common/autoware_auto_common/include/common/types.hpp
index f3d49fcea04ff..5c77449e30ff5 100644
--- a/common/autoware_auto_common/include/common/types.hpp
+++ b/common/autoware_auto_common/include/common/types.hpp
@@ -19,12 +19,12 @@
#ifndef COMMON__TYPES_HPP_
#define COMMON__TYPES_HPP_
+#include "common/visibility_control.hpp"
+#include "helper_functions/float_comparisons.hpp"
+
#include
-#include
#include
-
-#include "helper_functions/float_comparisons.hpp"
-#include "common/visibility_control.hpp"
+#include
namespace autoware
{
@@ -61,16 +61,12 @@ struct COMMON_PUBLIC PointXYZIF
float32_t intensity{0};
uint16_t id{0};
static constexpr uint16_t END_OF_SCAN_ID = 65535u;
- friend bool operator==(
- const PointXYZIF & p1,
- const PointXYZIF & p2) noexcept
+ friend bool operator==(const PointXYZIF & p1, const PointXYZIF & p2) noexcept
{
using autoware::common::helper_functions::comparisons::rel_eq;
const auto epsilon = std::numeric_limits::epsilon();
- return rel_eq(p1.x, p2.x, epsilon) &&
- rel_eq(p1.y, p2.y, epsilon) &&
- rel_eq(p1.z, p2.z, epsilon) &&
- rel_eq(p1.intensity, p2.intensity, epsilon) &&
+ return rel_eq(p1.x, p2.x, epsilon) && rel_eq(p1.y, p2.y, epsilon) &&
+ rel_eq(p1.z, p2.z, epsilon) && rel_eq(p1.intensity, p2.intensity, epsilon) &&
(p1.id == p2.id);
}
};
@@ -82,16 +78,12 @@ struct COMMON_PUBLIC PointXYZF
float32_t z{0};
uint16_t id{0};
static constexpr uint16_t END_OF_SCAN_ID = 65535u;
- friend bool operator==(
- const PointXYZF & p1,
- const PointXYZF & p2) noexcept
+ friend bool operator==(const PointXYZF & p1, const PointXYZF & p2) noexcept
{
using autoware::common::helper_functions::comparisons::rel_eq;
const auto epsilon = std::numeric_limits::epsilon();
- return rel_eq(p1.x, p2.x, epsilon) &&
- rel_eq(p1.y, p2.y, epsilon) &&
- rel_eq(p1.z, p2.z, epsilon) &&
- (p1.id == p2.id);
+ return rel_eq(p1.x, p2.x, epsilon) && rel_eq(p1.y, p2.y, epsilon) &&
+ rel_eq(p1.z, p2.z, epsilon) && (p1.id == p2.id);
}
};
@@ -101,22 +93,19 @@ struct COMMON_PUBLIC PointXYZI
float32_t y{0.0F};
float32_t z{0.0F};
float32_t intensity{0.0F};
- friend bool operator==(
- const PointXYZI & p1,
- const PointXYZI & p2) noexcept
+ friend bool operator==(const PointXYZI & p1, const PointXYZI & p2) noexcept
{
- return
- helper_functions::comparisons::rel_eq(
- p1.x, p2.x, std::numeric_limits::epsilon()) &&
+ return helper_functions::comparisons::rel_eq(
+ p1.x, p2.x, std::numeric_limits::epsilon()) &&
- helper_functions::comparisons::rel_eq(
- p1.y, p2.y, std::numeric_limits::epsilon()) &&
+ helper_functions::comparisons::rel_eq(
+ p1.y, p2.y, std::numeric_limits::epsilon()) &&
- helper_functions::comparisons::rel_eq(
- p1.z, p2.z, std::numeric_limits::epsilon()) &&
+ helper_functions::comparisons::rel_eq(
+ p1.z, p2.z, std::numeric_limits::epsilon()) &&
- helper_functions::comparisons::rel_eq(
- p1.intensity, p2.intensity, std::numeric_limits::epsilon());
+ helper_functions::comparisons::rel_eq(
+ p1.intensity, p2.intensity, std::numeric_limits::epsilon());
}
};
@@ -127,7 +116,7 @@ static constexpr uint16_t POINT_BLOCK_CAPACITY = 512U;
// TODO(yunus.caliskan): switch to std::void_t when C++17 is available
/// \brief `std::void_t<> implementation
-template
+template
using void_t = void;
} // namespace types
} // namespace common
diff --git a/common/autoware_auto_common/include/common/visibility_control.hpp b/common/autoware_auto_common/include/common/visibility_control.hpp
index d2d3d89148d03..0a988d6407dfa 100644
--- a/common/autoware_auto_common/include/common/visibility_control.hpp
+++ b/common/autoware_auto_common/include/common/visibility_control.hpp
@@ -18,21 +18,21 @@
#define COMMON__VISIBILITY_CONTROL_HPP_
#if defined(_MSC_VER) && defined(_WIN64)
- #if defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
- #define COMMON_PUBLIC __declspec(dllexport)
- #define COMMON_LOCAL
- #else // defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
- #define COMMON_PUBLIC __declspec(dllimport)
- #define COMMON_LOCAL
- #endif // defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
+#if defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
+#define COMMON_PUBLIC __declspec(dllexport)
+#define COMMON_LOCAL
+#else // defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
+#define COMMON_PUBLIC __declspec(dllimport)
+#define COMMON_LOCAL
+#endif // defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
#elif defined(__GNUC__) && defined(__linux__)
- #define COMMON_PUBLIC __attribute__((visibility("default")))
- #define COMMON_LOCAL __attribute__((visibility("hidden")))
+#define COMMON_PUBLIC __attribute__((visibility("default")))
+#define COMMON_LOCAL __attribute__((visibility("hidden")))
#elif defined(__GNUC__) && defined(__APPLE__)
- #define COMMON_PUBLIC __attribute__((visibility("default")))
- #define COMMON_LOCAL __attribute__((visibility("hidden")))
+#define COMMON_PUBLIC __attribute__((visibility("default")))
+#define COMMON_LOCAL __attribute__((visibility("hidden")))
#else // !(defined(__GNUC__) && defined(__APPLE__))
- #error "Unsupported Build Configuration"
+#error "Unsupported Build Configuration"
#endif // _MSC_VER
#endif // COMMON__VISIBILITY_CONTROL_HPP_
diff --git a/common/autoware_auto_common/include/helper_functions/angle_utils.hpp b/common/autoware_auto_common/include/helper_functions/angle_utils.hpp
index 39ee0bf657748..31a33ef2dab47 100644
--- a/common/autoware_auto_common/include/helper_functions/angle_utils.hpp
+++ b/common/autoware_auto_common/include/helper_functions/angle_utils.hpp
@@ -46,12 +46,16 @@ constexpr auto kDoublePi = 2.0 * M_PI;
///
/// @return Angle wrapped to the chosen range.
///
-template
+template
constexpr T wrap_angle(T angle) noexcept
{
auto help_angle = angle + T(M_PI);
- while (help_angle < T{}) {help_angle += T(detail::kDoublePi);}
- while (help_angle >= T(detail::kDoublePi)) {help_angle -= T(detail::kDoublePi);}
+ while (help_angle < T{}) {
+ help_angle += T(detail::kDoublePi);
+ }
+ while (help_angle >= T(detail::kDoublePi)) {
+ help_angle -= T(detail::kDoublePi);
+ }
return help_angle - T(M_PI);
}
diff --git a/common/autoware_auto_common/include/helper_functions/bool_comparisons.hpp b/common/autoware_auto_common/include/helper_functions/bool_comparisons.hpp
index dda752bf2f2b5..c6bf09365af4f 100644
--- a/common/autoware_auto_common/include/helper_functions/bool_comparisons.hpp
+++ b/common/autoware_auto_common/include/helper_functions/bool_comparisons.hpp
@@ -36,7 +36,7 @@ namespace comparisons
* @brief Convenience method for performing logical exclusive or ops.
* @return True iff exactly one of 'a' and 'b' is true.
*/
-template
+template
types::bool8_t exclusive_or(const T & a, const T & b)
{
return static_cast(a) != static_cast(b);
diff --git a/common/autoware_auto_common/include/helper_functions/byte_reader.hpp b/common/autoware_auto_common/include/helper_functions/byte_reader.hpp
index aa05e5c6a7be4..bef27ea310e26 100644
--- a/common/autoware_auto_common/include/helper_functions/byte_reader.hpp
+++ b/common/autoware_auto_common/include/helper_functions/byte_reader.hpp
@@ -40,14 +40,13 @@ class ByteReader
/// \brief Default constructor, byte reader class
/// \param[in] byte_vector A vector to read bytes from
explicit ByteReader(const std::vector & byte_vector)
- : byte_vector_(byte_vector),
- index_(0U)
+ : byte_vector_(byte_vector), index_(0U)
{
}
// brief Read bytes and store it in the argument passed in big-endian order
/// \param[inout] value Read and store the bytes from the vector matching the size of the argument
- template
+ template
void read(T & value)
{
constexpr std::size_t kTypeSize = sizeof(T);
@@ -65,10 +64,7 @@ class ByteReader
index_ += kTypeSize;
}
- void skip(std::size_t count)
- {
- index_ += count;
- }
+ void skip(std::size_t count) { index_ += count; }
};
} // namespace helper_functions
} // namespace common
diff --git a/common/autoware_auto_common/include/helper_functions/crtp.hpp b/common/autoware_auto_common/include/helper_functions/crtp.hpp
index 7cba8d0350829..707d522251dc2 100644
--- a/common/autoware_auto_common/include/helper_functions/crtp.hpp
+++ b/common/autoware_auto_common/include/helper_functions/crtp.hpp
@@ -25,7 +25,7 @@ namespace common
{
namespace helper_functions
{
-template
+template
class crtp
{
protected:
@@ -33,7 +33,7 @@ class crtp
{
// This is the CRTP pattern for static polymorphism: this is related, static_cast is the only
// way to do this
- //lint -e{9005, 9176, 1939} NOLINT
+ // lint -e{9005, 9176, 1939} NOLINT
return *static_cast(this);
}
@@ -41,7 +41,7 @@ class crtp
{
// This is the CRTP pattern for static polymorphism: this is related, static_cast is the only
// way to do this
- //lint -e{9005, 9176, 1939} NOLINT
+ // lint -e{9005, 9176, 1939} NOLINT
return *static_cast(this);
}
};
diff --git a/common/autoware_auto_common/include/helper_functions/float_comparisons.hpp b/common/autoware_auto_common/include/helper_functions/float_comparisons.hpp
index fcf1b90c59cf2..de1f459f21d0a 100644
--- a/common/autoware_auto_common/include/helper_functions/float_comparisons.hpp
+++ b/common/autoware_auto_common/include/helper_functions/float_comparisons.hpp
@@ -39,12 +39,11 @@ namespace comparisons
* @pre eps >= 0
* @return True iff 'a' and 'b' are within 'eps' of each other.
*/
-template
+template
bool abs_eq(const T & a, const T & b, const T & eps)
{
static_assert(
- std::is_floating_point::value,
- "Float comparisons only support floating point types.");
+ std::is_floating_point::value, "Float comparisons only support floating point types.");
return std::abs(a - b) <= eps;
}
@@ -54,7 +53,7 @@ bool abs_eq(const T & a, const T & b, const T & eps)
* @pre eps >= 0
* @return True iff 'a' is less than 'b' minus 'eps'.
*/
-template
+template
bool abs_lt(const T & a, const T & b, const T & eps)
{
return !abs_eq(a, b, eps) && (a < b);
@@ -65,7 +64,7 @@ bool abs_lt(const T & a, const T & b, const T & eps)
* @pre eps >= 0
* @return True iff 'a' is less than or equal to 'b' plus 'eps'.
*/
-template
+template
bool abs_lte(const T & a, const T & b, const T & eps)
{
return abs_eq(a, b, eps) || (a < b);
@@ -76,7 +75,7 @@ bool abs_lte(const T & a, const T & b, const T & eps)
* @pre eps >= 0
* @return True iff 'a' is greater than or equal to 'b' minus 'eps'.
*/
-template
+template
bool abs_gte(const T & a, const T & b, const T & eps)
{
return !abs_lt(a, b, eps);
@@ -87,7 +86,7 @@ bool abs_gte(const T & a, const T & b, const T & eps)
* @pre eps >= 0
* @return True iff 'a' is greater than 'b' minus 'eps'.
*/
-template
+template
bool abs_gt(const T & a, const T & b, const T & eps)
{
return !abs_lte(a, b, eps);
@@ -98,7 +97,7 @@ bool abs_gt(const T & a, const T & b, const T & eps)
* @pre eps >= 0
* @return True iff 'a' is within 'eps' of zero.
*/
-template
+template
bool abs_eq_zero(const T & a, const T & eps)
{
return abs_eq(a, static_cast(0), eps);
@@ -110,12 +109,11 @@ bool abs_eq_zero(const T & a, const T & eps)
* @pre rel_eps >= 0
* @return True iff 'a' and 'b' are within relative 'rel_eps' of each other.
*/
-template
+template
bool rel_eq(const T & a, const T & b, const T & rel_eps)
{
static_assert(
- std::is_floating_point::value,
- "Float comparisons only support floating point types.");
+ std::is_floating_point::value, "Float comparisons only support floating point types.");
const auto delta = std::abs(a - b);
const auto larger = std::max(std::abs(a), std::abs(b));
@@ -135,7 +133,7 @@ bool rel_eq(const T & a, const T & b, const T & rel_eps)
* @pre rel_eps >= 0
* @return True iff 'a' and 'b' are within 'eps' or 'rel_eps' of each other
*/
-template
+template
bool approx_eq(const T & a, const T & b, const T & abs_eps, const T & rel_eps)
{
const auto are_absolute_eq = abs_eq(a, b, abs_eps);
diff --git a/common/autoware_auto_common/include/helper_functions/mahalanobis_distance.hpp b/common/autoware_auto_common/include/helper_functions/mahalanobis_distance.hpp
index fde5efca90a23..dcfa65880fdd7 100644
--- a/common/autoware_auto_common/include/helper_functions/mahalanobis_distance.hpp
+++ b/common/autoware_auto_common/include/helper_functions/mahalanobis_distance.hpp
@@ -32,10 +32,9 @@ namespace helper_functions
/// \param mean Single column matrix containing mean of samples received so far
/// \param covariance_factor Covariance matrix
/// \return Square of mahalanobis distance
-template
+template
types::float32_t calculate_squared_mahalanobis_distance(
- const Eigen::Matrix & sample,
- const Eigen::Matrix & mean,
+ const Eigen::Matrix & sample, const Eigen::Matrix & mean,
const Eigen::Matrix & covariance_factor)
{
using Vector = Eigen::Matrix;
@@ -59,12 +58,10 @@ types::float32_t calculate_squared_mahalanobis_distance(
/// \param mean Single column matrix containing mean of samples received so far
/// \param covariance_factor Covariance matrix
/// \return Mahalanobis distance
-template
+template
types::float32_t calculate_mahalanobis_distance(
- const Eigen::Matrix & sample,
- const Eigen::Matrix & mean,
- const Eigen::Matrix & covariance_factor
-)
+ const Eigen::Matrix & sample, const Eigen::Matrix & mean,
+ const Eigen::Matrix & covariance_factor)
{
return sqrtf(calculate_squared_mahalanobis_distance(sample, mean, covariance_factor));
}
diff --git a/common/autoware_auto_common/include/helper_functions/message_adapters.hpp b/common/autoware_auto_common/include/helper_functions/message_adapters.hpp
index 90156b152fdd1..fc813f7d5107b 100644
--- a/common/autoware_auto_common/include/helper_functions/message_adapters.hpp
+++ b/common/autoware_auto_common/include/helper_functions/message_adapters.hpp
@@ -20,6 +20,7 @@
#define HELPER_FUNCTIONS__MESSAGE_ADAPTERS_HPP_
#include
+
#include
namespace autoware
@@ -35,11 +36,15 @@ using TimeStamp = builtin_interfaces::msg::Time;
/// \brief Helper class to check existance of header file in compile time:
/// https://stackoverflow.com/a/16000226/2325407
-template
-struct HasHeader : std::false_type {};
+template
+struct HasHeader : std::false_type
+{
+};
-template
-struct HasHeader: std::true_type {};
+template
+struct HasHeader : std::true_type
+{
+};
/////////// Template declarations
@@ -48,7 +53,7 @@ struct HasHeader: std::true_type {};
/// \tparam T Message type.
/// \param msg Message.
/// \return Frame id of the message.
-template
+template
const std::string & get_frame_id(const T & msg) noexcept;
/// Get a reference to the frame id from message. nullptr_t is used to prevent
@@ -57,7 +62,7 @@ const std::string & get_frame_id(const T & msg) noexcept;
/// \tparam T Message type.
/// \param msg Message.
/// \return Frame id of the message.
-template
+template
std::string & get_frame_id(T & msg) noexcept;
/// Get stamp from message. nullptr_t is used to prevent template ambiguity on
@@ -65,7 +70,7 @@ std::string & get_frame_id(T & msg) noexcept;
/// \tparam T Message type.
/// \param msg Message.
/// \return Frame id of the message.
-template
+template
const TimeStamp & get_stamp(const T & msg) noexcept;
/// Get a reference to the stamp from message. nullptr_t is used to prevent
@@ -74,30 +79,29 @@ const TimeStamp & get_stamp(const T & msg) noexcept;
/// \tparam T Message type.
/// \param msg Message.
/// \return Frame id of the message.
-template
+template
TimeStamp & get_stamp(T & msg) noexcept;
-
/////////////// Default specializations for message types that contain a header.
-template::value, nullptr_t>::type = nullptr>
+template ::value, nullptr_t>::type = nullptr>
const std::string & get_frame_id(const T & msg) noexcept
{
return msg.header.frame_id;
}
-template::value, nullptr_t>::type = nullptr>
+template ::value, nullptr_t>::type = nullptr>
std::string & get_frame_id(T & msg) noexcept
{
return msg.header.frame_id;
}
-template::value, nullptr_t>::type = nullptr>
+template ::value, nullptr_t>::type = nullptr>
TimeStamp & get_stamp(T & msg) noexcept
{
return msg.header.stamp;
}
-template::value, nullptr_t>::type = nullptr>
+template ::value, nullptr_t>::type = nullptr>
TimeStamp get_stamp(const T & msg) noexcept
{
return msg.header.stamp;
diff --git a/common/autoware_auto_common/include/helper_functions/template_utils.hpp b/common/autoware_auto_common/include/helper_functions/template_utils.hpp
index b52be9eae0c59..25a1da4134660 100644
--- a/common/autoware_auto_common/include/helper_functions/template_utils.hpp
+++ b/common/autoware_auto_common/include/helper_functions/template_utils.hpp
@@ -18,6 +18,7 @@
#define HELPER_FUNCTIONS__TEMPLATE_UTILS_HPP_
#include
+
#include
namespace autoware
@@ -30,36 +31,43 @@ namespace helper_functions
/// `std::false_type` otherwise.
/// \tparam ExpressionTemplate Expression to be checked in compile time
/// \tparam T Template parameter to instantiate the expression.
-template class ExpressionTemplate, typename T, typename = void>
-struct expression_valid : std::false_type {};
+template class ExpressionTemplate, typename T, typename = void>
+struct expression_valid : std::false_type
+{
+};
/// This struct is `std::true_type` if the expression is valid for a given template and
/// `std::false_type` otherwise.
/// \tparam ExpressionTemplate Expression to be checked in compile time
/// \tparam T Template parameter to instantiate the expression.
-template class ExpressionTemplate, typename T>
-struct expression_valid>>: std::true_type {};
+template class ExpressionTemplate, typename T>
+struct expression_valid>>
+: std::true_type
+{
+};
/// This struct is `std::true_type` if the expression is valid for a given template
/// type with the specified return type and `std::false_type` otherwise.
/// \tparam ExpressionTemplate Expression to be checked in compile time
/// \tparam T Template parameter to instantiate the expression.
/// \tparam ReturnT Return type of the expression.
-template class ExpressionTemplate, typename T, typename ReturnT,
- typename = void>
-struct expression_valid_with_return : std::false_type {};
+template <
+ template class ExpressionTemplate, typename T, typename ReturnT, typename = void>
+struct expression_valid_with_return : std::false_type
+{
+};
/// This struct is `std::true_type` if the expression is valid for a given template
/// type with the specified return type and `std::false_type` otherwise.
/// \tparam ExpressionTemplate Expression to be checked in compile time
/// \tparam T Template parameter to instantiate the expression.
/// \tparam ReturnT Return type of the expression.
-template class ExpressionTemplate, typename T, typename ReturnT>
-struct expression_valid_with_return>::value>>: std::true_type {};
-
+template class ExpressionTemplate, typename T, typename ReturnT>
+struct expression_valid_with_return<
+ ExpressionTemplate, T, ReturnT,
+ std::enable_if_t>::value>> : std::true_type
+{
+};
} // namespace helper_functions
} // namespace common
diff --git a/common/autoware_auto_common/include/helper_functions/type_name.hpp b/common/autoware_auto_common/include/helper_functions/type_name.hpp
index 1ca75ab86bd6e..a226f7c8fd23a 100644
--- a/common/autoware_auto_common/include/helper_functions/type_name.hpp
+++ b/common/autoware_auto_common/include/helper_functions/type_name.hpp
@@ -32,19 +32,19 @@ namespace helper_functions
{
/// @brief Get a demangled name of a type.
-template
+template
COMMON_PUBLIC std::string get_type_name()
{
- #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
+#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
return abi::__cxa_demangle(typeid(T).name(), NULL, NULL, 0);
- #else
+#else
// For unsupported compilers return a mangled name.
return typeid(T).name();
- #endif
+#endif
}
/// @brief Get a demangled name of a type given its instance.
-template
+template
COMMON_PUBLIC std::string get_type_name(const T &)
{
return get_type_name();
diff --git a/common/autoware_auto_common/package.xml b/common/autoware_auto_common/package.xml
index b79ac8cbe2291..eb8f4af55c2fa 100644
--- a/common/autoware_auto_common/package.xml
+++ b/common/autoware_auto_common/package.xml
@@ -1,21 +1,23 @@
- autoware_auto_common
- 1.0.0
- Miscelaneous helper functions
- Apex.AI, Inc.
- Apache 2
+ autoware_auto_common
+ 1.0.0
+ Miscelaneous helper functions
+ Apex.AI, Inc.
+ Apache 2
- ament_cmake_auto
- autoware_auto_cmake
+ ament_cmake_auto
+ autoware_auto_cmake
- builtin_interfaces
- eigen
+ builtin_interfaces
+ eigen
- ament_cmake_gtest
- ament_lint_auto
- ament_lint_common
+ ament_cmake_gtest
+ ament_lint_auto
+ autoware_lint_common
- ament_cmake
+
+ ament_cmake
+
diff --git a/common/autoware_auto_common/test/test_angle_utils.cpp b/common/autoware_auto_common/test/test_angle_utils.cpp
index dda28d7d62588..1aa0f3c0a8057 100644
--- a/common/autoware_auto_common/test/test_angle_utils.cpp
+++ b/common/autoware_auto_common/test/test_angle_utils.cpp
@@ -21,14 +21,15 @@
namespace
{
+using autoware::common::helper_functions::wrap_angle;
using autoware::common::types::float32_t;
using autoware::common::types::float64_t;
-using autoware::common::helper_functions::wrap_angle;
} // namespace
/// @test Wrap an angle.
-TEST(TestAngleUtils, WrapAngle) {
+TEST(TestAngleUtils, WrapAngle)
+{
EXPECT_DOUBLE_EQ(wrap_angle(-5.0 * M_PI_2), -M_PI_2);
EXPECT_DOUBLE_EQ(wrap_angle(5.0 * M_PI_2), M_PI_2);
EXPECT_DOUBLE_EQ(wrap_angle(M_PI), -M_PI);
diff --git a/common/autoware_auto_common/test/test_bool_comparisons.cpp b/common/autoware_auto_common/test/test_bool_comparisons.cpp
index 6dd15f6dfb597..67c1c8ddbf9aa 100644
--- a/common/autoware_auto_common/test/test_bool_comparisons.cpp
+++ b/common/autoware_auto_common/test/test_bool_comparisons.cpp
@@ -18,10 +18,10 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
-#include
-
#include "helper_functions/bool_comparisons.hpp"
+#include
+
// cppcheck does not like gtest macros inside of namespaces:
// https://sourceforge.net/p/cppcheck/discussion/general/thread/e68df47b/
// use a namespace alias instead of putting macros into the namespace
@@ -29,7 +29,8 @@ namespace comp = autoware::common::helper_functions::comparisons;
//------------------------------------------------------------------------------
-TEST(HelperFunctionsComparisons, ExclusiveOr) {
+TEST(HelperFunctionsComparisons, ExclusiveOr)
+{
EXPECT_TRUE(comp::exclusive_or(0, 1));
EXPECT_TRUE(comp::exclusive_or(1, 0));
EXPECT_FALSE(comp::exclusive_or(0, 0));
diff --git a/common/autoware_auto_common/test/test_byte_reader.cpp b/common/autoware_auto_common/test/test_byte_reader.cpp
index 8425cda73a1e6..0d9daec1e92f7 100644
--- a/common/autoware_auto_common/test/test_byte_reader.cpp
+++ b/common/autoware_auto_common/test/test_byte_reader.cpp
@@ -14,10 +14,11 @@
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#include
+#include "common/types.hpp"
#include "gtest/gtest.h"
#include "helper_functions/byte_reader.hpp"
-#include "common/types.hpp"
+
+#include
using autoware::common::types::float64_t;
@@ -28,13 +29,11 @@ class ByteReader : public ::testing::Test
};
} // namespace
-
// tests serial_driver_node's get_packet function which receives serial packages
TEST_F(ByteReader, Basic)
{
- std::vector data = {
- 0x00, 0x00, 0x00, 0x17, 0x40, 0x28, 0xAE, 0x14, 0x7A, 0xE1, 0x47, 0xAE, 0x00, 0x00, 0x08
- };
+ std::vector data = {0x00, 0x00, 0x00, 0x17, 0x40, 0x28, 0xAE, 0x14,
+ 0x7A, 0xE1, 0x47, 0xAE, 0x00, 0x00, 0x08};
autoware::common::helper_functions::ByteReader byte_reader(data);
diff --git a/common/autoware_auto_common/test/test_float_comparisons.cpp b/common/autoware_auto_common/test/test_float_comparisons.cpp
index cb44c1bf4d038..d292dc0a0cb20 100644
--- a/common/autoware_auto_common/test/test_float_comparisons.cpp
+++ b/common/autoware_auto_common/test/test_float_comparisons.cpp
@@ -18,10 +18,10 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
-#include
-
#include "helper_functions/float_comparisons.hpp"
+#include
+
// cppcheck does not like gtest macros inside of namespaces:
// https://sourceforge.net/p/cppcheck/discussion/general/thread/e68df47b/
// use a namespace alias instead of putting macros into the namespace
@@ -40,7 +40,8 @@ const auto epsilon = 0.0001;
//------------------------------------------------------------------------------
-TEST(HelperFunctionsComparisons, AbsEqZero) {
+TEST(HelperFunctionsComparisons, AbsEqZero)
+{
EXPECT_TRUE(comp::abs_eq_zero(d, epsilon));
EXPECT_TRUE(comp::abs_eq_zero(d + epsilon * epsilon, epsilon));
EXPECT_FALSE(comp::abs_eq_zero(d + 2.0 * epsilon, epsilon));
@@ -50,7 +51,8 @@ TEST(HelperFunctionsComparisons, AbsEqZero) {
//------------------------------------------------------------------------------
-TEST(HelperFunctionsComparisons, AbsEq) {
+TEST(HelperFunctionsComparisons, AbsEq)
+{
EXPECT_TRUE(comp::abs_eq(c, e, epsilon));
EXPECT_TRUE(comp::abs_eq(e, c, epsilon));
EXPECT_FALSE(comp::abs_eq(c, e, 0.0));
@@ -63,7 +65,8 @@ TEST(HelperFunctionsComparisons, AbsEq) {
//------------------------------------------------------------------------------
-TEST(HelperFunctionsComparisons, AbsLt) {
+TEST(HelperFunctionsComparisons, AbsLt)
+{
EXPECT_TRUE(comp::abs_lt(f, c, 0.0));
EXPECT_TRUE(comp::abs_lt(f, c, epsilon));
EXPECT_FALSE(comp::abs_lt(c, f, epsilon));
@@ -73,7 +76,8 @@ TEST(HelperFunctionsComparisons, AbsLt) {
//------------------------------------------------------------------------------
-TEST(HelperFunctionsComparisons, AbsLte) {
+TEST(HelperFunctionsComparisons, AbsLte)
+{
EXPECT_TRUE(comp::abs_lte(c, e, epsilon));
EXPECT_TRUE(comp::abs_lte(e, c, epsilon));
EXPECT_FALSE(comp::abs_lte(c, e, 0.0));
@@ -88,7 +92,8 @@ TEST(HelperFunctionsComparisons, AbsLte) {
//------------------------------------------------------------------------------
-TEST(HelperFunctionsComparisons, AbsGt) {
+TEST(HelperFunctionsComparisons, AbsGt)
+{
EXPECT_TRUE(comp::abs_gt(c, e, 0.0));
EXPECT_FALSE(comp::abs_gt(c, e, epsilon));
EXPECT_FALSE(comp::abs_gt(f, c, epsilon));
@@ -99,7 +104,8 @@ TEST(HelperFunctionsComparisons, AbsGt) {
//------------------------------------------------------------------------------
-TEST(HelperFunctionsComparisons, AbsGte) {
+TEST(HelperFunctionsComparisons, AbsGte)
+{
EXPECT_TRUE(comp::abs_gte(c, e, 0.0));
EXPECT_FALSE(comp::abs_gte(e, c, 0.0));
EXPECT_TRUE(comp::abs_gte(c, e, epsilon));
@@ -112,7 +118,8 @@ TEST(HelperFunctionsComparisons, AbsGte) {
//------------------------------------------------------------------------------
-TEST(HelperFunctionsComparisons, RelEq) {
+TEST(HelperFunctionsComparisons, RelEq)
+{
EXPECT_FALSE(comp::rel_eq(c, e, 0.0));
EXPECT_FALSE(comp::rel_eq(e, c, 0.0));
EXPECT_TRUE(comp::rel_eq(a, a, 0.0));
@@ -128,7 +135,8 @@ TEST(HelperFunctionsComparisons, RelEq) {
//------------------------------------------------------------------------------
-TEST(HelperFunctionsComparisons, ApproxEq) {
+TEST(HelperFunctionsComparisons, ApproxEq)
+{
EXPECT_TRUE(comp::approx_eq(c, e, epsilon, 0.0));
EXPECT_TRUE(comp::approx_eq(e, c, epsilon, 0.0));
EXPECT_TRUE(comp::approx_eq(a, a, epsilon, 0.0));
diff --git a/common/autoware_auto_common/test/test_mahalanobis_distance.cpp b/common/autoware_auto_common/test/test_mahalanobis_distance.cpp
index 878893fda161e..d3f2448c52f92 100644
--- a/common/autoware_auto_common/test/test_mahalanobis_distance.cpp
+++ b/common/autoware_auto_common/test/test_mahalanobis_distance.cpp
@@ -13,11 +13,11 @@
// limitations under the License.
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#include
-
#include
#include
+#include
+
TEST(MahalanobisDistanceTest, BasicTest)
{
Eigen::Matrix mean;
@@ -31,11 +31,10 @@ TEST(MahalanobisDistanceTest, BasicTest)
// equidistant from mean but on two different axes will have vastly different
// mahalanobis distance values
EXPECT_FLOAT_EQ(
- autoware::common::helper_functions::calculate_mahalanobis_distance(
- sample, mean, cov), 1.666666666F);
+ autoware::common::helper_functions::calculate_mahalanobis_distance(sample, mean, cov),
+ 1.666666666F);
sample << 3.F, 2.F;
EXPECT_FLOAT_EQ(
- autoware::common::helper_functions::calculate_mahalanobis_distance(
- sample, mean, cov), 10.0F);
+ autoware::common::helper_functions::calculate_mahalanobis_distance(sample, mean, cov), 10.0F);
}
diff --git a/common/autoware_auto_common/test/test_message_field_adapters.cpp b/common/autoware_auto_common/test/test_message_field_adapters.cpp
index aafddd8f320de..30b9148eaf5f3 100644
--- a/common/autoware_auto_common/test/test_message_field_adapters.cpp
+++ b/common/autoware_auto_common/test/test_message_field_adapters.cpp
@@ -14,15 +14,17 @@
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#include
-
#include
+
#include
+
+#include
+
#include
#include
-using autoware::common::helper_functions::message_field_adapters::get_stamp;
using autoware::common::helper_functions::message_field_adapters::get_frame_id;
+using autoware::common::helper_functions::message_field_adapters::get_stamp;
namespace
{
@@ -35,7 +37,8 @@ builtin_interfaces::msg::Time get_stamp_msg(int t)
}
} // namespace
-TEST(MessageFieldAdapterTest, ConstHeaderTests) {
+TEST(MessageFieldAdapterTest, ConstHeaderTests)
+{
using Message = geometry_msgs::msg::TransformStamped;
const auto stamp = get_stamp_msg(0);
@@ -50,7 +53,8 @@ TEST(MessageFieldAdapterTest, ConstHeaderTests) {
EXPECT_EQ(frame_id, get_frame_id(msg));
}
-TEST(MessageFieldAdapterTest, NonconstHeaderTests) {
+TEST(MessageFieldAdapterTest, NonconstHeaderTests)
+{
using Message = geometry_msgs::msg::TransformStamped;
const auto stamp = get_stamp_msg(0);
diff --git a/common/autoware_auto_common/test/test_template_utils.cpp b/common/autoware_auto_common/test/test_template_utils.cpp
index 876119d1e6776..c20704536e424 100644
--- a/common/autoware_auto_common/test/test_template_utils.cpp
+++ b/common/autoware_auto_common/test/test_template_utils.cpp
@@ -14,97 +14,85 @@
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#include
#include
-struct CorrectType {};
-struct FalseType {};
+#include
+
+struct CorrectType
+{
+};
+struct FalseType
+{
+};
struct Foo
{
- CorrectType bar(CorrectType, const CorrectType &, CorrectType *)
- {
- return CorrectType{};
- }
+ CorrectType bar(CorrectType, const CorrectType &, CorrectType *) { return CorrectType{}; }
};
-template class Expression, typename ... Ts>
+template class Expression, typename... Ts>
using expression_valid_with_return =
- ::autoware::common::helper_functions::expression_valid_with_return;
-template class Expression, typename ... Ts>
-using expression_valid = ::autoware::common::helper_functions::expression_valid;
+ ::autoware::common::helper_functions::expression_valid_with_return;
+template class Expression, typename... Ts>
+using expression_valid = ::autoware::common::helper_functions::expression_valid;
// Types are defined here and not in the header because these definitions are basically the test
// code themselves.
// Correct way to call Foo::bar(...)
-template
+template
using call_bar_expression = decltype(std::declval().bar(
- std::declval(),
- std::declval(),
- std::declval()
-));
+ std::declval(), std::declval(), std::declval()));
// Another correct way to call Foo::bar(...) since a temporary can bind to the const lvalue
// reference
-template
+template
using call_bar_expression2 = decltype(std::declval().bar(
- std::declval(),
- std::declval(),
- std::declval()
-));
+ std::declval(), std::declval(), std::declval()));
// Signature mismatch:
-template
-using false_bar_expression1 = decltype(std::declval().bar(
- std::declval(),
- std::declval(),
- std::declval()
-));
+template
+using false_bar_expression1 =
+ decltype(std::declval().bar(std::declval