Skip to content

Commit

Permalink
refactor(behavior_path_planner): use boost uuid as hash for debug
Browse files Browse the repository at this point in the history
Signed-off-by: Muhammad Zulfaqar Azmi <[email protected]>
  • Loading branch information
zulfaqar-azmi-t4 committed Nov 30, 2023
1 parent 5d2c81f commit a1f0af2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

#include <unique_identifier_msgs/msg/uuid.hpp>

#include <boost/uuid/uuid.hpp>

#include <algorithm>
#include <random>
#include <string>

Expand All @@ -40,6 +43,21 @@ inline std::string toHexString(const unique_identifier_msgs::msg::UUID & id)
}
return ss.str();
}

static inline boost::uuids::uuid toBoostUUID(const unique_identifier_msgs::msg::UUID & id)
{
boost::uuids::uuid boost_uuid{};
std::copy(id.uuid.begin(), id.uuid.end(), boost_uuid.begin());
return boost_uuid;
}

static inline unique_identifier_msgs::msg::UUID toUUIDMsg(const boost::uuids::uuid & id)
{
unique_identifier_msgs::msg::UUID ros_uuid{};
std::copy(id.begin(), id.end(), ros_uuid.uuid.begin());
return ros_uuid;
}

} // namespace tier4_autoware_utils

#endif // TIER4_AUTOWARE_UTILS__ROS__UUID_HELPER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <geometry_msgs/msg/pose.hpp>
#include <geometry_msgs/msg/twist.hpp>

#include <boost/uuid/uuid_hash.hpp>

#include <string>
#include <unordered_map>
#include <utility>
Expand Down Expand Up @@ -214,7 +216,7 @@ struct CollisionCheckDebug
Polygon2d extended_obj_polygon{}; ///< Detected object's extended collision polygon.
autoware_auto_perception_msgs::msg::Shape obj_shape; ///< object's shape.
};
using CollisionCheckDebugPair = std::pair<std::string, CollisionCheckDebug>;
using CollisionCheckDebugPair = std::pair<boost::uuids::uuid, CollisionCheckDebug>;
using CollisionCheckDebugMap =
std::unordered_map<CollisionCheckDebugPair::first_type, CollisionCheckDebugPair::second_type>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ CollisionCheckDebugPair createObjectDebug(const ExtendedPredictedObject & obj)
debug.extended_obj_polygon = tier4_autoware_utils::toPolygon2d(obj.initial_pose.pose, obj.shape);
debug.obj_shape = obj.shape;
debug.current_twist = obj.initial_twist.twist;
return {tier4_autoware_utils::toHexString(obj.uuid), debug};
return {tier4_autoware_utils::toBoostUUID(obj.uuid), debug};
}

void updateCollisionCheckDebugMap(
Expand Down

0 comments on commit a1f0af2

Please sign in to comment.