diff --git a/common/autoware_auto_common/design/comparisons.md b/common/autoware_auto_common/design/comparisons.md
index f3a7eb5e58429..3d00f77c1b0c3 100644
--- a/common/autoware_auto_common/design/comparisons.md
+++ b/common/autoware_auto_common/design/comparisons.md
@@ -22,8 +22,8 @@ The `exclusive_or` function will test whether two values cast to different boole
## Example Usage
```c++
-#include "common/bool_comparisons.hpp"
-#include "common/float_comparisons.hpp"
+#include "autoware_auto_common/common/bool_comparisons.hpp"
+#include "autoware_auto_common/common/float_comparisons.hpp"
#include
diff --git a/common/autoware_auto_common/include/common/type_traits.hpp b/common/autoware_auto_common/include/autoware_auto_common/common/type_traits.hpp
similarity index 96%
rename from common/autoware_auto_common/include/common/type_traits.hpp
rename to common/autoware_auto_common/include/autoware_auto_common/common/type_traits.hpp
index 7087ed1e81181..66f382f081b33 100644
--- a/common/autoware_auto_common/include/common/type_traits.hpp
+++ b/common/autoware_auto_common/include/autoware_auto_common/common/type_traits.hpp
@@ -14,15 +14,15 @@
//
// Developed by Apex.AI, Inc.
-#include
-#include
+#include "autoware_auto_common/common/types.hpp"
+#include "autoware_auto_common/common/visibility_control.hpp"
#include
#include
#include
-#ifndef COMMON__TYPE_TRAITS_HPP_
-#define COMMON__TYPE_TRAITS_HPP_
+#ifndef AUTOWARE_AUTO_COMMON__COMMON__TYPE_TRAITS_HPP_
+#define AUTOWARE_AUTO_COMMON__COMMON__TYPE_TRAITS_HPP_
namespace autoware
{
@@ -219,4 +219,4 @@ struct intersect
} // namespace common
} // namespace autoware
-#endif // COMMON__TYPE_TRAITS_HPP_
+#endif // AUTOWARE_AUTO_COMMON__COMMON__TYPE_TRAITS_HPP_
diff --git a/common/autoware_auto_common/include/common/types.hpp b/common/autoware_auto_common/include/autoware_auto_common/common/types.hpp
similarity index 93%
rename from common/autoware_auto_common/include/common/types.hpp
rename to common/autoware_auto_common/include/autoware_auto_common/common/types.hpp
index 3f3e444c1aa8c..1c7dfe48c7ec8 100644
--- a/common/autoware_auto_common/include/common/types.hpp
+++ b/common/autoware_auto_common/include/autoware_auto_common/common/types.hpp
@@ -16,11 +16,11 @@
/// \file
/// \brief This file includes common type definition
-#ifndef COMMON__TYPES_HPP_
-#define COMMON__TYPES_HPP_
+#ifndef AUTOWARE_AUTO_COMMON__COMMON__TYPES_HPP_
+#define AUTOWARE_AUTO_COMMON__COMMON__TYPES_HPP_
-#include "common/visibility_control.hpp"
-#include "helper_functions/float_comparisons.hpp"
+#include "autoware_auto_common/common/visibility_control.hpp"
+#include "autoware_auto_common/helper_functions/float_comparisons.hpp"
#include
#include
@@ -122,4 +122,4 @@ using void_t = void;
} // namespace common
} // namespace autoware
-#endif // COMMON__TYPES_HPP_
+#endif // AUTOWARE_AUTO_COMMON__COMMON__TYPES_HPP_
diff --git a/common/autoware_auto_common/include/common/visibility_control.hpp b/common/autoware_auto_common/include/autoware_auto_common/common/visibility_control.hpp
similarity index 88%
rename from common/autoware_auto_common/include/common/visibility_control.hpp
rename to common/autoware_auto_common/include/autoware_auto_common/common/visibility_control.hpp
index 0a988d6407dfa..33834fd9ccfed 100644
--- a/common/autoware_auto_common/include/common/visibility_control.hpp
+++ b/common/autoware_auto_common/include/autoware_auto_common/common/visibility_control.hpp
@@ -14,8 +14,8 @@
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#ifndef COMMON__VISIBILITY_CONTROL_HPP_
-#define COMMON__VISIBILITY_CONTROL_HPP_
+#ifndef AUTOWARE_AUTO_COMMON__COMMON__VISIBILITY_CONTROL_HPP_
+#define AUTOWARE_AUTO_COMMON__COMMON__VISIBILITY_CONTROL_HPP_
#if defined(_MSC_VER) && defined(_WIN64)
#if defined(COMMON_BUILDING_DLL) || defined(COMMON_EXPORTS)
@@ -35,4 +35,4 @@
#error "Unsupported Build Configuration"
#endif // _MSC_VER
-#endif // COMMON__VISIBILITY_CONTROL_HPP_
+#endif // AUTOWARE_AUTO_COMMON__COMMON__VISIBILITY_CONTROL_HPP_
diff --git a/common/autoware_auto_common/include/helper_functions/angle_utils.hpp b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/angle_utils.hpp
similarity index 89%
rename from common/autoware_auto_common/include/helper_functions/angle_utils.hpp
rename to common/autoware_auto_common/include/autoware_auto_common/helper_functions/angle_utils.hpp
index 6cca2440d5680..ea974774dd9d5 100644
--- a/common/autoware_auto_common/include/helper_functions/angle_utils.hpp
+++ b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/angle_utils.hpp
@@ -14,8 +14,8 @@
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#ifndef HELPER_FUNCTIONS__ANGLE_UTILS_HPP_
-#define HELPER_FUNCTIONS__ANGLE_UTILS_HPP_
+#ifndef AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__ANGLE_UTILS_HPP_
+#define AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__ANGLE_UTILS_HPP_
#include
#include
@@ -63,4 +63,4 @@ constexpr T wrap_angle(T angle) noexcept
} // namespace common
} // namespace autoware
-#endif // HELPER_FUNCTIONS__ANGLE_UTILS_HPP_
+#endif // AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__ANGLE_UTILS_HPP_
diff --git a/common/autoware_auto_common/include/helper_functions/bool_comparisons.hpp b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/bool_comparisons.hpp
similarity index 85%
rename from common/autoware_auto_common/include/helper_functions/bool_comparisons.hpp
rename to common/autoware_auto_common/include/autoware_auto_common/helper_functions/bool_comparisons.hpp
index c6bf09365af4f..45da098ad0066 100644
--- a/common/autoware_auto_common/include/helper_functions/bool_comparisons.hpp
+++ b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/bool_comparisons.hpp
@@ -18,10 +18,10 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
-#ifndef HELPER_FUNCTIONS__BOOL_COMPARISONS_HPP_
-#define HELPER_FUNCTIONS__BOOL_COMPARISONS_HPP_
+#ifndef AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__BOOL_COMPARISONS_HPP_
+#define AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__BOOL_COMPARISONS_HPP_
-#include "common/types.hpp"
+#include "autoware_auto_common/common/types.hpp"
namespace autoware
{
@@ -47,4 +47,4 @@ types::bool8_t exclusive_or(const T & a, const T & b)
} // namespace common
} // namespace autoware
-#endif // HELPER_FUNCTIONS__BOOL_COMPARISONS_HPP_
+#endif // AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__BOOL_COMPARISONS_HPP_
diff --git a/common/autoware_auto_common/include/helper_functions/byte_reader.hpp b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/byte_reader.hpp
similarity index 90%
rename from common/autoware_auto_common/include/helper_functions/byte_reader.hpp
rename to common/autoware_auto_common/include/autoware_auto_common/helper_functions/byte_reader.hpp
index d9e55c4ecfbfe..3852361caebeb 100644
--- a/common/autoware_auto_common/include/helper_functions/byte_reader.hpp
+++ b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/byte_reader.hpp
@@ -16,8 +16,8 @@
/// \file
/// \brief This file includes common helper functions
-#ifndef HELPER_FUNCTIONS__BYTE_READER_HPP_
-#define HELPER_FUNCTIONS__BYTE_READER_HPP_
+#ifndef AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__BYTE_READER_HPP_
+#define AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__BYTE_READER_HPP_
#include
#include
@@ -70,4 +70,4 @@ class ByteReader
} // namespace common
} // namespace autoware
-#endif // HELPER_FUNCTIONS__BYTE_READER_HPP_
+#endif // AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__BYTE_READER_HPP_
diff --git a/common/autoware_auto_common/include/helper_functions/crtp.hpp b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/crtp.hpp
similarity index 88%
rename from common/autoware_auto_common/include/helper_functions/crtp.hpp
rename to common/autoware_auto_common/include/autoware_auto_common/helper_functions/crtp.hpp
index 0e8110a9a3bb9..e75674eb73c70 100644
--- a/common/autoware_auto_common/include/helper_functions/crtp.hpp
+++ b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/crtp.hpp
@@ -16,8 +16,8 @@
/// \file
/// \brief This file includes common helper functions
-#ifndef HELPER_FUNCTIONS__CRTP_HPP_
-#define HELPER_FUNCTIONS__CRTP_HPP_
+#ifndef AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__CRTP_HPP_
+#define AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__CRTP_HPP_
namespace autoware
{
@@ -49,4 +49,4 @@ class crtp
} // namespace common
} // namespace autoware
-#endif // HELPER_FUNCTIONS__CRTP_HPP_
+#endif // AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__CRTP_HPP_
diff --git a/common/autoware_auto_common/include/helper_functions/float_comparisons.hpp b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/float_comparisons.hpp
similarity index 95%
rename from common/autoware_auto_common/include/helper_functions/float_comparisons.hpp
rename to common/autoware_auto_common/include/autoware_auto_common/helper_functions/float_comparisons.hpp
index de1f459f21d0a..1a64fe71a1720 100644
--- a/common/autoware_auto_common/include/helper_functions/float_comparisons.hpp
+++ b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/float_comparisons.hpp
@@ -18,8 +18,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
-#ifndef HELPER_FUNCTIONS__FLOAT_COMPARISONS_HPP_
-#define HELPER_FUNCTIONS__FLOAT_COMPARISONS_HPP_
+#ifndef AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__FLOAT_COMPARISONS_HPP_
+#define AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__FLOAT_COMPARISONS_HPP_
#include
#include
@@ -146,4 +146,4 @@ bool approx_eq(const T & a, const T & b, const T & abs_eps, const T & rel_eps)
} // namespace common
} // namespace autoware
-#endif // HELPER_FUNCTIONS__FLOAT_COMPARISONS_HPP_
+#endif // AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__FLOAT_COMPARISONS_HPP_
diff --git a/common/autoware_auto_common/include/helper_functions/mahalanobis_distance.hpp b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/mahalanobis_distance.hpp
similarity index 92%
rename from common/autoware_auto_common/include/helper_functions/mahalanobis_distance.hpp
rename to common/autoware_auto_common/include/autoware_auto_common/helper_functions/mahalanobis_distance.hpp
index fb9bdccf32b25..70c29eaf220d8 100644
--- a/common/autoware_auto_common/include/helper_functions/mahalanobis_distance.hpp
+++ b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/mahalanobis_distance.hpp
@@ -14,8 +14,8 @@
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#ifndef HELPER_FUNCTIONS__MAHALANOBIS_DISTANCE_HPP_
-#define HELPER_FUNCTIONS__MAHALANOBIS_DISTANCE_HPP_
+#ifndef AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__MAHALANOBIS_DISTANCE_HPP_
+#define AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__MAHALANOBIS_DISTANCE_HPP_
#include
@@ -69,4 +69,4 @@ types::float32_t calculate_mahalanobis_distance(
} // namespace common
} // namespace autoware
-#endif // HELPER_FUNCTIONS__MAHALANOBIS_DISTANCE_HPP_
+#endif // AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__MAHALANOBIS_DISTANCE_HPP_
diff --git a/common/autoware_auto_common/include/helper_functions/message_adapters.hpp b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/message_adapters.hpp
similarity index 94%
rename from common/autoware_auto_common/include/helper_functions/message_adapters.hpp
rename to common/autoware_auto_common/include/autoware_auto_common/helper_functions/message_adapters.hpp
index 352ef7c7b65d5..d3bda57b3374f 100644
--- a/common/autoware_auto_common/include/helper_functions/message_adapters.hpp
+++ b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/message_adapters.hpp
@@ -16,8 +16,8 @@
/// \file
/// \brief This file includes common helper functions
-#ifndef HELPER_FUNCTIONS__MESSAGE_ADAPTERS_HPP_
-#define HELPER_FUNCTIONS__MESSAGE_ADAPTERS_HPP_
+#ifndef AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__MESSAGE_ADAPTERS_HPP_
+#define AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__MESSAGE_ADAPTERS_HPP_
#include
@@ -112,4 +112,4 @@ TimeStamp get_stamp(const T & msg) noexcept
} // namespace common
} // namespace autoware
-#endif // HELPER_FUNCTIONS__MESSAGE_ADAPTERS_HPP_
+#endif // AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__MESSAGE_ADAPTERS_HPP_
diff --git a/common/autoware_auto_common/include/helper_functions/template_utils.hpp b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/template_utils.hpp
similarity index 91%
rename from common/autoware_auto_common/include/helper_functions/template_utils.hpp
rename to common/autoware_auto_common/include/autoware_auto_common/helper_functions/template_utils.hpp
index b39931a3fd15a..0360908509618 100644
--- a/common/autoware_auto_common/include/helper_functions/template_utils.hpp
+++ b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/template_utils.hpp
@@ -14,10 +14,10 @@
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#ifndef HELPER_FUNCTIONS__TEMPLATE_UTILS_HPP_
-#define HELPER_FUNCTIONS__TEMPLATE_UTILS_HPP_
+#ifndef AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__TEMPLATE_UTILS_HPP_
+#define AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__TEMPLATE_UTILS_HPP_
-#include
+#include "autoware_auto_common/common/types.hpp"
#include
@@ -72,4 +72,4 @@ struct expression_valid_with_return<
} // namespace helper_functions
} // namespace common
} // namespace autoware
-#endif // HELPER_FUNCTIONS__TEMPLATE_UTILS_HPP_
+#endif // AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__TEMPLATE_UTILS_HPP_
diff --git a/common/autoware_auto_common/include/helper_functions/type_name.hpp b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/type_name.hpp
similarity index 84%
rename from common/autoware_auto_common/include/helper_functions/type_name.hpp
rename to common/autoware_auto_common/include/autoware_auto_common/helper_functions/type_name.hpp
index a95834373d552..106cede1f2f5a 100644
--- a/common/autoware_auto_common/include/helper_functions/type_name.hpp
+++ b/common/autoware_auto_common/include/autoware_auto_common/helper_functions/type_name.hpp
@@ -14,10 +14,10 @@
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#ifndef HELPER_FUNCTIONS__TYPE_NAME_HPP_
-#define HELPER_FUNCTIONS__TYPE_NAME_HPP_
+#ifndef AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__TYPE_NAME_HPP_
+#define AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__TYPE_NAME_HPP_
-#include
+#include "autoware_auto_common/common/visibility_control.hpp"
#include
#include
@@ -53,4 +53,4 @@ COMMON_PUBLIC std::string get_type_name(const T &)
} // namespace helper_functions
} // namespace autoware
-#endif // HELPER_FUNCTIONS__TYPE_NAME_HPP_
+#endif // AUTOWARE_AUTO_COMMON__HELPER_FUNCTIONS__TYPE_NAME_HPP_
diff --git a/common/autoware_auto_common/test/test_angle_utils.cpp b/common/autoware_auto_common/test/test_angle_utils.cpp
index 031ae144139aa..810c302845daf 100644
--- a/common/autoware_auto_common/test/test_angle_utils.cpp
+++ b/common/autoware_auto_common/test/test_angle_utils.cpp
@@ -14,8 +14,8 @@
//
// Developed by Apex.AI, Inc.
-#include
-#include
+#include "autoware_auto_common/common/types.hpp"
+#include "autoware_auto_common/helper_functions/angle_utils.hpp"
#include
diff --git a/common/autoware_auto_common/test/test_bool_comparisons.cpp b/common/autoware_auto_common/test/test_bool_comparisons.cpp
index 67c1c8ddbf9aa..a84d65e569692 100644
--- a/common/autoware_auto_common/test/test_bool_comparisons.cpp
+++ b/common/autoware_auto_common/test/test_bool_comparisons.cpp
@@ -18,7 +18,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
-#include "helper_functions/bool_comparisons.hpp"
+#include "autoware_auto_common/helper_functions/bool_comparisons.hpp"
#include
diff --git a/common/autoware_auto_common/test/test_byte_reader.cpp b/common/autoware_auto_common/test/test_byte_reader.cpp
index c83d06c6e8132..a5ab8743f7ed4 100644
--- a/common/autoware_auto_common/test/test_byte_reader.cpp
+++ b/common/autoware_auto_common/test/test_byte_reader.cpp
@@ -14,9 +14,10 @@
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#include "common/types.hpp"
-#include "gtest/gtest.h"
-#include "helper_functions/byte_reader.hpp"
+#include "autoware_auto_common/common/types.hpp"
+#include "autoware_auto_common/helper_functions/byte_reader.hpp"
+
+#include
#include
diff --git a/common/autoware_auto_common/test/test_float_comparisons.cpp b/common/autoware_auto_common/test/test_float_comparisons.cpp
index d292dc0a0cb20..37d3afdc177d5 100644
--- a/common/autoware_auto_common/test/test_float_comparisons.cpp
+++ b/common/autoware_auto_common/test/test_float_comparisons.cpp
@@ -18,7 +18,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
-#include "helper_functions/float_comparisons.hpp"
+#include "autoware_auto_common/helper_functions/float_comparisons.hpp"
#include
diff --git a/common/autoware_auto_common/test/test_mahalanobis_distance.cpp b/common/autoware_auto_common/test/test_mahalanobis_distance.cpp
index 262599180abb6..2015a85bc2bc8 100644
--- a/common/autoware_auto_common/test/test_mahalanobis_distance.cpp
+++ b/common/autoware_auto_common/test/test_mahalanobis_distance.cpp
@@ -13,8 +13,8 @@
// limitations under the License.
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#include
-#include
+#include "autoware_auto_common/common/types.hpp"
+#include "autoware_auto_common/helper_functions/mahalanobis_distance.hpp"
#include
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 34974c1cda9a6..c35f0ff826995 100644
--- a/common/autoware_auto_common/test/test_message_field_adapters.cpp
+++ b/common/autoware_auto_common/test/test_message_field_adapters.cpp
@@ -14,7 +14,7 @@
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#include
+#include "autoware_auto_common/helper_functions/message_adapters.hpp"
#include
diff --git a/common/autoware_auto_common/test/test_template_utils.cpp b/common/autoware_auto_common/test/test_template_utils.cpp
index 9c9ca9ae4b5f2..a670aaab83cfa 100644
--- a/common/autoware_auto_common/test/test_template_utils.cpp
+++ b/common/autoware_auto_common/test/test_template_utils.cpp
@@ -14,7 +14,7 @@
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#include
+#include "autoware_auto_common/helper_functions/template_utils.hpp"
#include
diff --git a/common/autoware_auto_common/test/test_type_name.cpp b/common/autoware_auto_common/test/test_type_name.cpp
index 1fb60d838f307..4ada59b4fb2e1 100644
--- a/common/autoware_auto_common/test/test_type_name.cpp
+++ b/common/autoware_auto_common/test/test_type_name.cpp
@@ -14,8 +14,8 @@
//
// Developed by Apex.AI, Inc.
-#include
-#include
+#include "autoware_auto_common/common/types.hpp"
+#include "autoware_auto_common/helper_functions/type_name.hpp"
#include
diff --git a/common/autoware_auto_common/test/test_type_traits.cpp b/common/autoware_auto_common/test/test_type_traits.cpp
index 7203ab8d649ee..92d01b3d84d51 100644
--- a/common/autoware_auto_common/test/test_type_traits.cpp
+++ b/common/autoware_auto_common/test/test_type_traits.cpp
@@ -14,8 +14,8 @@
//
// Developed by Apex.AI, Inc.
-#include
-#include
+#include "autoware_auto_common/common/type_traits.hpp"
+#include "autoware_auto_common/common/types.hpp"
#include
diff --git a/common/autoware_auto_geometry/include/autoware_auto_geometry/common_2d.hpp b/common/autoware_auto_geometry/include/autoware_auto_geometry/common_2d.hpp
index da7121bf4e9b5..e3c2e58c9f80e 100644
--- a/common/autoware_auto_geometry/include/autoware_auto_geometry/common_2d.hpp
+++ b/common/autoware_auto_geometry/include/autoware_auto_geometry/common_2d.hpp
@@ -21,7 +21,7 @@
#include "autoware_auto_geometry/interval.hpp"
-#include
+#include
#include "autoware_auto_planning_msgs/msg/trajectory_point.hpp"
diff --git a/common/autoware_auto_geometry/include/autoware_auto_geometry/convex_hull.hpp b/common/autoware_auto_geometry/include/autoware_auto_geometry/convex_hull.hpp
index e566e2e43ae3e..ae81c55ad6b55 100644
--- a/common/autoware_auto_geometry/include/autoware_auto_geometry/convex_hull.hpp
+++ b/common/autoware_auto_geometry/include/autoware_auto_geometry/convex_hull.hpp
@@ -23,7 +23,7 @@
#include "autoware_auto_geometry/common_2d.hpp"
-#include
+#include
// lint -e537 NOLINT pclint vs cpplint
#include
diff --git a/common/autoware_auto_geometry/include/autoware_auto_geometry/hull_pockets.hpp b/common/autoware_auto_geometry/include/autoware_auto_geometry/hull_pockets.hpp
index fd04c0266e065..cd9fd49f71635 100644
--- a/common/autoware_auto_geometry/include/autoware_auto_geometry/hull_pockets.hpp
+++ b/common/autoware_auto_geometry/include/autoware_auto_geometry/hull_pockets.hpp
@@ -23,7 +23,7 @@
#include "autoware_auto_geometry/common_2d.hpp"
-#include
+#include
#include
#include
diff --git a/common/autoware_auto_geometry/include/autoware_auto_geometry/interval.hpp b/common/autoware_auto_geometry/include/autoware_auto_geometry/interval.hpp
index 17e2789ac0325..54be2c32b1d05 100644
--- a/common/autoware_auto_geometry/include/autoware_auto_geometry/interval.hpp
+++ b/common/autoware_auto_geometry/include/autoware_auto_geometry/interval.hpp
@@ -21,8 +21,8 @@
#ifndef AUTOWARE_AUTO_GEOMETRY__INTERVAL_HPP_
#define AUTOWARE_AUTO_GEOMETRY__INTERVAL_HPP_
-#include "common/types.hpp"
-#include "helper_functions/float_comparisons.hpp"
+#include
+#include
#include
#include
diff --git a/common/autoware_auto_geometry/include/autoware_auto_geometry/lookup_table.hpp b/common/autoware_auto_geometry/include/autoware_auto_geometry/lookup_table.hpp
index c689638aa2bd9..7b8867ca096ae 100644
--- a/common/autoware_auto_geometry/include/autoware_auto_geometry/lookup_table.hpp
+++ b/common/autoware_auto_geometry/include/autoware_auto_geometry/lookup_table.hpp
@@ -21,7 +21,8 @@
#define AUTOWARE_AUTO_GEOMETRY__LOOKUP_TABLE_HPP_
#include "autoware_auto_geometry/interval.hpp"
-#include "common/types.hpp"
+
+#include
#include
#include
diff --git a/common/autoware_auto_geometry/include/autoware_auto_geometry/spatial_hash.hpp b/common/autoware_auto_geometry/include/autoware_auto_geometry/spatial_hash.hpp
index c160685fb0f8c..8936e2c17d779 100644
--- a/common/autoware_auto_geometry/include/autoware_auto_geometry/spatial_hash.hpp
+++ b/common/autoware_auto_geometry/include/autoware_auto_geometry/spatial_hash.hpp
@@ -23,7 +23,7 @@
#include "autoware_auto_geometry/spatial_hash_config.hpp"
#include "autoware_auto_geometry/visibility_control.hpp"
-#include
+#include
#include
#include
diff --git a/common/autoware_auto_geometry/include/autoware_auto_geometry/spatial_hash_config.hpp b/common/autoware_auto_geometry/include/autoware_auto_geometry/spatial_hash_config.hpp
index 926b170f807c2..24c4d6e879d4a 100644
--- a/common/autoware_auto_geometry/include/autoware_auto_geometry/spatial_hash_config.hpp
+++ b/common/autoware_auto_geometry/include/autoware_auto_geometry/spatial_hash_config.hpp
@@ -22,9 +22,9 @@
#include "autoware_auto_geometry/common_2d.hpp"
#include "autoware_auto_geometry/visibility_control.hpp"
-#include "helper_functions/crtp.hpp"
-#include
+#include
+#include
#include
#include
diff --git a/common/autoware_auto_geometry/test/src/lookup_table.cpp b/common/autoware_auto_geometry/test/src/lookup_table.cpp
index 092f8a04f2540..81865656c55b5 100644
--- a/common/autoware_auto_geometry/test/src/lookup_table.cpp
+++ b/common/autoware_auto_geometry/test/src/lookup_table.cpp
@@ -16,7 +16,7 @@
#include "autoware_auto_geometry/lookup_table.hpp"
-#include
+#include
#include
diff --git a/common/autoware_auto_perception_rviz_plugin/include/object_detection/object_polygon_detail.hpp b/common/autoware_auto_perception_rviz_plugin/include/object_detection/object_polygon_detail.hpp
index 1fdc44df11183..b661010c19a4d 100644
--- a/common/autoware_auto_perception_rviz_plugin/include/object_detection/object_polygon_detail.hpp
+++ b/common/autoware_auto_perception_rviz_plugin/include/object_detection/object_polygon_detail.hpp
@@ -19,6 +19,7 @@
#include
#include
+#include
#include
#include
#include
@@ -98,6 +99,11 @@ get_label_marker_ptr(
const geometry_msgs::msg::Point & centroid, const geometry_msgs::msg::Quaternion & orientation,
const std::string label, const std_msgs::msg::ColorRGBA & color_rgba);
+AUTOWARE_AUTO_PERCEPTION_RVIZ_PLUGIN_PUBLIC visualization_msgs::msg::Marker::SharedPtr
+get_existence_probability_marker_ptr(
+ const geometry_msgs::msg::Point & centroid, const geometry_msgs::msg::Quaternion & orientation,
+ const float existence_probability, const std_msgs::msg::ColorRGBA & color_rgba);
+
AUTOWARE_AUTO_PERCEPTION_RVIZ_PLUGIN_PUBLIC visualization_msgs::msg::Marker::SharedPtr
get_uuid_marker_ptr(
const std::string & uuid, const geometry_msgs::msg::Point & centroid,
diff --git a/common/autoware_auto_perception_rviz_plugin/include/object_detection/object_polygon_display_base.hpp b/common/autoware_auto_perception_rviz_plugin/include/object_detection/object_polygon_display_base.hpp
index 683877f6429bd..223611520b2fc 100644
--- a/common/autoware_auto_perception_rviz_plugin/include/object_detection/object_polygon_display_base.hpp
+++ b/common/autoware_auto_perception_rviz_plugin/include/object_detection/object_polygon_display_base.hpp
@@ -14,12 +14,12 @@
#ifndef OBJECT_DETECTION__OBJECT_POLYGON_DISPLAY_BASE_HPP_
#define OBJECT_DETECTION__OBJECT_POLYGON_DISPLAY_BASE_HPP_
-#include "rviz_common/properties/enum_property.hpp"
+#include "common/color_alpha_property.hpp"
-#include
#include
#include
#include
+#include
#include
#include
#include
@@ -77,6 +77,11 @@ class AUTOWARE_AUTO_PERCEPTION_RVIZ_PLUGIN_PUBLIC ObjectPolygonDisplayBase
m_display_path_confidence_property{
"Display Predicted Path Confidence", true, "Enable/disable predicted paths visualization",
this},
+
+ m_display_existence_probability_property{
+ "Display Existence Probability", false, "Enable/disable existence probability visualization",
+ this},
+
m_line_width_property{"Line Width", 0.03, "Line width of object-shape", this},
m_default_topic{default_topic}
{
@@ -202,6 +207,19 @@ class AUTOWARE_AUTO_PERCEPTION_RVIZ_PLUGIN_PUBLIC ObjectPolygonDisplayBase
return std::nullopt;
}
}
+ template
+ std::optional get_existence_probability_marker_ptr(
+ const geometry_msgs::msg::Point & centroid, const geometry_msgs::msg::Quaternion & orientation,
+ const float existence_probability, const ClassificationContainerT & labels) const
+ {
+ if (m_display_existence_probability_property.getBool()) {
+ const std_msgs::msg::ColorRGBA color_rgba = get_color_rgba(labels);
+ return detail::get_existence_probability_marker_ptr(
+ centroid, orientation, existence_probability, color_rgba);
+ } else {
+ return std::nullopt;
+ }
+ }
template
std::optional get_uuid_marker_ptr(
@@ -326,7 +344,6 @@ class AUTOWARE_AUTO_PERCEPTION_RVIZ_PLUGIN_PUBLIC ObjectPolygonDisplayBase
}
return (it->second).label;
}
-
std::string uuid_to_string(const unique_identifier_msgs::msg::UUID & u) const
{
std::stringstream ss;
@@ -415,6 +432,9 @@ class AUTOWARE_AUTO_PERCEPTION_RVIZ_PLUGIN_PUBLIC ObjectPolygonDisplayBase
rviz_common::properties::BoolProperty m_display_predicted_paths_property;
// Property to enable/disable predicted path confidence visualization
rviz_common::properties::BoolProperty m_display_path_confidence_property;
+
+ rviz_common::properties::BoolProperty m_display_existence_probability_property;
+
// Property to decide line width of object shape
rviz_common::properties::FloatProperty m_line_width_property;
// Default topic name to be visualized
diff --git a/common/autoware_auto_perception_rviz_plugin/src/common/color_alpha_property.cpp b/common/autoware_auto_perception_rviz_plugin/src/common/color_alpha_property.cpp
index ac9c5af4ddeef..57a42c95f9d34 100644
--- a/common/autoware_auto_perception_rviz_plugin/src/common/color_alpha_property.cpp
+++ b/common/autoware_auto_perception_rviz_plugin/src/common/color_alpha_property.cpp
@@ -14,7 +14,7 @@
//
// Co-developed by Tier IV, Inc. and Apex.AI, Inc.
-#include
+#include "common/color_alpha_property.hpp"
#include
diff --git a/common/autoware_auto_perception_rviz_plugin/src/object_detection/detected_objects_display.cpp b/common/autoware_auto_perception_rviz_plugin/src/object_detection/detected_objects_display.cpp
index 2ba80fddc1f34..5dcdce791c585 100644
--- a/common/autoware_auto_perception_rviz_plugin/src/object_detection/detected_objects_display.cpp
+++ b/common/autoware_auto_perception_rviz_plugin/src/object_detection/detected_objects_display.cpp
@@ -57,6 +57,22 @@ void DetectedObjectsDisplay::processMessage(DetectedObjects::ConstSharedPtr msg)
add_marker(label_marker_ptr);
}
+ // Get marker for existence probability
+ geometry_msgs::msg::Point existence_probability_position;
+ existence_probability_position.x = object.kinematics.pose_with_covariance.pose.position.x + 0.5;
+ existence_probability_position.y = object.kinematics.pose_with_covariance.pose.position.y;
+ existence_probability_position.z = object.kinematics.pose_with_covariance.pose.position.z + 0.5;
+ const float existence_probability = object.existence_probability;
+ auto existence_prob_marker = get_existence_probability_marker_ptr(
+ existence_probability_position, object.kinematics.pose_with_covariance.pose.orientation,
+ existence_probability, object.classification);
+ if (existence_prob_marker) {
+ auto existence_prob_marker_ptr = existence_prob_marker.value();
+ existence_prob_marker_ptr->header = msg->header;
+ existence_prob_marker_ptr->id = id++;
+ add_marker(existence_prob_marker_ptr);
+ }
+
// Get marker for velocity text
geometry_msgs::msg::Point vel_vis_position;
vel_vis_position.x = object.kinematics.pose_with_covariance.pose.position.x - 0.5;
diff --git a/common/autoware_auto_perception_rviz_plugin/src/object_detection/object_polygon_detail.cpp b/common/autoware_auto_perception_rviz_plugin/src/object_detection/object_polygon_detail.cpp
index d10bc8ef5ab9d..d87541b7840a9 100644
--- a/common/autoware_auto_perception_rviz_plugin/src/object_detection/object_polygon_detail.cpp
+++ b/common/autoware_auto_perception_rviz_plugin/src/object_detection/object_polygon_detail.cpp
@@ -242,6 +242,23 @@ visualization_msgs::msg::Marker::SharedPtr get_label_marker_ptr(
return marker_ptr;
}
+visualization_msgs::msg::Marker::SharedPtr get_existence_probability_marker_ptr(
+ const geometry_msgs::msg::Point & centroid, const geometry_msgs::msg::Quaternion & orientation,
+ const float existence_probability, const std_msgs::msg::ColorRGBA & color_rgba)
+{
+ auto marker_ptr = std::make_shared();
+ marker_ptr->type = visualization_msgs::msg::Marker::TEXT_VIEW_FACING;
+ marker_ptr->ns = std::string("existence probability");
+ marker_ptr->scale.x = 0.5;
+ marker_ptr->scale.z = 0.5;
+ marker_ptr->text = std::to_string(existence_probability);
+ marker_ptr->action = visualization_msgs::msg::Marker::MODIFY;
+ marker_ptr->pose = marker_ptr->pose = to_pose(centroid, orientation);
+ marker_ptr->lifetime = rclcpp::Duration::from_seconds(0.2);
+ marker_ptr->color = color_rgba;
+ return marker_ptr;
+}
+
visualization_msgs::msg::Marker::SharedPtr get_shape_marker_ptr(
const autoware_auto_perception_msgs::msg::Shape & shape_msg,
const geometry_msgs::msg::Point & centroid, const geometry_msgs::msg::Quaternion & orientation,
diff --git a/common/autoware_auto_perception_rviz_plugin/src/object_detection/predicted_objects_display.cpp b/common/autoware_auto_perception_rviz_plugin/src/object_detection/predicted_objects_display.cpp
index 5aca4290e5ac3..438d70f052b4a 100644
--- a/common/autoware_auto_perception_rviz_plugin/src/object_detection/predicted_objects_display.cpp
+++ b/common/autoware_auto_perception_rviz_plugin/src/object_detection/predicted_objects_display.cpp
@@ -121,6 +121,25 @@ std::vector PredictedObjectsDisplay:
markers.push_back(pose_with_covariance_marker_ptr);
}
+ // Get marker for existence probability
+ geometry_msgs::msg::Point existence_probability_position;
+ existence_probability_position.x =
+ object.kinematics.initial_pose_with_covariance.pose.position.x + 0.5;
+ existence_probability_position.y =
+ object.kinematics.initial_pose_with_covariance.pose.position.y;
+ existence_probability_position.z =
+ object.kinematics.initial_pose_with_covariance.pose.position.z + 0.5;
+ const float existence_probability = object.existence_probability;
+ auto existence_prob_marker = get_existence_probability_marker_ptr(
+ existence_probability_position,
+ object.kinematics.initial_pose_with_covariance.pose.orientation, existence_probability,
+ object.classification);
+ if (existence_prob_marker) {
+ auto existence_prob_marker_ptr = existence_prob_marker.value();
+ existence_prob_marker_ptr->header = msg->header;
+ existence_prob_marker_ptr->id = uuid_to_marker_id(object.object_id);
+ markers.push_back(existence_prob_marker_ptr);
+ }
// Get marker for velocity text
geometry_msgs::msg::Point vel_vis_position;
vel_vis_position.x = uuid_vis_position.x - 0.5;
diff --git a/common/autoware_auto_perception_rviz_plugin/src/object_detection/tracked_objects_display.cpp b/common/autoware_auto_perception_rviz_plugin/src/object_detection/tracked_objects_display.cpp
index 603e39f0c46b5..75b094b49a762 100644
--- a/common/autoware_auto_perception_rviz_plugin/src/object_detection/tracked_objects_display.cpp
+++ b/common/autoware_auto_perception_rviz_plugin/src/object_detection/tracked_objects_display.cpp
@@ -102,7 +102,21 @@ void TrackedObjectsDisplay::processMessage(TrackedObjects::ConstSharedPtr msg)
pose_with_covariance_marker_ptr->id = uuid_to_marker_id(object.object_id);
add_marker(pose_with_covariance_marker_ptr);
}
-
+ // Get marker for existence probability
+ geometry_msgs::msg::Point existence_probability_position;
+ existence_probability_position.x = object.kinematics.pose_with_covariance.pose.position.x + 0.5;
+ existence_probability_position.y = object.kinematics.pose_with_covariance.pose.position.y;
+ existence_probability_position.z = object.kinematics.pose_with_covariance.pose.position.z + 0.5;
+ const float existence_probability = object.existence_probability;
+ auto existence_prob_marker = get_existence_probability_marker_ptr(
+ existence_probability_position, object.kinematics.pose_with_covariance.pose.orientation,
+ existence_probability, object.classification);
+ if (existence_prob_marker) {
+ auto existence_prob_marker_ptr = existence_prob_marker.value();
+ existence_prob_marker_ptr->header = msg->header;
+ existence_prob_marker_ptr->id = uuid_to_marker_id(object.object_id);
+ add_marker(existence_prob_marker_ptr);
+ }
// Get marker for velocity text
geometry_msgs::msg::Point vel_vis_position;
vel_vis_position.x = uuid_vis_position.x - 0.5;
diff --git a/common/autoware_auto_tf2/include/autoware_auto_tf2/tf2_autoware_auto_msgs.hpp b/common/autoware_auto_tf2/include/autoware_auto_tf2/tf2_autoware_auto_msgs.hpp
index b35eb6e93ce6e..50c16ba8eaf7d 100644
--- a/common/autoware_auto_tf2/include/autoware_auto_tf2/tf2_autoware_auto_msgs.hpp
+++ b/common/autoware_auto_tf2/include/autoware_auto_tf2/tf2_autoware_auto_msgs.hpp
@@ -17,7 +17,7 @@
#ifndef AUTOWARE_AUTO_TF2__TF2_AUTOWARE_AUTO_MSGS_HPP_
#define AUTOWARE_AUTO_TF2__TF2_AUTOWARE_AUTO_MSGS_HPP_
-#include
+#include
#include
#include
diff --git a/common/component_interface_utils/include/component_interface_utils/rclcpp/interface.hpp b/common/component_interface_utils/include/component_interface_utils/rclcpp/interface.hpp
index bc48e2a0294e0..97f46933f2fe6 100644
--- a/common/component_interface_utils/include/component_interface_utils/rclcpp/interface.hpp
+++ b/common/component_interface_utils/include/component_interface_utils/rclcpp/interface.hpp
@@ -52,7 +52,7 @@ struct NodeInterface
{ServiceLog::CLIENT_RESPONSE, "client exit"},
{ServiceLog::ERROR_UNREADY, "client unready"},
{ServiceLog::ERROR_TIMEOUT, "client timeout"}});
- RCLCPP_INFO_STREAM(node->get_logger(), type_text.at(type) << ": " << name);
+ RCLCPP_DEBUG_STREAM(node->get_logger(), type_text.at(type) << ": " << name);
ServiceLog msg;
msg.stamp = node->now();
diff --git a/common/fake_test_node/test/test_fake_test_node.cpp b/common/fake_test_node/test/test_fake_test_node.cpp
index d66d0fed3033c..e065f332b75e4 100644
--- a/common/fake_test_node/test/test_fake_test_node.cpp
+++ b/common/fake_test_node/test/test_fake_test_node.cpp
@@ -17,7 +17,7 @@
/// \copyright Copyright 2021 Apex.AI, Inc.
/// All rights reserved.
-#include
+#include
#include
#include
diff --git a/common/motion_utils/include/motion_utils/trajectory/conversion.hpp b/common/motion_utils/include/motion_utils/trajectory/conversion.hpp
index 804ae47ff0f4e..6e77c1ec4a186 100644
--- a/common/motion_utils/include/motion_utils/trajectory/conversion.hpp
+++ b/common/motion_utils/include/motion_utils/trajectory/conversion.hpp
@@ -17,6 +17,7 @@
#include "autoware_auto_planning_msgs/msg/detail/trajectory__struct.hpp"
#include "autoware_auto_planning_msgs/msg/detail/trajectory_point__struct.hpp"
+#include "std_msgs/msg/header.hpp"
#include
@@ -34,7 +35,8 @@ namespace motion_utils
* points larger than the capacity. (Tier IV)
*/
autoware_auto_planning_msgs::msg::Trajectory convertToTrajectory(
- const std::vector & trajectory);
+ const std::vector & trajectory,
+ const std_msgs::msg::Header & header = std_msgs::msg::Header{});
/**
* @brief Convert autoware_auto_planning_msgs::msg::Trajectory to
diff --git a/common/motion_utils/src/resample/resample.cpp b/common/motion_utils/src/resample/resample.cpp
index 1566b493c82f8..834d07a87ea09 100644
--- a/common/motion_utils/src/resample/resample.cpp
+++ b/common/motion_utils/src/resample/resample.cpp
@@ -486,7 +486,7 @@ autoware_auto_planning_msgs::msg::Path resamplePath(
autoware_auto_planning_msgs::msg::Path resampled_path;
resampled_path.header = input_path.header;
resampled_path.left_bound = input_path.left_bound;
- resampled_path.right_bound = resampled_path.right_bound;
+ resampled_path.right_bound = input_path.right_bound;
resampled_path.points.resize(interpolated_pose.size());
for (size_t i = 0; i < resampled_path.points.size(); ++i) {
autoware_auto_planning_msgs::msg::PathPoint path_point;
diff --git a/common/motion_utils/src/trajectory/conversion.cpp b/common/motion_utils/src/trajectory/conversion.cpp
index 97a0bcd06e8cc..f198003d84091 100644
--- a/common/motion_utils/src/trajectory/conversion.cpp
+++ b/common/motion_utils/src/trajectory/conversion.cpp
@@ -30,9 +30,11 @@ namespace motion_utils
* points larger than the capacity. (Tier IV)
*/
autoware_auto_planning_msgs::msg::Trajectory convertToTrajectory(
- const std::vector & trajectory)
+ const std::vector & trajectory,
+ const std_msgs::msg::Header & header)
{
autoware_auto_planning_msgs::msg::Trajectory output{};
+ output.header = header;
for (const auto & pt : trajectory) output.points.push_back(pt);
return output;
}
diff --git a/common/tier4_api_utils/include/tier4_api_utils/rclcpp/client.hpp b/common/tier4_api_utils/include/tier4_api_utils/rclcpp/client.hpp
index aedbe4b34ea22..16ff5a011536c 100644
--- a/common/tier4_api_utils/include/tier4_api_utils/rclcpp/client.hpp
+++ b/common/tier4_api_utils/include/tier4_api_utils/rclcpp/client.hpp
@@ -41,20 +41,20 @@ class Client
const typename ServiceT::Request::SharedPtr & request,
const std::chrono::nanoseconds & timeout = std::chrono::seconds(2))
{
- RCLCPP_INFO(logger_, "client request");
+ RCLCPP_DEBUG(logger_, "client request");
if (!client_->service_is_ready()) {
- RCLCPP_INFO(logger_, "client available");
+ RCLCPP_DEBUG(logger_, "client available");
return {response_error("Internal service is not available."), nullptr};
}
auto future = client_->async_send_request(request);
if (future.wait_for(timeout) != std::future_status::ready) {
- RCLCPP_INFO(logger_, "client timeout");
+ RCLCPP_DEBUG(logger_, "client timeout");
return {response_error("Internal service has timed out."), nullptr};
}
- RCLCPP_INFO(logger_, "client response");
+ RCLCPP_DEBUG(logger_, "client response");
return {response_success(), future.get()};
}
diff --git a/common/tier4_control_rviz_plugin/src/tools/manual_controller.cpp b/common/tier4_control_rviz_plugin/src/tools/manual_controller.cpp
index 9610bf1e2b7f1..fdd270fcce2ef 100644
--- a/common/tier4_control_rviz_plugin/src/tools/manual_controller.cpp
+++ b/common/tier4_control_rviz_plugin/src/tools/manual_controller.cpp
@@ -263,9 +263,9 @@ void ManualController::onClickEnableButton()
{
auto req = std::make_shared();
req->engage = true;
- RCLCPP_INFO(raw_node_->get_logger(), "client request");
+ RCLCPP_DEBUG(raw_node_->get_logger(), "client request");
if (!client_engage_->service_is_ready()) {
- RCLCPP_INFO(raw_node_->get_logger(), "client is unavailable");
+ RCLCPP_DEBUG(raw_node_->get_logger(), "client is unavailable");
return;
}
client_engage_->async_send_request(
diff --git a/common/tier4_state_rviz_plugin/src/autoware_state_panel.hpp b/common/tier4_state_rviz_plugin/src/autoware_state_panel.hpp
index eba3e4eacd275..8f67a90215bd1 100644
--- a/common/tier4_state_rviz_plugin/src/autoware_state_panel.hpp
+++ b/common/tier4_state_rviz_plugin/src/autoware_state_panel.hpp
@@ -171,15 +171,15 @@ public Q_SLOTS: // NOLINT for Qt
{
auto req = std::make_shared();
- RCLCPP_INFO(raw_node_->get_logger(), "client request");
+ RCLCPP_DEBUG(raw_node_->get_logger(), "client request");
if (!client->service_is_ready()) {
- RCLCPP_INFO(raw_node_->get_logger(), "client is unavailable");
+ RCLCPP_DEBUG(raw_node_->get_logger(), "client is unavailable");
return;
}
client->async_send_request(req, [this](typename rclcpp::Client::SharedFuture result) {
- RCLCPP_INFO(
+ RCLCPP_DEBUG(
raw_node_->get_logger(), "Status: %d, %s", result.get()->status.code,
result.get()->status.message.c_str());
});
diff --git a/common/traffic_light_utils/include/traffic_light_utils/traffic_light_utils.hpp b/common/traffic_light_utils/include/traffic_light_utils/traffic_light_utils.hpp
index 081eab28e8833..6ce95acc4ef1d 100644
--- a/common/traffic_light_utils/include/traffic_light_utils/traffic_light_utils.hpp
+++ b/common/traffic_light_utils/include/traffic_light_utils/traffic_light_utils.hpp
@@ -15,10 +15,13 @@
#ifndef TRAFFIC_LIGHT_UTILS__TRAFFIC_LIGHT_UTILS_HPP_
#define TRAFFIC_LIGHT_UTILS__TRAFFIC_LIGHT_UTILS_HPP_
+#include "autoware_perception_msgs/msg/traffic_signal.hpp"
+#include "autoware_perception_msgs/msg/traffic_signal_element.hpp"
#include "tier4_perception_msgs/msg/traffic_light_element.hpp"
#include "tier4_perception_msgs/msg/traffic_light_roi.hpp"
#include "tier4_perception_msgs/msg/traffic_signal.hpp"
+#include
#include
#include
#include
@@ -36,6 +39,47 @@ bool isSignalUnknown(const tier4_perception_msgs::msg::TrafficSignal & signal);
void setSignalUnknown(tier4_perception_msgs::msg::TrafficSignal & signal, float confidence = -1);
+/**
+ * @brief Checks if a traffic light state includes a circle-shaped light with the specified color.
+ *
+ * Iterates through the traffic light elements to find a circle-shaped light that matches the given
+ * color.
+ *
+ * @param tl_state The traffic light state to check.
+ * @param lamp_color The color to look for in the traffic light's circle-shaped lamps.
+ * @return True if a circle-shaped light with the specified color is found, false otherwise.
+ */
+bool hasTrafficLightCircleColor(
+ const autoware_perception_msgs::msg::TrafficSignal & tl_state, const uint8_t & lamp_color);
+
+/**
+ * @brief Checks if a traffic light state includes a light with the specified shape.
+ *
+ * Searches through the traffic light elements to find a light that matches the given shape.
+ *
+ * @param tl_state The traffic light state to check.
+ * @param shape The shape to look for in the traffic light's lights.
+ * @return True if a light with the specified shape is found, false otherwise.
+ */
+bool hasTrafficLightShape(
+ const autoware_perception_msgs::msg::TrafficSignal & tl_state, const uint8_t & lamp_shape);
+
+/**
+ * @brief Determines if a traffic signal indicates a stop for the given lanelet.
+ *
+ * Evaluates the current state of the traffic light, considering if it's green or unknown,
+ * which would not necessitate a stop. Then, it checks the turn direction attribute of the lanelet
+ * against the traffic light's arrow shapes to determine whether a vehicle must stop or if it can
+ * proceed based on allowed turn directions.
+ *
+ * @param lanelet The lanelet to check for a stop signal at its traffic light.
+ * @param tl_state The current state of the traffic light associated with the lanelet.
+ * @return True if the traffic signal indicates a stop is required, false otherwise.
+ */
+bool isTrafficSignalStop(
+ const lanelet::ConstLanelet & lanelet,
+ const autoware_perception_msgs::msg::TrafficSignal & tl_state);
+
tf2::Vector3 getTrafficLightTopLeft(const lanelet::ConstLineString3d & traffic_light);
tf2::Vector3 getTrafficLightBottomRight(const lanelet::ConstLineString3d & traffic_light);
diff --git a/common/traffic_light_utils/package.xml b/common/traffic_light_utils/package.xml
index de05355eafd66..37b4d46ce356a 100644
--- a/common/traffic_light_utils/package.xml
+++ b/common/traffic_light_utils/package.xml
@@ -6,6 +6,7 @@
The traffic_light_utils package
Mingyu Li
Shunsuke Miura
+ Satoshi Ota
Apache License 2.0
ament_cmake_auto
@@ -15,6 +16,7 @@
ament_lint_auto
autoware_lint_common
+ autoware_perception_msgs
lanelet2_extension
tier4_perception_msgs
diff --git a/common/traffic_light_utils/src/traffic_light_utils.cpp b/common/traffic_light_utils/src/traffic_light_utils.cpp
index e02798bb41767..c8f2ca85b2089 100644
--- a/common/traffic_light_utils/src/traffic_light_utils.cpp
+++ b/common/traffic_light_utils/src/traffic_light_utils.cpp
@@ -51,6 +51,63 @@ void setSignalUnknown(tier4_perception_msgs::msg::TrafficSignal & signal, float
}
}
+bool hasTrafficLightCircleColor(
+ const autoware_perception_msgs::msg::TrafficSignal & tl_state, const uint8_t & lamp_color)
+{
+ const auto it_lamp =
+ std::find_if(tl_state.elements.begin(), tl_state.elements.end(), [&lamp_color](const auto & x) {
+ return x.shape == autoware_perception_msgs::msg::TrafficSignalElement::CIRCLE &&
+ x.color == lamp_color;
+ });
+
+ return it_lamp != tl_state.elements.end();
+}
+
+bool hasTrafficLightShape(
+ const autoware_perception_msgs::msg::TrafficSignal & tl_state, const uint8_t & lamp_shape)
+{
+ const auto it_lamp = std::find_if(
+ tl_state.elements.begin(), tl_state.elements.end(),
+ [&lamp_shape](const auto & x) { return x.shape == lamp_shape; });
+
+ return it_lamp != tl_state.elements.end();
+}
+
+bool isTrafficSignalStop(
+ const lanelet::ConstLanelet & lanelet,
+ const autoware_perception_msgs::msg::TrafficSignal & tl_state)
+{
+ if (hasTrafficLightCircleColor(
+ tl_state, autoware_perception_msgs::msg::TrafficSignalElement::GREEN)) {
+ return false;
+ }
+
+ const std::string turn_direction = lanelet.attributeOr("turn_direction", "else");
+
+ if (turn_direction == "else") {
+ return true;
+ }
+ if (
+ turn_direction == "right" &&
+ hasTrafficLightShape(
+ tl_state, autoware_perception_msgs::msg::TrafficSignalElement::RIGHT_ARROW)) {
+ return false;
+ }
+ if (
+ turn_direction == "left" &&
+ hasTrafficLightShape(
+ tl_state, autoware_perception_msgs::msg::TrafficSignalElement::LEFT_ARROW)) {
+ return false;
+ }
+ if (
+ turn_direction == "straight" &&
+ hasTrafficLightShape(tl_state, autoware_perception_msgs::msg::TrafficSignalElement::UP_ARROW)) {
+ return false;
+ }
+
+ return true;
+}
+
tf2::Vector3 getTrafficLightTopLeft(const lanelet::ConstLineString3d & traffic_light)
{
const auto & tl_bl = traffic_light.front();
diff --git a/control/joy_controller/README.md b/control/joy_controller/README.md
index 4518de37b7034..b8ee8ad79a33d 100644
--- a/control/joy_controller/README.md
+++ b/control/joy_controller/README.md
@@ -37,6 +37,7 @@
| `steering_angle_velocity` | double | steering angle velocity for operation |
| `accel_sensitivity` | double | sensitivity to calculate acceleration for external API (commanded acceleration is pow(operation, 1 / sensitivity)) |
| `brake_sensitivity` | double | sensitivity to calculate deceleration for external API (commanded acceleration is pow(operation, 1 / sensitivity)) |
+| `raw_control` | bool | skip input odometry if true |
| `velocity_gain` | double | ratio to calculate velocity by acceleration |
| `max_forward_velocity` | double | absolute max velocity to go forward |
| `max_backward_velocity` | double | absolute max velocity to go backward |
@@ -85,3 +86,25 @@
| Autoware Disengage | ○ |
| Vehicle Engage | △ |
| Vehicle Disengage | △ |
+
+## XBOX Joystick Key Map
+
+| Action | Button |
+| -------------------- | --------------------- |
+| Acceleration | RT |
+| Brake | LT |
+| Steering | Left Stick Left Right |
+| Shift up | Cursor Up |
+| Shift down | Cursor Down |
+| Shift Drive | Cursor Left |
+| Shift Reverse | Cursor Right |
+| Turn Signal Left | LB |
+| Turn Signal Right | RB |
+| Clear Turn Signal | A |
+| Gate Mode | B |
+| Emergency Stop | View |
+| Clear Emergency Stop | Menu |
+| Autoware Engage | X |
+| Autoware Disengage | Y |
+| Vehicle Engage | Left Stick Button |
+| Vehicle Disengage | Right Stick Button |
diff --git a/control/joy_controller/config/joy_controller.param.yaml b/control/joy_controller/config/joy_controller.param.yaml
index 8d48948a2d133..73a5d028985c5 100644
--- a/control/joy_controller/config/joy_controller.param.yaml
+++ b/control/joy_controller/config/joy_controller.param.yaml
@@ -9,6 +9,7 @@
accel_sensitivity: 1.0
brake_sensitivity: 1.0
control_command:
+ raw_control: false
velocity_gain: 3.0
max_forward_velocity: 20.0
max_backward_velocity: 3.0
diff --git a/control/joy_controller/include/joy_controller/joy_controller.hpp b/control/joy_controller/include/joy_controller/joy_controller.hpp
index c6de42afc38d9..22064f9cefaad 100644
--- a/control/joy_controller/include/joy_controller/joy_controller.hpp
+++ b/control/joy_controller/include/joy_controller/joy_controller.hpp
@@ -59,6 +59,7 @@ class AutowareJoyControllerNode : public rclcpp::Node
double brake_sensitivity_;
// ControlCommand Parameter
+ bool raw_control_;
double velocity_gain_;
double max_forward_velocity_;
double max_backward_velocity_;
diff --git a/control/joy_controller/include/joy_controller/joy_converter/xbox_joy_converter.hpp b/control/joy_controller/include/joy_controller/joy_converter/xbox_joy_converter.hpp
new file mode 100644
index 0000000000000..a009ee1e12975
--- /dev/null
+++ b/control/joy_controller/include/joy_controller/joy_converter/xbox_joy_converter.hpp
@@ -0,0 +1,81 @@
+// Copyright 2023 The Autoware Contributors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef JOY_CONTROLLER__JOY_CONVERTER__XBOX_JOY_CONVERTER_HPP_
+#define JOY_CONTROLLER__JOY_CONVERTER__XBOX_JOY_CONVERTER_HPP_
+
+#include "joy_controller/joy_converter/joy_converter_base.hpp"
+
+#include
+
+namespace joy_controller
+{
+class XBOXJoyConverter : public JoyConverterBase
+{
+public:
+ explicit XBOXJoyConverter(const sensor_msgs::msg::Joy & j) : j_(j) {}
+
+ float accel() const { return std::max(0.0f, -((RT() - 1.0f) / 2.0f)); }
+
+ float brake() const { return std::max(0.0f, -((LT() - 1.0f) / 2.0f)); }
+
+ float steer() const { return LStickLeftRight(); }
+
+ bool shift_up() const { return CursorUpDown() == 1.0f; }
+ bool shift_down() const { return CursorUpDown() == -1.0f; }
+ bool shift_drive() const { return CursorLeftRight() == 1.0f; }
+ bool shift_reverse() const { return CursorLeftRight() == -1.0f; }
+
+ bool turn_signal_left() const { return LB(); }
+ bool turn_signal_right() const { return RB(); }
+ bool clear_turn_signal() const { return A(); }
+
+ bool gate_mode() const { return B(); }
+
+ bool emergency_stop() const { return ChangeView(); }
+ bool clear_emergency_stop() const { return Menu(); }
+
+ bool autoware_engage() const { return X(); }
+ bool autoware_disengage() const { return Y(); }
+
+ bool vehicle_engage() const { return LStickButton(); }
+ bool vehicle_disengage() const { return RStickButton(); }
+
+private:
+ float LStickLeftRight() const { return j_.axes.at(0); }
+ float LStickUpDown() const { return j_.axes.at(1); }
+ float RStickLeftRight() const { return j_.axes.at(2); }
+ float RStickUpDown() const { return j_.axes.at(3); }
+ float RT() const { return j_.axes.at(4); }
+ float LT() const { return j_.axes.at(5); }
+ float CursorLeftRight() const { return j_.axes.at(6); }
+ float CursorUpDown() const { return j_.axes.at(7); }
+
+ bool A() const { return j_.buttons.at(0); }
+ bool B() const { return j_.buttons.at(1); }
+ bool X() const { return j_.buttons.at(3); }
+ bool Y() const { return j_.buttons.at(4); }
+ bool LB() const { return j_.buttons.at(6); }
+ bool RB() const { return j_.buttons.at(7); }
+ bool Menu() const { return j_.buttons.at(11); }
+ bool LStickButton() const { return j_.buttons.at(13); }
+ bool RStickButton() const { return j_.buttons.at(14); }
+ bool ChangeView() const { return j_.buttons.at(15); }
+ bool Xbox() const { return j_.buttons.at(16); }
+
+ const sensor_msgs::msg::Joy j_;
+};
+} // namespace joy_controller
+
+#endif // JOY_CONTROLLER__JOY_CONVERTER__XBOX_JOY_CONVERTER_HPP_
diff --git a/control/joy_controller/launch/joy_controller.launch.xml b/control/joy_controller/launch/joy_controller.launch.xml
index f719d8bd78cb5..d2804a7339046 100644
--- a/control/joy_controller/launch/joy_controller.launch.xml
+++ b/control/joy_controller/launch/joy_controller.launch.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/control/joy_controller/schema/joy_controller.schema.json b/control/joy_controller/schema/joy_controller.schema.json
index c67c575a6bd41..d4c6351324935 100644
--- a/control/joy_controller/schema/joy_controller.schema.json
+++ b/control/joy_controller/schema/joy_controller.schema.json
@@ -10,7 +10,7 @@
"type": "string",
"description": "Joy controller type",
"default": "DS4",
- "enum": ["P65", "DS4", "G29"]
+ "enum": ["P65", "DS4", "G29", "XBOX"]
},
"update_rate": {
"type": "number",
@@ -55,6 +55,11 @@
"control_command": {
"type": "object",
"properties": {
+ "raw_control": {
+ "type": "boolean",
+ "description": "Whether to skip input odometry",
+ "default": false
+ },
"velocity_gain": {
"type": "number",
"description": "Ratio to calculate velocity by acceleration",
@@ -79,6 +84,7 @@
}
},
"required": [
+ "raw_control",
"velocity_gain",
"max_forward_velocity",
"max_backward_velocity",
diff --git a/control/joy_controller/src/joy_controller/joy_controller_node.cpp b/control/joy_controller/src/joy_controller/joy_controller_node.cpp
index 897986a7a41cf..5eec438032410 100644
--- a/control/joy_controller/src/joy_controller/joy_controller_node.cpp
+++ b/control/joy_controller/src/joy_controller/joy_controller_node.cpp
@@ -16,6 +16,7 @@
#include "joy_controller/joy_converter/ds4_joy_converter.hpp"
#include "joy_controller/joy_converter/g29_joy_converter.hpp"
#include "joy_controller/joy_converter/p65_joy_converter.hpp"
+#include "joy_controller/joy_converter/xbox_joy_converter.hpp"
#include
@@ -154,6 +155,8 @@ void AutowareJoyControllerNode::onJoy(const sensor_msgs::msg::Joy::ConstSharedPt
joy_ = std::make_shared(*msg);
} else if (joy_type_ == "DS4") {
joy_ = std::make_shared(*msg);
+ } else if (joy_type_ == "XBOX") {
+ joy_ = std::make_shared(*msg);
} else {
joy_ = std::make_shared(*msg);
}
@@ -217,7 +220,7 @@ bool AutowareJoyControllerNode::isDataReady()
}
// Twist
- {
+ if (!raw_control_) {
if (!twist_) {
RCLCPP_WARN_THROTTLE(
get_logger(), *get_clock(), std::chrono::milliseconds(5000).count(),
@@ -458,6 +461,7 @@ AutowareJoyControllerNode::AutowareJoyControllerNode(const rclcpp::NodeOptions &
steering_angle_velocity_ = declare_parameter("steering_angle_velocity");
accel_sensitivity_ = declare_parameter("accel_sensitivity");
brake_sensitivity_ = declare_parameter("brake_sensitivity");
+ raw_control_ = declare_parameter("control_command.raw_control");
velocity_gain_ = declare_parameter("control_command.velocity_gain");
max_forward_velocity_ = declare_parameter("control_command.max_forward_velocity");
max_backward_velocity_ = declare_parameter("control_command.max_backward_velocity");
@@ -477,10 +481,14 @@ AutowareJoyControllerNode::AutowareJoyControllerNode(const rclcpp::NodeOptions &
sub_joy_ = this->create_subscription(
"input/joy", 1, std::bind(&AutowareJoyControllerNode::onJoy, this, std::placeholders::_1),
subscriber_option);
- sub_odom_ = this->create_subscription(
- "input/odometry", 1,
- std::bind(&AutowareJoyControllerNode::onOdometry, this, std::placeholders::_1),
- subscriber_option);
+ if (!raw_control_) {
+ sub_odom_ = this->create_subscription(
+ "input/odometry", 1,
+ std::bind(&AutowareJoyControllerNode::onOdometry, this, std::placeholders::_1),
+ subscriber_option);
+ } else {
+ twist_ = std::make_shared();
+ }
// Publisher
pub_control_command_ =
diff --git a/launch/tier4_perception_launch/launch/occupancy_grid_map/probabilistic_occupancy_grid_map.launch.xml b/launch/tier4_perception_launch/launch/occupancy_grid_map/probabilistic_occupancy_grid_map.launch.xml
index 751eeea66c7b6..281a52a85af71 100644
--- a/launch/tier4_perception_launch/launch/occupancy_grid_map/probabilistic_occupancy_grid_map.launch.xml
+++ b/launch/tier4_perception_launch/launch/occupancy_grid_map/probabilistic_occupancy_grid_map.launch.xml
@@ -8,7 +8,7 @@
-
+
@@ -48,4 +48,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/localization/ekf_localizer/README.md b/localization/ekf_localizer/README.md
index bda1c84a2747c..87cc510c5fe14 100644
--- a/localization/ekf_localizer/README.md
+++ b/localization/ekf_localizer/README.md
@@ -32,71 +32,33 @@ This package includes the following features:
-## Launch
-
-The `ekf_localizer` starts with the default parameters with the following command.
-
-```sh
-roslaunch ekf_localizer ekf_localizer.launch
-```
-
-The parameters and input topic names can be set in the `ekf_localizer.launch` file.
-
## Node
### Subscribed Topics
-- measured_pose_with_covariance (geometry_msgs/PoseWithCovarianceStamped)
-
- Input pose source with the measurement covariance matrix.
-
-- measured_twist_with_covariance (geometry_msgs/TwistWithCovarianceStamped)
-
- Input twist source with the measurement covariance matrix.
-
-- initialpose (geometry_msgs/PoseWithCovarianceStamped)
-
- Initial pose for EKF. The estimated pose is initialized with zeros at the start. It is initialized with this message whenever published.
+| Name | Type | Description |
+| -------------------------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
+| `measured_pose_with_covariance` | `geometry_msgs::msg::PoseWithCovarianceStamped` | Input pose source with the measurement covariance matrix. |
+| `measured_twist_with_covariance` | `geometry_msgs::msg::TwistWithCovarianceStamped` | Input twist source with the measurement covariance matrix. |
+| `initialpose` | `geometry_msgs::msg::PoseWithCovarianceStamped` | Initial pose for EKF. The estimated pose is initialized with zeros at the start. It is initialized with this message whenever published. |
### Published Topics
-- ekf_odom (nav_msgs/Odometry)
-
- Estimated odometry.
-
-- ekf_pose (geometry_msgs/PoseStamped)
-
- Estimated pose.
-
-- ekf_pose_with_covariance (geometry_msgs/PoseWithCovarianceStamped)
-
- Estimated pose with covariance.
-
-- ekf_biased_pose (geometry_msgs/PoseStamped)
-
- Estimated pose including the yaw bias
-
-- ekf_biased_pose_with_covariance (geometry_msgs/PoseWithCovarianceStamped)
-
- Estimated pose with covariance including the yaw bias
-
-- ekf_twist (geometry_msgs/TwistStamped)
-
- Estimated twist.
-
-- ekf_twist_with_covariance (geometry_msgs/TwistWithCovarianceStamped)
-
- The estimated twist with covariance.
-
-- diagnostics (diagnostic_msgs/DiagnosticArray)
-
- The diagnostic information.
+| Name | Type | Description |
+| --------------------------------- | ------------------------------------------------ | ----------------------------------------------------- |
+| `ekf_odom` | `nav_msgs::msg::Odometry` | Estimated odometry. |
+| `ekf_pose` | `geometry_msgs::msg::PoseStamped` | Estimated pose. |
+| `ekf_pose_with_covariance` | `geometry_msgs::msg::PoseWithCovarianceStamped` | Estimated pose with covariance. |
+| `ekf_biased_pose` | `geometry_msgs::msg::PoseStamped` | Estimated pose including the yaw bias |
+| `ekf_biased_pose_with_covariance` | `geometry_msgs::msg::PoseWithCovarianceStamped` | Estimated pose with covariance including the yaw bias |
+| `ekf_twist` | `geometry_msgs::msg::TwistStamped` | Estimated twist. |
+| `ekf_twist_with_covariance` | `geometry_msgs::msg::TwistWithCovarianceStamped` | The estimated twist with covariance. |
+| `diagnostics` | `diagnostics_msgs::msg::DiagnosticArray` | The diagnostic information. |
### Published TF
- base_link
-
- TF from "map" coordinate to estimated pose.
+ TF from `map` coordinate to estimated pose.
## Functions
@@ -205,7 +167,9 @@ Increasing the number will improve the smoothness of the estimation, but may hav
-where `b_k` is the yawbias.
+where, $\theta_k$ represents the vehicle's heading angle, including the mounting angle bias.
+$b_k$ is a correction term for the yaw bias, and it is modeled so that $(\theta_k+b_k)$ becomes the heading angle of the base_link.
+The pose_estimator is expected to publish the base_link in the map coordinate system. However, the yaw angle may be offset due to calibration errors. This model compensates this error and improves estimation accuracy.
### time delay model
@@ -240,7 +204,7 @@ Note that, although the dimension gets larger since the analytical expansion can
## Known issues
-- In the presence of multiple inputs with yaw estimation, yaw bias `b_k` in the current EKF state would not make any sense, since it is intended to capture the extrinsic parameter's calibration error of a sensor. Thus, future work includes introducing yaw bias for each sensor with yaw estimation.
+- If multiple pose_estimators are used, the input to the EKF will include multiple yaw biases corresponding to each source. However, the current EKF assumes the existence of only one yaw bias. Therefore, yaw bias `b_k` in the current EKF state would not make any sense and cannot correctly handle these multiple yaw biases. Thus, future work includes introducing yaw bias for each sensor with yaw estimation.
## reference
diff --git a/localization/ekf_localizer/src/ekf_module.cpp b/localization/ekf_localizer/src/ekf_module.cpp
index 573472fe2dabf..8977d82f34138 100644
--- a/localization/ekf_localizer/src/ekf_module.cpp
+++ b/localization/ekf_localizer/src/ekf_module.cpp
@@ -87,9 +87,15 @@ geometry_msgs::msg::PoseStamped EKFModule::getCurrentPose(
{
const double x = kalman_filter_.getXelement(IDX::X);
const double y = kalman_filter_.getXelement(IDX::Y);
+ /*
+ getXelement(IDX::YAW) is surely `biased_yaw`.
+ Please note how `yaw` and `yaw_bias` are used in the state transition model and
+ how the observed pose is handled in the measurement pose update.
+ */
const double biased_yaw = kalman_filter_.getXelement(IDX::YAW);
const double yaw_bias = kalman_filter_.getXelement(IDX::YAWB);
const double yaw = biased_yaw + yaw_bias;
+
Pose current_ekf_pose;
current_ekf_pose.header.frame_id = params_.pose_frame_id;
current_ekf_pose.header.stamp = current_time;
@@ -224,7 +230,9 @@ bool EKFModule::measurementUpdatePose(
return false;
}
- /* Set yaw */
+ /* Since the kalman filter cannot handle the rotation angle directly,
+ offset the yaw angle so that the difference from the yaw angle that ekf holds internally is less
+ than 2 pi. */
double yaw = tf2::getYaw(pose.pose.pose.orientation);
const double ekf_yaw = kalman_filter_.getXelement(delay_step * dim_x_ + IDX::YAW);
const double yaw_error = normalizeYaw(yaw - ekf_yaw); // normalize the error not to exceed 2 pi
diff --git a/localization/localization_util/CMakeLists.txt b/localization/localization_util/CMakeLists.txt
index ade446020d101..fe65077d89649 100644
--- a/localization/localization_util/CMakeLists.txt
+++ b/localization/localization_util/CMakeLists.txt
@@ -6,7 +6,6 @@ autoware_package()
ament_auto_add_library(localization_util SHARED
src/util_func.cpp
- src/tf2_listener_module.cpp
src/smart_pose_buffer.cpp
)
diff --git a/localization/localization_util/include/localization_util/tf2_listener_module.hpp b/localization/localization_util/include/localization_util/tf2_listener_module.hpp
deleted file mode 100644
index b332f9effe0e0..0000000000000
--- a/localization/localization_util/include/localization_util/tf2_listener_module.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2015-2019 Autoware Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef LOCALIZATION_UTIL__TF2_LISTENER_MODULE_HPP_
-#define LOCALIZATION_UTIL__TF2_LISTENER_MODULE_HPP_
-
-#include
-
-#include
-#include
-#include
-
-#include
-
-class Tf2ListenerModule
-{
- using TransformStamped = geometry_msgs::msg::TransformStamped;
-
-public:
- explicit Tf2ListenerModule(rclcpp::Node * node);
- bool get_transform(
- const builtin_interfaces::msg::Time & timestamp, const std::string & target_frame,
- const std::string & source_frame,
- const geometry_msgs::msg::TransformStamped::SharedPtr & transform_stamped_ptr) const;
-
-private:
- rclcpp::Logger logger_;
- tf2_ros::Buffer tf2_buffer_;
- tf2_ros::TransformListener tf2_listener_;
-};
-
-#endif // LOCALIZATION_UTIL__TF2_LISTENER_MODULE_HPP_
diff --git a/localization/localization_util/src/tf2_listener_module.cpp b/localization/localization_util/src/tf2_listener_module.cpp
deleted file mode 100644
index 8a19ceec9f30d..0000000000000
--- a/localization/localization_util/src/tf2_listener_module.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2015-2019 Autoware Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "localization_util/tf2_listener_module.hpp"
-
-#include
-
-geometry_msgs::msg::TransformStamped identity_transform_stamped(
- const builtin_interfaces::msg::Time & timestamp, const std::string & header_frame_id,
- const std::string & child_frame_id)
-{
- geometry_msgs::msg::TransformStamped transform;
- transform.header.stamp = timestamp;
- transform.header.frame_id = header_frame_id;
- transform.child_frame_id = child_frame_id;
- transform.transform.rotation = tier4_autoware_utils::createQuaternion(0.0, 0.0, 0.0, 1.0);
- transform.transform.translation = tier4_autoware_utils::createTranslation(0.0, 0.0, 0.0);
- return transform;
-}
-
-Tf2ListenerModule::Tf2ListenerModule(rclcpp::Node * node)
-: logger_(node->get_logger()), tf2_buffer_(node->get_clock()), tf2_listener_(tf2_buffer_)
-{
-}
-
-bool Tf2ListenerModule::get_transform(
- const builtin_interfaces::msg::Time & timestamp, const std::string & target_frame,
- const std::string & source_frame, const TransformStamped::SharedPtr & transform_stamped_ptr) const
-{
- const TransformStamped identity =
- identity_transform_stamped(timestamp, target_frame, source_frame);
-
- if (target_frame == source_frame) {
- *transform_stamped_ptr = identity;
- return true;
- }
-
- try {
- *transform_stamped_ptr =
- tf2_buffer_.lookupTransform(target_frame, source_frame, tf2::TimePointZero);
- } catch (tf2::TransformException & ex) {
- RCLCPP_WARN(logger_, "%s", ex.what());
- RCLCPP_ERROR(logger_, "Please publish TF %s to %s", target_frame.c_str(), source_frame.c_str());
-
- *transform_stamped_ptr = identity;
- return false;
- }
- return true;
-}
diff --git a/localization/ndt_scan_matcher/CMakeLists.txt b/localization/ndt_scan_matcher/CMakeLists.txt
index 2ad4a47b833d1..b4d656cb1810b 100644
--- a/localization/ndt_scan_matcher/CMakeLists.txt
+++ b/localization/ndt_scan_matcher/CMakeLists.txt
@@ -30,7 +30,6 @@ ament_auto_add_executable(ndt_scan_matcher
src/particle.cpp
src/ndt_scan_matcher_node.cpp
src/ndt_scan_matcher_core.cpp
- src/map_module.cpp
src/map_update_module.cpp
)
diff --git a/localization/ndt_scan_matcher/README.md b/localization/ndt_scan_matcher/README.md
index d7a7b1c5c37f3..95a7cebdc01c8 100644
--- a/localization/ndt_scan_matcher/README.md
+++ b/localization/ndt_scan_matcher/README.md
@@ -18,7 +18,6 @@ One optional function is regularization. Please see the regularization chapter i
| Name | Type | Description |
| ----------------------------------- | ----------------------------------------------- | ------------------------------------- |
| `ekf_pose_with_covariance` | `geometry_msgs::msg::PoseWithCovarianceStamped` | initial pose |
-| `pointcloud_map` | `sensor_msgs::msg::PointCloud2` | map pointcloud |
| `points_raw` | `sensor_msgs::msg::PointCloud2` | sensor pointcloud |
| `sensing/gnss/pose_with_covariance` | `sensor_msgs::msg::PoseWithCovarianceStamped` | base position for regularization term |
@@ -193,12 +192,6 @@ Using the feature, `ndt_scan_matcher` can theoretically handle any large size ma
### Additional interfaces
-#### Additional inputs
-
-| Name | Type | Description |
-| ---------------- | ------------------------- | ----------------------------------------------------------- |
-| `input_ekf_odom` | `nav_msgs::msg::Odometry` | Vehicle localization results (used for map update decision) |
-
#### Additional outputs
| Name | Type | Description |
@@ -213,20 +206,15 @@ Using the feature, `ndt_scan_matcher` can theoretically handle any large size ma
### Parameters
-| Name | Type | Description |
-| ------------------------------------- | ------ | -------------------------------------------------------------------- |
-| `use_dynamic_map_loading` | bool | Flag to enable dynamic map loading feature for NDT (TRUE by default) |
-| `dynamic_map_loading_update_distance` | double | Distance traveled to load new map(s) |
-| `dynamic_map_loading_map_radius` | double | Map loading radius for every update |
-| `lidar_radius` | double | LiDAR radius used for localization (only used for diagnosis) |
-
-### Enabling the dynamic map loading feature
+| Name | Type | Description |
+| ------------------------------------- | ------ | ------------------------------------------------------------ |
+| `dynamic_map_loading_update_distance` | double | Distance traveled to load new map(s) |
+| `dynamic_map_loading_map_radius` | double | Map loading radius for every update |
+| `lidar_radius` | double | LiDAR radius used for localization (only used for diagnosis) |
-To use dynamic map loading feature for `ndt_scan_matcher`, you also need to appropriately configure some other settings outside of this node.
-Follow the next two instructions.
+### Notes for dynamic map loading
-1. enable dynamic map loading interface in `pointcloud_map_loader` (by setting `enable_differential_load` to true in the package)
-2. split the PCD files into grids (recommended size: 20[m] x 20[m])
+To use dynamic map loading feature for `ndt_scan_matcher`, you also need to split the PCD files into grids (recommended size: 20[m] x 20[m])
Note that the dynamic map loading may FAIL if the map is split into two or more large size map (e.g. 1000[m] x 1000[m]). Please provide either of
@@ -235,14 +223,10 @@ Note that the dynamic map loading may FAIL if the map is split into two or more
Here is a split PCD map for `sample-map-rosbag` from Autoware tutorial: [`sample-map-rosbag_split.zip`](https://github.com/autowarefoundation/autoware.universe/files/10349104/sample-map-rosbag_split.zip)
-| PCD files | `use_dynamic_map_loading` | `enable_differential_load` | How NDT loads map(s) |
-| :------------: | :-----------------------: | :------------------------: | :------------------: |
-| single file | true | true | at once (standard) |
-| single file | true | false | **does NOT work** |
-| single file | false | true/false | at once (standard) |
-| multiple files | true | true | dynamically |
-| multiple files | true | false | **does NOT work** |
-| multiple files | false | true/false | at once (standard) |
+| PCD files | How NDT loads map(s) |
+| :------------: | :------------------: |
+| single file | at once (standard) |
+| multiple files | dynamically |
## Scan matching score based on de-grounded LiDAR scan
diff --git a/localization/ndt_scan_matcher/config/ndt_scan_matcher.param.yaml b/localization/ndt_scan_matcher/config/ndt_scan_matcher.param.yaml
index 1a6c26cd9c351..9bc62d3f919c6 100644
--- a/localization/ndt_scan_matcher/config/ndt_scan_matcher.param.yaml
+++ b/localization/ndt_scan_matcher/config/ndt_scan_matcher.param.yaml
@@ -1,8 +1,5 @@
/**:
ros__parameters:
- # Use dynamic map loading
- use_dynamic_map_loading: true
-
# Vehicle reference frame
base_frame: "base_link"
diff --git a/localization/ndt_scan_matcher/include/ndt_scan_matcher/map_module.hpp b/localization/ndt_scan_matcher/include/ndt_scan_matcher/map_module.hpp
deleted file mode 100644
index 79454e89b9ed0..0000000000000
--- a/localization/ndt_scan_matcher/include/ndt_scan_matcher/map_module.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2022 Autoware Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef NDT_SCAN_MATCHER__MAP_MODULE_HPP_
-#define NDT_SCAN_MATCHER__MAP_MODULE_HPP_
-
-#include
-
-#include
-
-#include
-#include
-#include
-
-#include
-
-class MapModule
-{
- using PointSource = pcl::PointXYZ;
- using PointTarget = pcl::PointXYZ;
- using NormalDistributionsTransform =
- pclomp::MultiGridNormalDistributionsTransform;
-
-public:
- MapModule(
- rclcpp::Node * node, std::mutex * ndt_ptr_mutex,
- std::shared_ptr ndt_ptr,
- rclcpp::CallbackGroup::SharedPtr map_callback_group);
-
-private:
- void callback_map_points(sensor_msgs::msg::PointCloud2::ConstSharedPtr map_points_msg_ptr);
-
- rclcpp::Subscription::SharedPtr map_points_sub_;
- std::shared_ptr ndt_ptr_;
- std::mutex * ndt_ptr_mutex_;
-};
-
-#endif // NDT_SCAN_MATCHER__MAP_MODULE_HPP_
diff --git a/localization/ndt_scan_matcher/include/ndt_scan_matcher/map_update_module.hpp b/localization/ndt_scan_matcher/include/ndt_scan_matcher/map_update_module.hpp
index 5457a6c310f5d..8b192b0186b42 100644
--- a/localization/ndt_scan_matcher/include/ndt_scan_matcher/map_update_module.hpp
+++ b/localization/ndt_scan_matcher/include/ndt_scan_matcher/map_update_module.hpp
@@ -15,7 +15,6 @@
#ifndef NDT_SCAN_MATCHER__MAP_UPDATE_MODULE_HPP_
#define NDT_SCAN_MATCHER__MAP_UPDATE_MODULE_HPP_
-#include "localization_util/tf2_listener_module.hpp"
#include "localization_util/util_func.hpp"
#include "ndt_scan_matcher/particle.hpp"
diff --git a/localization/ndt_scan_matcher/include/ndt_scan_matcher/ndt_scan_matcher_core.hpp b/localization/ndt_scan_matcher/include/ndt_scan_matcher/ndt_scan_matcher_core.hpp
index 6a5c61041f0da..e9aa265c78f34 100644
--- a/localization/ndt_scan_matcher/include/ndt_scan_matcher/ndt_scan_matcher_core.hpp
+++ b/localization/ndt_scan_matcher/include/ndt_scan_matcher/ndt_scan_matcher_core.hpp
@@ -18,8 +18,6 @@
#define FMT_HEADER_ONLY
#include "localization_util/smart_pose_buffer.hpp"
-#include "localization_util/tf2_listener_module.hpp"
-#include "ndt_scan_matcher/map_module.hpp"
#include "ndt_scan_matcher/map_update_module.hpp"
#include
@@ -41,6 +39,8 @@
#include
#include
#include
+#include
+#include
#ifdef ROS_DISTRO_GALACTIC
#include
@@ -176,6 +176,8 @@ class NDTScanMatcher : public rclcpp::Node
rclcpp::Service::SharedPtr service_trigger_node_;
tf2_ros::TransformBroadcaster tf2_broadcaster_;
+ tf2_ros::Buffer tf2_buffer_;
+ tf2_ros::TransformListener tf2_listener_;
rclcpp::CallbackGroup::SharedPtr timer_callback_group_;
@@ -213,8 +215,6 @@ class NDTScanMatcher : public rclcpp::Node
std::unique_ptr regularization_pose_buffer_;
std::atomic is_activated_;
- std::shared_ptr tf2_listener_module_;
- std::unique_ptr map_module_;
std::unique_ptr map_update_module_;
std::unique_ptr logger_configure_;
@@ -222,8 +222,6 @@ class NDTScanMatcher : public rclcpp::Node
bool estimate_scores_for_degrounded_scan_;
double z_margin_for_ground_removal_;
- bool use_dynamic_map_loading_;
-
// The execution time which means probably NDT cannot matches scans properly
int64_t critical_upper_bound_exe_time_ms_;
};
diff --git a/localization/ndt_scan_matcher/launch/ndt_scan_matcher.launch.xml b/localization/ndt_scan_matcher/launch/ndt_scan_matcher.launch.xml
index 655aa8e17ccd9..891d172aaf8fd 100644
--- a/localization/ndt_scan_matcher/launch/ndt_scan_matcher.launch.xml
+++ b/localization/ndt_scan_matcher/launch/ndt_scan_matcher.launch.xml
@@ -4,7 +4,6 @@
-
@@ -19,7 +18,6 @@
-
diff --git a/localization/ndt_scan_matcher/src/map_module.cpp b/localization/ndt_scan_matcher/src/map_module.cpp
deleted file mode 100644
index d6088a1b14949..0000000000000
--- a/localization/ndt_scan_matcher/src/map_module.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2022 Autoware Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "ndt_scan_matcher/map_module.hpp"
-
-MapModule::MapModule(
- rclcpp::Node * node, std::mutex * ndt_ptr_mutex,
- std::shared_ptr ndt_ptr,
- rclcpp::CallbackGroup::SharedPtr map_callback_group)
-: ndt_ptr_(std::move(ndt_ptr)), ndt_ptr_mutex_(ndt_ptr_mutex)
-{
- auto map_sub_opt = rclcpp::SubscriptionOptions();
- map_sub_opt.callback_group = map_callback_group;
-
- map_points_sub_ = node->create_subscription(
- "pointcloud_map", rclcpp::QoS{1}.transient_local(),
- std::bind(&MapModule::callback_map_points, this, std::placeholders::_1), map_sub_opt);
-}
-
-void MapModule::callback_map_points(
- sensor_msgs::msg::PointCloud2::ConstSharedPtr map_points_msg_ptr)
-{
- NormalDistributionsTransform new_ndt;
- new_ndt.setParams(ndt_ptr_->getParams());
-
- pcl::shared_ptr> map_points_ptr(new pcl::PointCloud);
- pcl::fromROSMsg(*map_points_msg_ptr, *map_points_ptr);
- new_ndt.setInputTarget(map_points_ptr);
- // create Thread
- // detach
- auto output_cloud = std::make_shared>();
- new_ndt.align(*output_cloud);
-
- // swap
- ndt_ptr_mutex_->lock();
- *ndt_ptr_ = new_ndt;
- ndt_ptr_mutex_->unlock();
-}
diff --git a/localization/ndt_scan_matcher/src/map_update_module.cpp b/localization/ndt_scan_matcher/src/map_update_module.cpp
index 446f926a1d3f7..39b92fe248660 100644
--- a/localization/ndt_scan_matcher/src/map_update_module.cpp
+++ b/localization/ndt_scan_matcher/src/map_update_module.cpp
@@ -57,10 +57,7 @@ void MapUpdateModule::update_map(const geometry_msgs::msg::Point & position)
request->cached_ids = ndt_ptr_->getCurrentMapIDs();
while (!pcd_loader_client_->wait_for_service(std::chrono::seconds(1)) && rclcpp::ok()) {
- RCLCPP_INFO(
- logger_,
- "Waiting for pcd loader service. Check if the enable_differential_load in "
- "pointcloud_map_loader is set `true`.");
+ RCLCPP_INFO(logger_, "Waiting for pcd loader service. Check the pointcloud_map_loader.");
}
// send a request to map_loader
diff --git a/localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp b/localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp
index 7f6fe605c42b0..0f6fdbc15db26 100644
--- a/localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp
+++ b/localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp
@@ -68,6 +68,8 @@ Eigen::Matrix2d find_rotation_matrix_aligning_covariance_to_principal_axes(
NDTScanMatcher::NDTScanMatcher()
: Node("ndt_scan_matcher"),
tf2_broadcaster_(*this),
+ tf2_buffer_(this->get_clock()),
+ tf2_listener_(tf2_buffer_),
ndt_ptr_(new NormalDistributionsTransform),
state_ptr_(new std::map),
output_pose_covariance_({}),
@@ -262,14 +264,7 @@ NDTScanMatcher::NDTScanMatcher()
&NDTScanMatcher::service_trigger_node, this, std::placeholders::_1, std::placeholders::_2),
rclcpp::ServicesQoS().get_rmw_qos_profile(), sensor_callback_group);
- tf2_listener_module_ = std::make_shared(this);
-
- use_dynamic_map_loading_ = this->declare_parameter("use_dynamic_map_loading");
- if (use_dynamic_map_loading_) {
- map_update_module_ = std::make_unique(this, &ndt_ptr_mtx_, ndt_ptr_);
- } else {
- map_module_ = std::make_unique(this, &ndt_ptr_mtx_, ndt_ptr_, sensor_callback_group);
- }
+ map_update_module_ = std::make_unique(this, &ndt_ptr_mtx_, ndt_ptr_);
logger_configure_ = std::make_unique(this);
}
@@ -347,9 +342,6 @@ void NDTScanMatcher::callback_timer()
if (!is_activated_) {
return;
}
- if (!use_dynamic_map_loading_) {
- return;
- }
std::lock_guard lock(latest_ekf_position_mtx_);
if (latest_ekf_position_ == std::nullopt) {
RCLCPP_ERROR_STREAM_THROTTLE(
@@ -380,7 +372,8 @@ void NDTScanMatcher::callback_initial_pose(
<< ". Please check the frame_id in the input topic and ensure it is correct.");
}
- if (use_dynamic_map_loading_) {
+ {
+ // latest_ekf_position_ is also used by callback_timer, so it is necessary to acquire the lock
std::lock_guard lock(latest_ekf_position_mtx_);
latest_ekf_position_ = initial_pose_msg_ptr->pose.pose.position;
}
@@ -574,11 +567,25 @@ void NDTScanMatcher::transform_sensor_measurement(
const pcl::shared_ptr> & sensor_points_input_ptr,
pcl::shared_ptr> & sensor_points_output_ptr)
{
- auto tf_target_to_source_ptr = std::make_shared();
- tf2_listener_module_->get_transform(
- this->now(), target_frame, source_frame, tf_target_to_source_ptr);
+ if (source_frame == target_frame) {
+ sensor_points_output_ptr = sensor_points_input_ptr;
+ return;
+ }
+
+ geometry_msgs::msg::TransformStamped transform;
+ try {
+ transform = tf2_buffer_.lookupTransform(target_frame, source_frame, tf2::TimePointZero);
+ } catch (tf2::TransformException & ex) {
+ RCLCPP_WARN(this->get_logger(), "%s", ex.what());
+ RCLCPP_WARN(
+ this->get_logger(), "Please publish TF %s to %s", target_frame.c_str(), source_frame.c_str());
+ // Since there is no clear error handling policy, temporarily return as is.
+ sensor_points_output_ptr = sensor_points_input_ptr;
+ return;
+ }
+
const geometry_msgs::msg::PoseStamped target_to_source_pose_stamped =
- tier4_autoware_utils::transform2pose(*tf_target_to_source_ptr);
+ tier4_autoware_utils::transform2pose(transform);
const Eigen::Matrix4f base_to_sensor_matrix =
pose_to_matrix4f(target_to_source_pose_stamped.pose);
tier4_autoware_utils::transformPointCloud(
@@ -863,17 +870,29 @@ void NDTScanMatcher::service_ndt_align(
tier4_localization_msgs::srv::PoseWithCovarianceStamped::Response::SharedPtr res)
{
// get TF from pose_frame to map_frame
- auto tf_pose_to_map_ptr = std::make_shared();
- tf2_listener_module_->get_transform(
- get_clock()->now(), map_frame_, req->pose_with_covariance.header.frame_id, tf_pose_to_map_ptr);
+ const std::string & target_frame = map_frame_;
+ const std::string & source_frame = req->pose_with_covariance.header.frame_id;
- // transform pose_frame to map_frame
- const auto initial_pose_msg_in_map_frame =
- transform(req->pose_with_covariance, *tf_pose_to_map_ptr);
- if (use_dynamic_map_loading_) {
- map_update_module_->update_map(initial_pose_msg_in_map_frame.pose.pose.position);
+ geometry_msgs::msg::TransformStamped transform_s2t;
+ try {
+ transform_s2t = tf2_buffer_.lookupTransform(target_frame, source_frame, tf2::TimePointZero);
+ } catch (tf2::TransformException & ex) {
+ // Note: Up to AWSIMv1.1.0, there is a known bug where the GNSS frame_id is incorrectly set to
+ // "gnss_link" instead of "map". The ndt_align is designed to return identity when this issue
+ // occurs. However, in the future, converting to a non-existent frame_id should be prohibited.
+ RCLCPP_WARN(this->get_logger(), "%s", ex.what());
+ RCLCPP_WARN(
+ this->get_logger(), "Please publish TF %s to %s", target_frame.c_str(), source_frame.c_str());
+ transform_s2t.header.stamp = get_clock()->now();
+ transform_s2t.header.frame_id = target_frame;
+ transform_s2t.child_frame_id = source_frame;
+ transform_s2t.transform = tf2::toMsg(tf2::Transform::getIdentity());
}
+ // transform pose_frame to map_frame
+ const auto initial_pose_msg_in_map_frame = transform(req->pose_with_covariance, transform_s2t);
+ map_update_module_->update_map(initial_pose_msg_in_map_frame.pose.pose.position);
+
// mutex Map
std::lock_guard lock(ndt_ptr_mtx_);
diff --git a/map/map_height_fitter/src/map_height_fitter.cpp b/map/map_height_fitter/src/map_height_fitter.cpp
index 1eb1edd04a68a..a05c63d44ebce 100644
--- a/map/map_height_fitter/src/map_height_fitter.cpp
+++ b/map/map_height_fitter/src/map_height_fitter.cpp
@@ -101,11 +101,11 @@ bool MapHeightFitter::Impl::get_partial_point_cloud_map(const Point & point)
req->area.center_y = point.y;
req->area.radius = 50;
- RCLCPP_INFO(logger, "Send request to map_loader");
+ RCLCPP_DEBUG(logger, "Send request to map_loader");
auto future = cli_map_->async_send_request(req);
auto status = future.wait_for(std::chrono::seconds(1));
while (status != std::future_status::ready) {
- RCLCPP_INFO(logger, "waiting response");
+ RCLCPP_DEBUG(logger, "waiting response");
if (!rclcpp::ok()) {
return false;
}
@@ -113,7 +113,7 @@ bool MapHeightFitter::Impl::get_partial_point_cloud_map(const Point & point)
}
const auto res = future.get();
- RCLCPP_INFO(
+ RCLCPP_DEBUG(
logger, "Loaded partial pcd map from map_loader (grid size: %lu)",
res->new_pointcloud_with_ids.size());
@@ -168,7 +168,7 @@ std::optional MapHeightFitter::Impl::fit(const Point & position, const st
const auto logger = node_->get_logger();
tf2::Vector3 point(position.x, position.y, position.z);
- RCLCPP_INFO(logger, "original point: %.3f %.3f %.3f", point.getX(), point.getY(), point.getZ());
+ RCLCPP_DEBUG(logger, "original point: %.3f %.3f %.3f", point.getX(), point.getY(), point.getZ());
if (cli_map_) {
if (!get_partial_point_cloud_map(position)) {
@@ -193,7 +193,7 @@ std::optional MapHeightFitter::Impl::fit(const Point & position, const st
return std::nullopt;
}
- RCLCPP_INFO(logger, "modified point: %.3f %.3f %.3f", point.getX(), point.getY(), point.getZ());
+ RCLCPP_DEBUG(logger, "modified point: %.3f %.3f %.3f", point.getX(), point.getY(), point.getZ());
Point result;
result.x = point.getX();
diff --git a/map/map_loader/README.md b/map/map_loader/README.md
index 65d9594cb7415..fbe019096a3e7 100644
--- a/map/map_loader/README.md
+++ b/map/map_loader/README.md
@@ -20,7 +20,7 @@ NOTE: **We strongly recommend to use divided maps when using large pointcloud ma
#### Prerequisites on pointcloud map file(s)
-You may provide either a single .pcd file or multiple .pcd files. If you are using multiple PCD data and either of `enable_partial_load`, `enable_differential_load` or `enable_selected_load` are set true, it MUST obey the following rules:
+You may provide either a single .pcd file or multiple .pcd files. If you are using multiple PCD data, it MUST obey the following rules:
1. **The pointcloud map should be projected on the same coordinate defined in `map_projection_loader`**, in order to be consistent with the lanelet2 map and other packages that converts between local and geodetic coordinates. For more information, please refer to [the readme of `map_projection_loader`](https://github.com/autowarefoundation/autoware.universe/tree/main/map/map_projection_loader/README.md).
2. **It must be divided by straight lines parallel to the x-axis and y-axis**. The system does not support division by diagonal lines or curved lines.
@@ -29,8 +29,6 @@ You may provide either a single .pcd file or multiple .pcd files. If you are usi
5. **All the split maps should not overlap with each other.**
6. **Metadata file should also be provided.** The metadata structure description is provided below.
-Note that these rules are not applicable when `enable_partial_load`, `enable_differential_load` and `enable_selected_load` are all set false. In this case, however, you also need to disable dynamic map loading mode for other nodes as well ([ndt_scan_matcher](https://github.com/autowarefoundation/autoware.universe/tree/main/localization/ndt_scan_matcher) and [compare_map_segmentation](https://github.com/autowarefoundation/autoware.universe/tree/main/perception/compare_map_segmentation) as of June 2023).
-
#### Metadata structure
The metadata should look like this:
@@ -118,7 +116,6 @@ Please see [the description of `GetSelectedPointCloudMap.srv`](https://github.co
| enable_whole_load | bool | A flag to enable raw pointcloud map publishing | true |
| enable_downsampled_whole_load | bool | A flag to enable downsampled pointcloud map publishing | false |
| enable_partial_load | bool | A flag to enable partial pointcloud map server | false |
-| enable_differential_load | bool | A flag to enable differential pointcloud map server | false |
| enable_selected_load | bool | A flag to enable selected pointcloud map server | false |
| leaf_size | float | Downsampling leaf size (only used when enable_downsampled_whole_load is set true) | 3.0 |
| pcd_paths_or_directory | std::string | Path(s) to pointcloud map file or directory | |
diff --git a/map/map_loader/config/pointcloud_map_loader.param.yaml b/map/map_loader/config/pointcloud_map_loader.param.yaml
index ba4c032d3e514..b4efbec9706b4 100644
--- a/map/map_loader/config/pointcloud_map_loader.param.yaml
+++ b/map/map_loader/config/pointcloud_map_loader.param.yaml
@@ -3,7 +3,6 @@
enable_whole_load: true
enable_downsampled_whole_load: false
enable_partial_load: true
- enable_differential_load: true
enable_selected_load: false
# only used when downsample_whole_load enabled
diff --git a/map/map_loader/src/pointcloud_map_loader/pointcloud_map_loader_node.cpp b/map/map_loader/src/pointcloud_map_loader/pointcloud_map_loader_node.cpp
index a2d9307084545..5f4b3e311e6e9 100644
--- a/map/map_loader/src/pointcloud_map_loader/pointcloud_map_loader_node.cpp
+++ b/map/map_loader/src/pointcloud_map_loader/pointcloud_map_loader_node.cpp
@@ -53,7 +53,6 @@ PointCloudMapLoaderNode::PointCloudMapLoaderNode(const rclcpp::NodeOptions & opt
bool enable_whole_load = declare_parameter("enable_whole_load");
bool enable_downsample_whole_load = declare_parameter("enable_downsampled_whole_load");
bool enable_partial_load = declare_parameter("enable_partial_load");
- bool enable_differential_load = declare_parameter("enable_differential_load");
bool enable_selected_load = declare_parameter("enable_selected_load");
if (enable_whole_load) {
@@ -68,26 +67,21 @@ PointCloudMapLoaderNode::PointCloudMapLoaderNode(const rclcpp::NodeOptions & opt
std::make_unique(this, pcd_paths, publisher_name, true);
}
- if (enable_partial_load || enable_differential_load || enable_selected_load) {
- std::map pcd_metadata_dict;
- try {
- pcd_metadata_dict = getPCDMetadata(pcd_metadata_path, pcd_paths);
- } catch (std::runtime_error & e) {
- RCLCPP_ERROR_STREAM(get_logger(), e.what());
- }
+ std::map pcd_metadata_dict;
+ try {
+ pcd_metadata_dict = getPCDMetadata(pcd_metadata_path, pcd_paths);
+ } catch (std::runtime_error & e) {
+ RCLCPP_ERROR_STREAM(get_logger(), e.what());
+ }
- if (enable_partial_load) {
- partial_map_loader_ = std::make_unique(this, pcd_metadata_dict);
- }
+ if (enable_partial_load) {
+ partial_map_loader_ = std::make_unique(this, pcd_metadata_dict);
+ }
- if (enable_differential_load) {
- differential_map_loader_ =
- std::make_unique(this, pcd_metadata_dict);
- }
+ differential_map_loader_ = std::make_unique(this, pcd_metadata_dict);
- if (enable_selected_load) {
- selected_map_loader_ = std::make_unique(this, pcd_metadata_dict);
- }
+ if (enable_selected_load) {
+ selected_map_loader_ = std::make_unique(this, pcd_metadata_dict);
}
}
diff --git a/map/map_projection_loader/include/map_projection_loader/map_projection_loader.hpp b/map/map_projection_loader/include/map_projection_loader/map_projection_loader.hpp
index 16442eb43c740..54e794e2742bf 100644
--- a/map/map_projection_loader/include/map_projection_loader/map_projection_loader.hpp
+++ b/map/map_projection_loader/include/map_projection_loader/map_projection_loader.hpp
@@ -23,6 +23,8 @@
#include
tier4_map_msgs::msg::MapProjectorInfo load_info_from_yaml(const std::string & filename);
+tier4_map_msgs::msg::MapProjectorInfo load_map_projector_info(
+ const std::string & yaml_filename, const std::string & lanelet2_map_filename);
class MapProjectionLoader : public rclcpp::Node
{
diff --git a/map/map_projection_loader/src/map_projection_loader.cpp b/map/map_projection_loader/src/map_projection_loader.cpp
index 9fdba288601cc..5966baaed8383 100644
--- a/map/map_projection_loader/src/map_projection_loader.cpp
+++ b/map/map_projection_loader/src/map_projection_loader.cpp
@@ -20,6 +20,7 @@
#include
+#include
#include
tier4_map_msgs::msg::MapProjectorInfo load_info_from_yaml(const std::string & filename)
@@ -55,28 +56,40 @@ tier4_map_msgs::msg::MapProjectorInfo load_info_from_yaml(const std::string & fi
return msg;
}
-MapProjectionLoader::MapProjectionLoader() : Node("map_projection_loader")
+tier4_map_msgs::msg::MapProjectorInfo load_map_projector_info(
+ const std::string & yaml_filename, const std::string & lanelet2_map_filename)
{
- std::string yaml_filename = this->declare_parameter("map_projector_info_path");
- std::string lanelet2_map_filename = this->declare_parameter("lanelet2_map_path");
- std::ifstream file(yaml_filename);
-
tier4_map_msgs::msg::MapProjectorInfo msg;
- bool use_yaml_file = file.is_open();
- if (use_yaml_file) {
- RCLCPP_INFO(this->get_logger(), "Load %s", yaml_filename.c_str());
+ if (std::filesystem::exists(yaml_filename)) {
+ std::cout << "Load " << yaml_filename << std::endl;
msg = load_info_from_yaml(yaml_filename);
- } else {
- RCLCPP_INFO(this->get_logger(), "Load %s", lanelet2_map_filename.c_str());
- RCLCPP_WARN(
- this->get_logger(),
- "DEPRECATED WARNING: Loading map projection info from lanelet2 map may soon be deleted. "
- "Please use map_projector_info.yaml instead. For more info, visit "
- "https://github.com/autowarefoundation/autoware.universe/blob/main/map/map_projection_loader/"
- "README.md");
+ } else if (std::filesystem::exists(lanelet2_map_filename)) {
+ std::cout << "Load " << lanelet2_map_filename << std::endl;
+ std::cout
+ << "DEPRECATED WARNING: Loading map projection info from lanelet2 map may soon be deleted. "
+ "Please use map_projector_info.yaml instead. For more info, visit "
+ "https://github.com/autowarefoundation/autoware.universe/blob/main/map/"
+ "map_projection_loader/"
+ "README.md"
+ << std::endl;
msg = load_info_from_lanelet2_map(lanelet2_map_filename);
+ } else {
+ throw std::runtime_error(
+ "No map projector info files found. Please provide either "
+ "map_projector_info.yaml or lanelet2_map.osm");
}
+ return msg;
+}
+
+MapProjectionLoader::MapProjectionLoader() : Node("map_projection_loader")
+{
+ const std::string yaml_filename = this->declare_parameter("map_projector_info_path");
+ const std::string lanelet2_map_filename =
+ this->declare_parameter("lanelet2_map_path");
+
+ const tier4_map_msgs::msg::MapProjectorInfo msg =
+ load_map_projector_info(yaml_filename, lanelet2_map_filename);
// Publish the message
const auto adaptor = component_interface_utils::NodeAdaptor(this);
diff --git a/perception/image_projection_based_fusion/CMakeLists.txt b/perception/image_projection_based_fusion/CMakeLists.txt
index c021dd92dae64..b13f68b07181e 100644
--- a/perception/image_projection_based_fusion/CMakeLists.txt
+++ b/perception/image_projection_based_fusion/CMakeLists.txt
@@ -22,6 +22,7 @@ ament_auto_add_library(${PROJECT_NAME} SHARED
src/utils/utils.cpp
src/roi_cluster_fusion/node.cpp
src/roi_detected_object_fusion/node.cpp
+ src/segmentation_pointcloud_fusion/node.cpp
src/roi_pointcloud_fusion/node.cpp
)
@@ -40,6 +41,11 @@ rclcpp_components_register_node(${PROJECT_NAME}
EXECUTABLE roi_cluster_fusion_node
)
+rclcpp_components_register_node(${PROJECT_NAME}
+ PLUGIN "image_projection_based_fusion::SegmentPointCloudFusionNode"
+ EXECUTABLE segmentation_pointcloud_fusion_node
+)
+
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "image_projection_based_fusion::RoiPointCloudFusionNode"
EXECUTABLE roi_pointcloud_fusion_node
diff --git a/perception/image_projection_based_fusion/config/segmentation_pointcloud_fusion.param.yaml b/perception/image_projection_based_fusion/config/segmentation_pointcloud_fusion.param.yaml
new file mode 100644
index 0000000000000..914ad13519807
--- /dev/null
+++ b/perception/image_projection_based_fusion/config/segmentation_pointcloud_fusion.param.yaml
@@ -0,0 +1,30 @@
+/**:
+ ros__parameters:
+ # if the semantic label is applied for pointcloud filtering
+ filter_semantic_label_target:
+ [
+ true, # road
+ true, # sidewalk
+ true, # building
+ true, # wall
+ true, # fence
+ true, # pole
+ true, # traffic_light
+ true, # traffic_sign
+ true, # vegetation
+ true, # terrain
+ true, # sky
+ false, # person
+ false, # ride
+ false, # car
+ false, # truck
+ false, # bus
+ false, # train
+ false, # motorcycle
+ false, # bicycle
+ false, # others
+ ]
+ # the maximum distance of pointcloud to be applied filter,
+ # this is selected based on semantic segmentation model accuracy,
+ # calibration accuracy and unknown reaction distance
+ filter_distance_threshold: 60.0
diff --git a/perception/image_projection_based_fusion/docs/segmentation-pointcloud-fusion.md b/perception/image_projection_based_fusion/docs/segmentation-pointcloud-fusion.md
new file mode 100644
index 0000000000000..77188aafb3b22
--- /dev/null
+++ b/perception/image_projection_based_fusion/docs/segmentation-pointcloud-fusion.md
@@ -0,0 +1,87 @@
+# segmentation_pointcloud_fusion
+
+## Purpose
+
+The node `segmentation_pointcloud_fusion` is a package for filtering pointcloud that are belong to less interesting region which is defined by semantic or instance segmentation by 2D image segmentation model.
+
+## Inner-workings / Algorithms
+
+- The pointclouds are projected onto the semantic/instance segmentation mask image which is the output from 2D segmentation neural network.
+- The pointclouds are belong to segment such as road, sidewalk, building, vegetation, sky ... are considered as less important points for autonomous driving and could be removed.
+
+![segmentation_pointcloud_fusion_image](./images/segmentation_pointcloud_fusion.png)
+
+## Inputs / Outputs
+
+### Input
+
+| Name | Type | Description |
+| ------------------------ | ----------------------------------- | --------------------------------------------------------- |
+| `input` | `sensor_msgs::msg::PointCloud2` | input pointcloud |
+| `input/camera_info[0-7]` | `sensor_msgs::msg::CameraInfo` | camera information to project 3d points onto image planes |
+| `input/rois[0-7]` | `tier4_perception_msgs::msg::Image` | semantic segmentation mask image |
+| `input/image_raw[0-7]` | `sensor_msgs::msg::Image` | images for visualization |
+
+### Output
+
+| Name | Type | Description |
+| -------- | ------------------------------- | -------------------------- |
+| `output` | `sensor_msgs::msg::PointCloud2` | output filtered pointcloud |
+
+## Parameters
+
+### Core Parameters
+
+| Name | Type | Description |
+| ------------- | ---- | ------------------------ |
+| `rois_number` | int | the number of input rois |
+
+## Assumptions / Known limits
+
+
+
+## (Optional) Error detection and handling
+
+
+
+## (Optional) Performance characterization
+
+
+
+## (Optional) References/External links
+
+
+
+## (Optional) Future extensions / Unimplemented parts
+
+
diff --git a/perception/image_projection_based_fusion/include/image_projection_based_fusion/fusion_node.hpp b/perception/image_projection_based_fusion/include/image_projection_based_fusion/fusion_node.hpp
index 9572e62e0e0aa..fe8acb6746dba 100644
--- a/perception/image_projection_based_fusion/include/image_projection_based_fusion/fusion_node.hpp
+++ b/perception/image_projection_based_fusion/include/image_projection_based_fusion/fusion_node.hpp
@@ -22,6 +22,7 @@
#include
#include
+#include
#include
#include
@@ -49,13 +50,14 @@ namespace image_projection_based_fusion
{
using autoware_auto_perception_msgs::msg::DetectedObject;
using autoware_auto_perception_msgs::msg::DetectedObjects;
+using sensor_msgs::msg::CameraInfo;
+using sensor_msgs::msg::Image;
using sensor_msgs::msg::PointCloud2;
using tier4_perception_msgs::msg::DetectedObjectsWithFeature;
using tier4_perception_msgs::msg::DetectedObjectWithFeature;
using PointCloud = pcl::PointCloud;
using autoware_auto_perception_msgs::msg::ObjectClassification;
-
-template
+template
class FusionNode : public rclcpp::Node
{
public:
@@ -78,12 +80,12 @@ class FusionNode : public rclcpp::Node
virtual void subCallback(const typename Msg::ConstSharedPtr input_msg);
// callback for roi subscription
+
virtual void roiCallback(
- const DetectedObjectsWithFeature::ConstSharedPtr input_roi_msg, const std::size_t roi_i);
+ const typename Msg2D::ConstSharedPtr input_roi_msg, const std::size_t roi_i);
virtual void fuseOnSingleImage(
- const Msg & input_msg, const std::size_t image_id,
- const DetectedObjectsWithFeature & input_roi_msg,
+ const Msg & input_msg, const std::size_t image_id, const Msg2D & input_roi_msg,
const sensor_msgs::msg::CameraInfo & camera_info, Msg & output_msg) = 0;
// set args if you need
@@ -111,7 +113,7 @@ class FusionNode : public rclcpp::Node
/** \brief A vector of subscriber. */
typename rclcpp::Subscription::SharedPtr sub_;
- std::vector::SharedPtr> rois_subs_;
+ std::vector::SharedPtr> rois_subs_;
// offsets between cameras and the lidars
std::vector input_offset_ms_;
@@ -120,7 +122,7 @@ class FusionNode : public rclcpp::Node
std::vector is_fused_;
std::pair
cached_msg_; // first element is the timestamp in nanoseconds, second element is the message
- std::vector> cached_roi_msgs_;
+ std::vector> cached_roi_msgs_;
std::mutex mutex_cached_msgs_;
// output publisher
diff --git a/perception/image_projection_based_fusion/include/image_projection_based_fusion/pointpainting_fusion/node.hpp b/perception/image_projection_based_fusion/include/image_projection_based_fusion/pointpainting_fusion/node.hpp
index d7de10fed068f..78ae152141a00 100644
--- a/perception/image_projection_based_fusion/include/image_projection_based_fusion/pointpainting_fusion/node.hpp
+++ b/perception/image_projection_based_fusion/include/image_projection_based_fusion/pointpainting_fusion/node.hpp
@@ -33,7 +33,8 @@ namespace image_projection_based_fusion
{
using Label = autoware_auto_perception_msgs::msg::ObjectClassification;
-class PointPaintingFusionNode : public FusionNode
+class PointPaintingFusionNode
+: public FusionNode
{
public:
explicit PointPaintingFusionNode(const rclcpp::NodeOptions & options);
diff --git a/perception/image_projection_based_fusion/include/image_projection_based_fusion/roi_cluster_fusion/node.hpp b/perception/image_projection_based_fusion/include/image_projection_based_fusion/roi_cluster_fusion/node.hpp
index e54710ad477da..b9471f2f3b78e 100644
--- a/perception/image_projection_based_fusion/include/image_projection_based_fusion/roi_cluster_fusion/node.hpp
+++ b/perception/image_projection_based_fusion/include/image_projection_based_fusion/roi_cluster_fusion/node.hpp
@@ -25,7 +25,8 @@ namespace image_projection_based_fusion
const std::map IOU_MODE_MAP{{"iou", 0}, {"iou_x", 1}, {"iou_y", 2}};
class RoiClusterFusionNode
-: public FusionNode
+: public FusionNode<
+ DetectedObjectsWithFeature, DetectedObjectWithFeature, DetectedObjectsWithFeature>
{
public:
explicit RoiClusterFusionNode(const rclcpp::NodeOptions & options);
diff --git a/perception/image_projection_based_fusion/include/image_projection_based_fusion/roi_detected_object_fusion/node.hpp b/perception/image_projection_based_fusion/include/image_projection_based_fusion/roi_detected_object_fusion/node.hpp
index e11a62c060480..7d7132309fb91 100644
--- a/perception/image_projection_based_fusion/include/image_projection_based_fusion/roi_detected_object_fusion/node.hpp
+++ b/perception/image_projection_based_fusion/include/image_projection_based_fusion/roi_detected_object_fusion/node.hpp
@@ -29,7 +29,8 @@ namespace image_projection_based_fusion
using sensor_msgs::msg::RegionOfInterest;
-class RoiDetectedObjectFusionNode : public FusionNode
+class RoiDetectedObjectFusionNode
+: public FusionNode
{
public:
explicit RoiDetectedObjectFusionNode(const rclcpp::NodeOptions & options);
diff --git a/perception/image_projection_based_fusion/include/image_projection_based_fusion/roi_pointcloud_fusion/node.hpp b/perception/image_projection_based_fusion/include/image_projection_based_fusion/roi_pointcloud_fusion/node.hpp
index 2b4eb822a9edb..fe685baa0b6e2 100644
--- a/perception/image_projection_based_fusion/include/image_projection_based_fusion/roi_pointcloud_fusion/node.hpp
+++ b/perception/image_projection_based_fusion/include/image_projection_based_fusion/roi_pointcloud_fusion/node.hpp
@@ -22,7 +22,7 @@
namespace image_projection_based_fusion
{
class RoiPointCloudFusionNode
-: public FusionNode
+: public FusionNode
{
private:
int min_cluster_size_{1};
diff --git a/perception/image_projection_based_fusion/include/image_projection_based_fusion/segmentation_pointcloud_fusion/node.hpp b/perception/image_projection_based_fusion/include/image_projection_based_fusion/segmentation_pointcloud_fusion/node.hpp
new file mode 100644
index 0000000000000..4168c483469ab
--- /dev/null
+++ b/perception/image_projection_based_fusion/include/image_projection_based_fusion/segmentation_pointcloud_fusion/node.hpp
@@ -0,0 +1,54 @@
+// Copyright 2023 TIER IV, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef IMAGE_PROJECTION_BASED_FUSION__SEGMENTATION_POINTCLOUD_FUSION__NODE_HPP_
+#define IMAGE_PROJECTION_BASED_FUSION__SEGMENTATION_POINTCLOUD_FUSION__NODE_HPP_
+
+#include "image_projection_based_fusion/fusion_node.hpp"
+
+#include
+#include
+
+#if __has_include()
+#include
+#else
+#include
+#endif
+
+namespace image_projection_based_fusion
+{
+class SegmentPointCloudFusionNode : public FusionNode
+{
+private:
+ rclcpp::Publisher::SharedPtr pub_pointcloud_ptr_;
+ std::vector filter_semantic_label_target_;
+ float filter_distance_threshold_;
+ /* data */
+public:
+ explicit SegmentPointCloudFusionNode(const rclcpp::NodeOptions & options);
+
+protected:
+ void preprocess(PointCloud2 & pointcloud_msg) override;
+
+ void postprocess(PointCloud2 & pointcloud_msg) override;
+
+ void fuseOnSingleImage(
+ const PointCloud2 & input_pointcloud_msg, const std::size_t image_id, const Image & input_mask,
+ const CameraInfo & camera_info, PointCloud2 & output_pointcloud_msg) override;
+
+ bool out_of_scope(const PointCloud2 & filtered_cloud);
+};
+
+} // namespace image_projection_based_fusion
+#endif // IMAGE_PROJECTION_BASED_FUSION__SEGMENTATION_POINTCLOUD_FUSION__NODE_HPP_
diff --git a/perception/image_projection_based_fusion/launch/segmentation_pointcloud_fusion.launch.xml b/perception/image_projection_based_fusion/launch/segmentation_pointcloud_fusion.launch.xml
new file mode 100644
index 0000000000000..96bf47594bfe8
--- /dev/null
+++ b/perception/image_projection_based_fusion/launch/segmentation_pointcloud_fusion.launch.xml
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/perception/image_projection_based_fusion/src/fusion_node.cpp b/perception/image_projection_based_fusion/src/fusion_node.cpp
index 4abd92d7fb063..6bced39bc61ef 100644
--- a/perception/image_projection_based_fusion/src/fusion_node.cpp
+++ b/perception/image_projection_based_fusion/src/fusion_node.cpp
@@ -40,8 +40,8 @@ static double processing_time_ms = 0;
namespace image_projection_based_fusion
{
-template
-FusionNode::FusionNode(
+template
+FusionNode::FusionNode(
const std::string & node_name, const rclcpp::NodeOptions & options)
: Node(node_name, options), tf_buffer_(this->get_clock()), tf_listener_(tf_buffer_)
{
@@ -81,7 +81,7 @@ FusionNode::FusionNode(
}
input_offset_ms_ = declare_parameter>("input_offset_ms");
- if (!input_offset_ms_.empty() && rois_number_ != input_offset_ms_.size()) {
+ if (!input_offset_ms_.empty() && rois_number_ > input_offset_ms_.size()) {
throw std::runtime_error("The number of offsets does not match the number of topics.");
}
@@ -99,9 +99,9 @@ FusionNode::FusionNode(
cached_roi_msgs_.resize(rois_number_);
is_fused_.resize(rois_number_, false);
for (std::size_t roi_i = 0; roi_i < rois_number_; ++roi_i) {
- std::function roi_callback =
+ std::function roi_callback =
std::bind(&FusionNode::roiCallback, this, std::placeholders::_1, roi_i);
- rois_subs_.at(roi_i) = this->create_subscription(
+ rois_subs_.at(roi_i) = this->create_subscription(
input_rois_topics_.at(roi_i), rclcpp::QoS{1}.best_effort(), roi_callback);
}
@@ -147,22 +147,22 @@ FusionNode::FusionNode(
filter_scope_maxz_ = declare_parameter("filter_scope_max_z");
}
-template
-void FusionNode::cameraInfoCallback(
+template
+void FusionNode::cameraInfoCallback(
const sensor_msgs::msg::CameraInfo::ConstSharedPtr input_camera_info_msg,
const std::size_t camera_id)
{
camera_info_map_[camera_id] = *input_camera_info_msg;
}
-template
-void FusionNode::preprocess(Msg & ouput_msg __attribute__((unused)))
+template
+void FusionNode::preprocess(Msg & ouput_msg __attribute__((unused)))
{
// do nothing by default
}
-template
-void FusionNode::subCallback(const typename Msg::ConstSharedPtr input_msg)
+template
+void FusionNode::subCallback(const typename Msg::ConstSharedPtr input_msg)
{
if (cached_msg_.second != nullptr) {
stop_watch_ptr_->toc("processing_time", true);
@@ -285,9 +285,9 @@ void FusionNode::subCallback(const typename Msg::ConstSharedPtr input_
}
}
-template
-void FusionNode::roiCallback(
- const DetectedObjectsWithFeature::ConstSharedPtr input_roi_msg, const std::size_t roi_i)
+template
+void FusionNode::roiCallback(
+ const typename Msg2D::ConstSharedPtr input_roi_msg, const std::size_t roi_i)
{
stop_watch_ptr_->toc("processing_time", true);
@@ -350,14 +350,14 @@ void FusionNode::roiCallback(
(cached_roi_msgs_.at(roi_i))[timestamp_nsec] = input_roi_msg;
}
-template
-void FusionNode::postprocess(Msg & output_msg __attribute__((unused)))
+template
+void FusionNode::postprocess(Msg & output_msg __attribute__((unused)))
{
// do nothing by default
}
-template
-void FusionNode::timer_callback()
+template
+void FusionNode::timer_callback()
{
using std::chrono_literals::operator""ms;
timer_->cancel();
@@ -395,8 +395,8 @@ void FusionNode::timer_callback()
}
}
-template
-void FusionNode::setPeriod(const int64_t new_period)
+template
+void FusionNode::setPeriod(const int64_t new_period)
{
if (!timer_) {
return;
@@ -412,8 +412,8 @@ void FusionNode::setPeriod(const int64_t new_period)
}
}
-template
-void FusionNode::publish(const Msg & output_msg)
+template
+void FusionNode::publish(const Msg & output_msg)
{
if (pub_ptr_->get_subscription_count() < 1) {
return;
@@ -421,8 +421,10 @@ void FusionNode::publish(const Msg & output_msg)
pub_ptr_->publish(output_msg);
}
-template class FusionNode;
-template class FusionNode;
-template class FusionNode;
-template class FusionNode;
+template class FusionNode;
+template class FusionNode<
+ DetectedObjectsWithFeature, DetectedObjectWithFeature, DetectedObjectsWithFeature>;
+template class FusionNode;
+template class FusionNode;
+template class FusionNode;
} // namespace image_projection_based_fusion
diff --git a/perception/image_projection_based_fusion/src/pointpainting_fusion/node.cpp b/perception/image_projection_based_fusion/src/pointpainting_fusion/node.cpp
index 76b561f677c0f..14783a46ba8b4 100644
--- a/perception/image_projection_based_fusion/src/pointpainting_fusion/node.cpp
+++ b/perception/image_projection_based_fusion/src/pointpainting_fusion/node.cpp
@@ -93,7 +93,8 @@ inline bool isUnknown(int label2d)
}
PointPaintingFusionNode::PointPaintingFusionNode(const rclcpp::NodeOptions & options)
-: FusionNode("pointpainting_fusion", options)
+: FusionNode(
+ "pointpainting_fusion", options)
{
omp_num_threads_ = this->declare_parameter("omp_params.num_threads");
const float score_threshold =
diff --git a/perception/image_projection_based_fusion/src/roi_cluster_fusion/node.cpp b/perception/image_projection_based_fusion/src/roi_cluster_fusion/node.cpp
index 492f832e30e8b..1c064e4d0f060 100644
--- a/perception/image_projection_based_fusion/src/roi_cluster_fusion/node.cpp
+++ b/perception/image_projection_based_fusion/src/roi_cluster_fusion/node.cpp
@@ -34,7 +34,8 @@ namespace image_projection_based_fusion
{
RoiClusterFusionNode::RoiClusterFusionNode(const rclcpp::NodeOptions & options)
-: FusionNode("roi_cluster_fusion", options)
+: FusionNode(
+ "roi_cluster_fusion", options)
{
trust_object_iou_mode_ = declare_parameter("trust_object_iou_mode");
non_trust_object_iou_mode_ = declare_parameter("non_trust_object_iou_mode");
diff --git a/perception/image_projection_based_fusion/src/roi_detected_object_fusion/node.cpp b/perception/image_projection_based_fusion/src/roi_detected_object_fusion/node.cpp
index 333ec7d7ed206..19defc0a1cab0 100644
--- a/perception/image_projection_based_fusion/src/roi_detected_object_fusion/node.cpp
+++ b/perception/image_projection_based_fusion/src/roi_detected_object_fusion/node.cpp
@@ -25,7 +25,8 @@ namespace image_projection_based_fusion
{
RoiDetectedObjectFusionNode::RoiDetectedObjectFusionNode(const rclcpp::NodeOptions & options)
-: FusionNode("roi_detected_object_fusion", options)
+: FusionNode(
+ "roi_detected_object_fusion", options)
{
fusion_params_.passthrough_lower_bound_probability_thresholds =
declare_parameter>("passthrough_lower_bound_probability_thresholds");
diff --git a/perception/image_projection_based_fusion/src/roi_pointcloud_fusion/node.cpp b/perception/image_projection_based_fusion/src/roi_pointcloud_fusion/node.cpp
index 233e568ebee0b..421aa3a453451 100644
--- a/perception/image_projection_based_fusion/src/roi_pointcloud_fusion/node.cpp
+++ b/perception/image_projection_based_fusion/src/roi_pointcloud_fusion/node.cpp
@@ -30,7 +30,8 @@
namespace image_projection_based_fusion
{
RoiPointCloudFusionNode::RoiPointCloudFusionNode(const rclcpp::NodeOptions & options)
-: FusionNode("roi_pointcloud_fusion", options)
+: FusionNode(
+ "roi_pointcloud_fusion", options)
{
fuse_unknown_only_ = declare_parameter("fuse_unknown_only");
min_cluster_size_ = declare_parameter("min_cluster_size");
diff --git a/perception/image_projection_based_fusion/src/segmentation_pointcloud_fusion/node.cpp b/perception/image_projection_based_fusion/src/segmentation_pointcloud_fusion/node.cpp
new file mode 100644
index 0000000000000..1c9c865b8d21e
--- /dev/null
+++ b/perception/image_projection_based_fusion/src/segmentation_pointcloud_fusion/node.cpp
@@ -0,0 +1,139 @@
+// Copyright 2023 TIER IV, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "image_projection_based_fusion/segmentation_pointcloud_fusion/node.hpp"
+
+#include "image_projection_based_fusion/utils/geometry.hpp"
+#include "image_projection_based_fusion/utils/utils.hpp"
+
+#ifdef ROS_DISTRO_GALACTIC
+#include
+#include
+#else
+#include
+#include
+#endif
+
+namespace image_projection_based_fusion
+{
+SegmentPointCloudFusionNode::SegmentPointCloudFusionNode(const rclcpp::NodeOptions & options)
+: FusionNode("segmentation_pointcloud_fusion", options)
+{
+ filter_distance_threshold_ = declare_parameter("filter_distance_threshold");
+ filter_semantic_label_target_ =
+ declare_parameter>("filter_semantic_label_target");
+}
+
+void SegmentPointCloudFusionNode::preprocess(__attribute__((unused)) PointCloud2 & pointcloud_msg)
+{
+ return;
+}
+
+void SegmentPointCloudFusionNode::postprocess(__attribute__((unused)) PointCloud2 & pointcloud_msg)
+{
+ return;
+}
+void SegmentPointCloudFusionNode::fuseOnSingleImage(
+ const PointCloud2 & input_pointcloud_msg, __attribute__((unused)) const std::size_t image_id,
+ [[maybe_unused]] const Image & input_mask, __attribute__((unused)) const CameraInfo & camera_info,
+ __attribute__((unused)) PointCloud2 & output_pointcloud_msg)
+{
+ if (input_pointcloud_msg.data.empty()) {
+ return;
+ }
+ cv_bridge::CvImagePtr in_image_ptr;
+ try {
+ in_image_ptr = cv_bridge::toCvCopy(
+ std::make_shared(input_mask), input_mask.encoding);
+ } catch (const std::exception & e) {
+ RCLCPP_ERROR(this->get_logger(), "cv_bridge exception:%s", e.what());
+ return;
+ }
+
+ cv::Mat mask = in_image_ptr->image;
+ if (mask.cols == 0 || mask.rows == 0) {
+ return;
+ }
+ Eigen::Matrix4d projection;
+ projection << camera_info.p.at(0), camera_info.p.at(1), camera_info.p.at(2), camera_info.p.at(3),
+ camera_info.p.at(4), camera_info.p.at(5), camera_info.p.at(6), camera_info.p.at(7),
+ camera_info.p.at(8), camera_info.p.at(9), camera_info.p.at(10), camera_info.p.at(11), 0.0, 0.0,
+ 0.0, 1.0;
+ geometry_msgs::msg::TransformStamped transform_stamped;
+ // transform pointcloud from frame id to camera optical frame id
+ {
+ const auto transform_stamped_optional = getTransformStamped(
+ tf_buffer_, input_mask.header.frame_id, input_pointcloud_msg.header.frame_id,
+ input_pointcloud_msg.header.stamp);
+ if (!transform_stamped_optional) {
+ return;
+ }
+ transform_stamped = transform_stamped_optional.value();
+ }
+
+ PointCloud2 transformed_cloud;
+ tf2::doTransform(input_pointcloud_msg, transformed_cloud, transform_stamped);
+
+ PointCloud output_cloud;
+
+ for (sensor_msgs::PointCloud2ConstIterator iter_x(transformed_cloud, "x"),
+ iter_y(transformed_cloud, "y"), iter_z(transformed_cloud, "z"),
+ iter_orig_x(input_pointcloud_msg, "x"), iter_orig_y(input_pointcloud_msg, "y"),
+ iter_orig_z(input_pointcloud_msg, "z");
+ iter_x != iter_x.end();
+ ++iter_x, ++iter_y, ++iter_z, ++iter_orig_x, ++iter_orig_y, ++iter_orig_z) {
+ // skip filtering pointcloud behind the camera or too far from camera
+ if (*iter_z <= 0.0 || *iter_z > filter_distance_threshold_) {
+ output_cloud.push_back(pcl::PointXYZ(*iter_orig_x, *iter_orig_y, *iter_orig_z));
+ continue;
+ }
+
+ Eigen::Vector4d projected_point = projection * Eigen::Vector4d(*iter_x, *iter_y, *iter_z, 1.0);
+ Eigen::Vector2d normalized_projected_point = Eigen::Vector2d(
+ projected_point.x() / projected_point.z(), projected_point.y() / projected_point.z());
+
+ bool is_inside_image =
+ normalized_projected_point.x() > 0 && normalized_projected_point.x() < camera_info.width &&
+ normalized_projected_point.y() > 0 && normalized_projected_point.y() < camera_info.height;
+ if (!is_inside_image) {
+ output_cloud.push_back(pcl::PointXYZ(*iter_orig_x, *iter_orig_y, *iter_orig_z));
+ continue;
+ }
+
+ // skip filtering pointcloud where semantic id out of the defined list
+ uint8_t semantic_id = mask.at(
+ static_cast(normalized_projected_point.y()),
+ static_cast(normalized_projected_point.x()));
+ if (static_cast(semantic_id) >= filter_semantic_label_target_.size()) {
+ output_cloud.push_back(pcl::PointXYZ(*iter_orig_x, *iter_orig_y, *iter_orig_z));
+ continue;
+ }
+ if (!filter_semantic_label_target_.at(semantic_id)) {
+ output_cloud.push_back(pcl::PointXYZ(*iter_orig_x, *iter_orig_y, *iter_orig_z));
+ }
+ }
+
+ pcl::toROSMsg(output_cloud, output_pointcloud_msg);
+ output_pointcloud_msg.header = input_pointcloud_msg.header;
+}
+
+bool SegmentPointCloudFusionNode::out_of_scope(__attribute__((unused))
+ const PointCloud2 & filtered_cloud)
+{
+ return false;
+}
+} // namespace image_projection_based_fusion
+
+#include
+RCLCPP_COMPONENTS_REGISTER_NODE(image_projection_based_fusion::SegmentPointCloudFusionNode)
diff --git a/perception/map_based_prediction/src/map_based_prediction_node.cpp b/perception/map_based_prediction/src/map_based_prediction_node.cpp
index 0091fc6bc38cb..75c1d61e0a19c 100644
--- a/perception/map_based_prediction/src/map_based_prediction_node.cpp
+++ b/perception/map_based_prediction/src/map_based_prediction_node.cpp
@@ -415,17 +415,21 @@ bool withinRoadLanelet(
}
boost::optional isReachableCrosswalkEdgePoints(
- const TrackedObject & object, const CrosswalkEdgePoints & edge_points,
- const lanelet::LaneletMapPtr & lanelet_map_ptr, const double time_horizon,
- const double min_object_vel)
+ const TrackedObject & object, const lanelet::ConstLanelet & target_crosswalk,
+ const CrosswalkEdgePoints & edge_points, const lanelet::LaneletMapPtr & lanelet_map_ptr,
+ const double time_horizon, const double min_object_vel)
{
using Point = boost::geometry::model::d2::point_xy;
- using Line = boost::geometry::model::linestring;
const auto & obj_pos = object.kinematics.pose_with_covariance.pose.position;
const auto & obj_vel = object.kinematics.twist_with_covariance.twist.linear;
const auto yaw = tier4_autoware_utils::getRPY(object.kinematics.pose_with_covariance.pose).z;
+ lanelet::BasicPoint2d obj_pos_as_lanelet(obj_pos.x, obj_pos.y);
+ if (boost::geometry::within(obj_pos_as_lanelet, target_crosswalk.polygon2d().basicPolygon())) {
+ return {};
+ }
+
const auto & p1 = edge_points.front_center_point;
const auto & p2 = edge_points.back_center_point;
@@ -442,62 +446,66 @@ boost::optional isReachableCrosswalkEdgePoints(
const auto estimated_velocity = std::hypot(obj_vel.x, obj_vel.y);
const auto is_stop_object = estimated_velocity < stop_velocity_th;
const auto velocity = std::max(min_object_vel, estimated_velocity);
-
- lanelet::BasicPoint2d search_point(obj_pos.x, obj_pos.y);
- // nearest lanelet
const auto surrounding_lanelets = lanelet::geometry::findNearest(
- lanelet_map_ptr->laneletLayer, search_point, time_horizon * velocity);
+ lanelet_map_ptr->laneletLayer, obj_pos_as_lanelet, time_horizon * velocity);
- bool first_intersect_load = false;
- bool second_intersect_load = false;
- std::vector intersects_first;
- std::vector intersects_second;
- for (const auto & lanelet : surrounding_lanelets) {
- if (withinLanelet(object, lanelet.second)) {
- return {};
- }
+ const auto isAcrossAnyRoad = [&surrounding_lanelets](const Point & p_src, const Point & p_dst) {
+ const auto withinAnyCrosswalk = [&surrounding_lanelets](const Point & p) {
+ for (const auto & lanelet : surrounding_lanelets) {
+ const lanelet::Attribute attr = lanelet.second.attribute(lanelet::AttributeName::Subtype);
+ if (
+ (attr.value() == lanelet::AttributeValueString::Crosswalk ||
+ attr.value() == lanelet::AttributeValueString::Walkway) &&
+ boost::geometry::within(p, lanelet.second.polygon2d().basicPolygon())) {
+ return true;
+ }
+ }
+ return false;
+ };
- lanelet::Attribute attr = lanelet.second.attribute(lanelet::AttributeName::Subtype);
- if (attr.value() != "road") {
- continue;
- }
+ const auto isExist = [](const Point & p, const std::vector & points) {
+ for (const auto & existingPoint : points) {
+ if (boost::geometry::distance(p, existingPoint) < 1e-1) {
+ return true;
+ }
+ }
+ return false;
+ };
- {
- const Line object_to_entry_point{
- {obj_pos.x, obj_pos.y}, {ret.front_center_point.x(), ret.front_center_point.y()}};
- std::vector tmp_intersects;
- boost::geometry::intersection(
- object_to_entry_point, lanelet.second.polygon2d().basicPolygon(), tmp_intersects);
- for (const auto & p : tmp_intersects) {
- intersects_first.push_back(p);
+ std::vector points_of_intersect;
+ const boost::geometry::model::linestring line{p_src, p_dst};
+ for (const auto & lanelet : surrounding_lanelets) {
+ const lanelet::Attribute attr = lanelet.second.attribute(lanelet::AttributeName::Subtype);
+ if (attr.value() != lanelet::AttributeValueString::Road) {
+ continue;
}
- }
- {
- const Line object_to_entry_point{
- {obj_pos.x, obj_pos.y}, {ret.back_center_point.x(), ret.back_center_point.y()}};
std::vector tmp_intersects;
boost::geometry::intersection(
- object_to_entry_point, lanelet.second.polygon2d().basicPolygon(), tmp_intersects);
+ line, lanelet.second.polygon2d().basicPolygon(), tmp_intersects);
for (const auto & p : tmp_intersects) {
- intersects_second.push_back(p);
+ if (isExist(p, points_of_intersect) || withinAnyCrosswalk(p)) {
+ continue;
+ }
+ points_of_intersect.push_back(p);
+ if (points_of_intersect.size() >= 2) {
+ return true;
+ }
}
}
- }
-
- if (1 < intersects_first.size()) {
- first_intersect_load = true;
- }
+ return false;
+ };
- if (1 < intersects_second.size()) {
- second_intersect_load = true;
- }
+ const bool first_intersects_road = isAcrossAnyRoad(
+ {obj_pos.x, obj_pos.y}, {ret.front_center_point.x(), ret.front_center_point.y()});
+ const bool second_intersects_road =
+ isAcrossAnyRoad({obj_pos.x, obj_pos.y}, {ret.back_center_point.x(), ret.back_center_point.y()});
- if (first_intersect_load && second_intersect_load) {
+ if (first_intersects_road && second_intersects_road) {
return {};
}
- if (first_intersect_load && !second_intersect_load) {
+ if (first_intersects_road && !second_intersects_road) {
ret.swap();
}
@@ -1197,48 +1205,45 @@ PredictedObject MapBasedPredictionNode::getPredictedObjectAsCrosswalkUser(
predicted_object.kinematics.predicted_paths.push_back(predicted_path);
}
}
+ }
+ // try to find the edge points for all crosswalks and generate path to the crosswalk edge
+ for (const auto & crosswalk : crosswalks_) {
+ const auto edge_points = getCrosswalkEdgePoints(crosswalk);
+
+ const auto reachable_first = hasPotentialToReach(
+ object, edge_points.front_center_point, edge_points.front_right_point,
+ edge_points.front_left_point, prediction_time_horizon_, min_crosswalk_user_velocity_,
+ max_crosswalk_user_delta_yaw_threshold_for_lanelet_);
+ const auto reachable_second = hasPotentialToReach(
+ object, edge_points.back_center_point, edge_points.back_right_point,
+ edge_points.back_left_point, prediction_time_horizon_, min_crosswalk_user_velocity_,
+ max_crosswalk_user_delta_yaw_threshold_for_lanelet_);
+
+ if (!reachable_first && !reachable_second) {
+ continue;
+ }
- // If the object is not crossing the crosswalk, not in the road lanelets, try to find the edge
- // points for all crosswalks and generate path to the crosswalk edge
- } else {
- for (const auto & crosswalk : crosswalks_) {
- const auto edge_points = getCrosswalkEdgePoints(crosswalk);
-
- const auto reachable_first = hasPotentialToReach(
- object, edge_points.front_center_point, edge_points.front_right_point,
- edge_points.front_left_point, prediction_time_horizon_, min_crosswalk_user_velocity_,
- max_crosswalk_user_delta_yaw_threshold_for_lanelet_);
- const auto reachable_second = hasPotentialToReach(
- object, edge_points.back_center_point, edge_points.back_right_point,
- edge_points.back_left_point, prediction_time_horizon_, min_crosswalk_user_velocity_,
- max_crosswalk_user_delta_yaw_threshold_for_lanelet_);
-
- if (!reachable_first && !reachable_second) {
- continue;
- }
-
- const auto reachable_crosswalk = isReachableCrosswalkEdgePoints(
- object, edge_points, lanelet_map_ptr_, prediction_time_horizon_,
- min_crosswalk_user_velocity_);
-
- if (!reachable_crosswalk) {
- continue;
- }
+ const auto reachable_crosswalk = isReachableCrosswalkEdgePoints(
+ object, crosswalk, edge_points, lanelet_map_ptr_, prediction_time_horizon_,
+ min_crosswalk_user_velocity_);
- PredictedPath predicted_path =
- path_generator_->generatePathForCrosswalkUser(object, reachable_crosswalk.get());
- predicted_path.confidence = 1.0;
+ if (!reachable_crosswalk) {
+ continue;
+ }
- if (predicted_path.path.empty()) {
- continue;
- }
- // If the predicted path to the crosswalk is crossing the fence, don't use it
- if (doesPathCrossAnyFence(predicted_path)) {
- continue;
- }
+ PredictedPath predicted_path =
+ path_generator_->generatePathForCrosswalkUser(object, reachable_crosswalk.get());
+ predicted_path.confidence = 1.0;
- predicted_object.kinematics.predicted_paths.push_back(predicted_path);
+ if (predicted_path.path.empty()) {
+ continue;
}
+ // If the predicted path to the crosswalk is crossing the fence, don't use it
+ if (doesPathCrossAnyFence(predicted_path)) {
+ continue;
+ }
+
+ predicted_object.kinematics.predicted_paths.push_back(predicted_path);
}
const auto n_path = predicted_object.kinematics.predicted_paths.size();
diff --git a/perception/multi_object_tracker/package.xml b/perception/multi_object_tracker/package.xml
index 3d2e4662f7ea5..763bd12fab79e 100644
--- a/perception/multi_object_tracker/package.xml
+++ b/perception/multi_object_tracker/package.xml
@@ -13,6 +13,7 @@
eigen3_cmake_module
autoware_auto_perception_msgs
+ diagnostic_updater
eigen
kalman_filter
libgoogle-glog-dev
diff --git a/perception/probabilistic_occupancy_grid_map/CMakeLists.txt b/perception/probabilistic_occupancy_grid_map/CMakeLists.txt
index 035845772ce53..928532f928e38 100644
--- a/perception/probabilistic_occupancy_grid_map/CMakeLists.txt
+++ b/perception/probabilistic_occupancy_grid_map/CMakeLists.txt
@@ -55,6 +55,24 @@ rclcpp_components_register_node(laserscan_based_occupancy_grid_map
EXECUTABLE laserscan_based_occupancy_grid_map_node
)
+# GridMapFusionNode
+ament_auto_add_library(synchronized_grid_map_fusion SHARED
+ src/fusion/synchronized_grid_map_fusion_node.cpp
+ src/fusion/single_frame_fusion_policy.cpp
+ src/pointcloud_based_occupancy_grid_map/occupancy_grid_map_fixed.cpp
+ src/updater/occupancy_grid_map_log_odds_bayes_filter_updater.cpp
+ src/utils/utils.cpp
+)
+
+target_link_libraries(synchronized_grid_map_fusion
+ ${PCL_LIBRARIES}
+)
+
+rclcpp_components_register_node(synchronized_grid_map_fusion
+ PLUGIN "synchronized_grid_map_fusion::GridMapFusionNode"
+ EXECUTABLE synchronized_grid_map_fusion_node
+)
+
ament_auto_package(
INSTALL_TO_SHARE
launch
@@ -66,13 +84,22 @@ if(BUILD_TESTING)
# launch_testing
find_package(launch_testing_ament_cmake REQUIRED)
add_launch_test(test/test_pointcloud_based_method.py)
+ add_launch_test(test/test_synchronized_grid_map_fusion_node.py)
# gtest
ament_add_gtest(test_utils
test/test_utils.cpp
)
+ ament_add_gtest(costmap_unit_tests
+ test/cost_value_test.cpp)
+ ament_add_gtest(fusion_policy_unit_tests
+ test/fusion_policy_test.cpp
+ src/fusion/single_frame_fusion_policy.cpp
+ )
target_link_libraries(test_utils
${PCL_LIBRARIES}
${PROJECT_NAME}_common
)
+ target_include_directories(costmap_unit_tests PRIVATE "include")
+ target_include_directories(fusion_policy_unit_tests PRIVATE "include")
endif()
diff --git a/perception/probabilistic_occupancy_grid_map/README.md b/perception/probabilistic_occupancy_grid_map/README.md
index 962bcdc6f154f..084c55d80d629 100644
--- a/perception/probabilistic_occupancy_grid_map/README.md
+++ b/perception/probabilistic_occupancy_grid_map/README.md
@@ -9,6 +9,7 @@ This package outputs the probability of having an obstacle as occupancy grid map
- [Pointcloud based occupancy grid map](pointcloud-based-occupancy-grid-map.md)
- [Laserscan based occupancy grid map](laserscan-based-occupancy-grid-map.md)
+- [Grid map fusion](synchronized_grid_map_fusion.md)
## Settings
@@ -70,3 +71,19 @@ Additional argument is shown below:
| `container_name` | `occupancy_grid_map_container` | |
| `input_obstacle_pointcloud` | `false` | only for laserscan based method. If true, the node subscribe obstacle pointcloud |
| `input_obstacle_and_raw_pointcloud` | `true` | only for laserscan based method. If true, the node subscribe both obstacle and raw pointcloud |
+
+### Test
+
+This package provides unit tests using `gtest`.
+You can run the test by the following command.
+
+```bash
+colcon test --packages-select probabilistic_occupancy_grid_map --event-handlers console_direct+
+```
+
+Test contains the following.
+
+- Unit test for cost value conversion function
+- Unit test for utility functions
+- Unit test for occupancy grid map fusion functions
+- Input/Output test for pointcloud based occupancy grid map
diff --git a/perception/probabilistic_occupancy_grid_map/config/synchronized_grid_map_fusion_node.param.yaml b/perception/probabilistic_occupancy_grid_map/config/synchronized_grid_map_fusion_node.param.yaml
new file mode 100644
index 0000000000000..f8a2dc2fbc7de
--- /dev/null
+++ b/perception/probabilistic_occupancy_grid_map/config/synchronized_grid_map_fusion_node.param.yaml
@@ -0,0 +1,20 @@
+/**:
+ ros__parameters:
+ # 1. fusion parameters
+ fusion_input_ogm_topics: ["topic1", "topic2"]
+ input_ogm_reliabilities: [0.8, 0.2]
+ fusion_method: "overwrite" # choose from ["overwrite", "log-odds", "dempster-shafer"]
+
+ # 2. synchronization settings
+ match_threshold_sec: 0.01 # 10ms
+ timeout_sec: 0.1 # 100ms
+ input_offset_sec: [0.0, 0.0] # no offset
+
+ # 3. settings for fused fusion map
+ # remember resolution and map size should be same with input maps
+ map_frame_: "map"
+ base_link_frame_: "base_link"
+ grid_map_origin_frame_: "base_link"
+ fusion_map_length_x: 100.0
+ fusion_map_length_y: 100.0
+ fusion_map_resolution: 0.5
diff --git a/perception/probabilistic_occupancy_grid_map/image/synchronized_grid_map_fusion.drawio.svg b/perception/probabilistic_occupancy_grid_map/image/synchronized_grid_map_fusion.drawio.svg
new file mode 100644
index 0000000000000..6bf5ed98e4edf
--- /dev/null
+++ b/perception/probabilistic_occupancy_grid_map/image/synchronized_grid_map_fusion.drawio.svg
@@ -0,0 +1,290 @@
+
diff --git a/perception/probabilistic_occupancy_grid_map/include/cost_value.hpp b/perception/probabilistic_occupancy_grid_map/include/cost_value.hpp
index e9667ccf65577..e0f18cedcdff1 100644
--- a/perception/probabilistic_occupancy_grid_map/include/cost_value.hpp
+++ b/perception/probabilistic_occupancy_grid_map/include/cost_value.hpp
@@ -59,19 +59,48 @@ static const unsigned char NO_INFORMATION = 128; // 0.5 * 255
static const unsigned char LETHAL_OBSTACLE = 255;
static const unsigned char FREE_SPACE = 0;
+static const unsigned char OCCUPIED_THRESHOLD = 180;
+static const unsigned char FREE_THRESHOLD = 50;
+
struct CostTranslationTable
{
CostTranslationTable()
{
for (int i = 0; i < 256; i++) {
- const auto value = static_cast(static_cast(i) * 100.f / 255.f);
- data[i] = std::max(std::min(value, static_cast(99)), static_cast(1));
+ const auto value =
+ static_cast(static_cast(i) * 100.f / 255.f); // 0-255 to 0-100
+ data[i] =
+ std::max(std::min(value, static_cast(99)), static_cast(1)); // 0-100 to 1-99
}
}
char operator[](unsigned char n) const { return data[n]; }
char data[256];
};
+struct InverseCostTranslationTable
+{
+ InverseCostTranslationTable()
+ {
+ // 0-100 to 0-255
+ for (int i = 0; i < 100; i++) {
+ data[i] = static_cast(i * 255 / 99);
+ }
+ }
+ unsigned char operator[](char n) const
+ {
+ if (n > 99) {
+ return data[99];
+ } else if (n < 1) {
+ return data[1];
+ } else {
+ const unsigned char u_n = static_cast(n);
+ return data[u_n];
+ }
+ }
+ unsigned char data[100];
+};
+
static const CostTranslationTable cost_translation_table;
+static const InverseCostTranslationTable inverse_cost_translation_table;
} // namespace occupancy_cost_value
#endif // COST_VALUE_HPP_
diff --git a/perception/probabilistic_occupancy_grid_map/include/fusion/single_frame_fusion_policy.hpp b/perception/probabilistic_occupancy_grid_map/include/fusion/single_frame_fusion_policy.hpp
new file mode 100644
index 0000000000000..13829b4910d96
--- /dev/null
+++ b/perception/probabilistic_occupancy_grid_map/include/fusion/single_frame_fusion_policy.hpp
@@ -0,0 +1,66 @@
+// Copyright 2023 TIER IV, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef FUSION__SINGLE_FRAME_FUSION_POLICY_HPP_
+#define FUSION__SINGLE_FRAME_FUSION_POLICY_HPP_
+
+#include "cost_value.hpp"
+
+#include
+#include
+#include
+#include
+
+/*min and max prob threshold to prevent log-odds to diverge*/
+#define EPSILON_PROB 0.03
+
+namespace fusion_policy
+{
+enum class FusionMethod { OVERWRITE, LOG_ODDS, DEMPSTER_SHAFER };
+
+unsigned char convertProbabilityToChar(const double & probability);
+double convertCharToProbability(const unsigned char & occupancy);
+std::vector convertProbabilityToChar(const std::vector & probabilities);
+std::vector convertCharToProbability(const std::vector & occupancies);
+
+namespace overwrite_fusion
+{
+enum State : unsigned char { UNKNOWN = 0U, FREE = 1U, OCCUPIED = 2U };
+State getApproximateState(const unsigned char & occupancy);
+unsigned char overwriteFusion(const std::vector & occupancies);
+} // namespace overwrite_fusion
+
+namespace log_odds_fusion
+{
+double logOddsFusion(const std::vector & probabilities);
+double logOddsFusion(
+ const std::vector & probabilities, const std::vector & weights);
+} // namespace log_odds_fusion
+
+namespace dempster_shafer_fusion
+{
+struct dempsterShaferOccupancy;
+double dempsterShaferFusion(const std::vector & probability);
+double dempsterShaferFusion(
+ const std::vector & probability, const std::vector & reliability);
+} // namespace dempster_shafer_fusion
+
+unsigned char singleFrameOccupancyFusion(
+ const std::vector & occupancy, FusionMethod method);
+unsigned char singleFrameOccupancyFusion(
+ const std::vector & occupancy, FusionMethod method,
+ const std::vector & reliability);
+} // namespace fusion_policy
+
+#endif // FUSION__SINGLE_FRAME_FUSION_POLICY_HPP_
diff --git a/perception/probabilistic_occupancy_grid_map/include/fusion/synchronized_grid_map_fusion_node.hpp b/perception/probabilistic_occupancy_grid_map/include/fusion/synchronized_grid_map_fusion_node.hpp
new file mode 100644
index 0000000000000..6bea5b2a16f72
--- /dev/null
+++ b/perception/probabilistic_occupancy_grid_map/include/fusion/synchronized_grid_map_fusion_node.hpp
@@ -0,0 +1,127 @@
+// Copyright 2023 Tier IV, Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef FUSION__SYNCHRONIZED_GRID_MAP_FUSION_NODE_HPP_
+#define FUSION__SYNCHRONIZED_GRID_MAP_FUSION_NODE_HPP_
+
+#include "fusion/single_frame_fusion_policy.hpp"
+#include "pointcloud_based_occupancy_grid_map/occupancy_grid_map_fixed.hpp"
+#include "updater/occupancy_grid_map_log_odds_bayes_filter_updater.hpp"
+#include "updater/occupancy_grid_map_updater_interface.hpp"
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include