Skip to content

Commit

Permalink
refactor(object_merger)!: fix namespace and directory structure (#7642)
Browse files Browse the repository at this point in the history
* refactor: update include paths for object association modules

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: update include paths for object association modules

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: rename node.hpp to object_association_merger_node.hpp

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: update include paths for object association modules

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: update include paths for object association modules

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: remove unused dependency in package.xml

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: update include paths for object association modules

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: add ssp.hpp to object association solver includes

Signed-off-by: Taekjin LEE <[email protected]>

* refactor: update include paths for object association node

Signed-off-by: Taekjin LEE <[email protected]>

---------

Signed-off-by: Taekjin LEE <[email protected]>
  • Loading branch information
technolojin authored Jul 2, 2024
1 parent 9df90bc commit c2f9579
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 145 deletions.
14 changes: 7 additions & 7 deletions perception/object_merger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ include_directories(
${EIGEN3_INCLUDE_DIR}
)

ament_auto_add_library(object_association_merger SHARED
src/object_association_merger/data_association/data_association.cpp
src/object_association_merger/data_association/mu_successive_shortest_path/mu_successive_shortest_path_wrapper.cpp
src/object_association_merger/node.cpp
ament_auto_add_library(${PROJECT_NAME} SHARED
src/association/data_association.cpp
src/association/solver/mu_successive_shortest_path_wrapper.cpp
src/object_association_merger_node.cpp
)

target_link_libraries(object_association_merger
target_link_libraries(${PROJECT_NAME}
Eigen3::Eigen
)

rclcpp_components_register_node(object_association_merger
PLUGIN "object_association::ObjectAssociationMergerNode"
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "autoware::object_merger::ObjectAssociationMergerNode"
EXECUTABLE object_association_merger_node
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,25 @@
// Author: v1.0 Yukihiro Saito
//

#ifndef OBJECT_MERGER__DATA_ASSOCIATION__DATA_ASSOCIATION_HPP_
#define OBJECT_MERGER__DATA_ASSOCIATION__DATA_ASSOCIATION_HPP_

#include <list>
#include <memory>
#include <unordered_map>
#include <vector>
#ifndef AUTOWARE_OBJECT_MERGER__ASSOCIATION__DATA_ASSOCIATION_HPP_
#define AUTOWARE_OBJECT_MERGER__ASSOCIATION__DATA_ASSOCIATION_HPP_

#define EIGEN_MPL2_ONLY
#include "object_merger/data_association/solver/gnn_solver.hpp"

#include "autoware_object_merger/association/solver/gnn_solver.hpp"

#include <Eigen/Core>
#include <Eigen/Geometry>

#include <autoware_perception_msgs/msg/detected_objects.hpp>
#include "autoware_perception_msgs/msg/detected_objects.hpp"

#include <list>
#include <memory>
#include <unordered_map>
#include <vector>

namespace autoware::object_merger
{

class DataAssociation
{
Expand All @@ -40,7 +44,7 @@ class DataAssociation
Eigen::MatrixXd max_rad_matrix_;
Eigen::MatrixXd min_iou_matrix_;
const double score_threshold_;
std::unique_ptr<gnn_solver::GnnSolverInterface> gnn_solver_ptr_;
std::unique_ptr<autoware::object_merger::gnn_solver::GnnSolverInterface> gnn_solver_ptr_;

public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Expand All @@ -56,4 +60,6 @@ class DataAssociation
virtual ~DataAssociation() {}
};

#endif // OBJECT_MERGER__DATA_ASSOCIATION__DATA_ASSOCIATION_HPP_
} // namespace autoware::object_merger

#endif // AUTOWARE_OBJECT_MERGER__ASSOCIATION__DATA_ASSOCIATION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OBJECT_MERGER__DATA_ASSOCIATION__SOLVER__GNN_SOLVER_HPP_
#define OBJECT_MERGER__DATA_ASSOCIATION__SOLVER__GNN_SOLVER_HPP_
#ifndef AUTOWARE_OBJECT_MERGER__ASSOCIATION__SOLVER__GNN_SOLVER_HPP_
#define AUTOWARE_OBJECT_MERGER__ASSOCIATION__SOLVER__GNN_SOLVER_HPP_

#include "object_merger/data_association/solver/gnn_solver_interface.hpp"
#include "object_merger/data_association/solver/mu_successive_shortest_path.hpp"
#include "object_merger/data_association/solver/successive_shortest_path.hpp"
#include "autoware_object_merger/association/solver/gnn_solver_interface.hpp"
#include "autoware_object_merger/association/solver/mu_ssp.hpp"
#include "autoware_object_merger/association/solver/ssp.hpp"

#endif // OBJECT_MERGER__DATA_ASSOCIATION__SOLVER__GNN_SOLVER_HPP_
#endif // AUTOWARE_OBJECT_MERGER__ASSOCIATION__SOLVER__GNN_SOLVER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OBJECT_MERGER__DATA_ASSOCIATION__SOLVER__GNN_SOLVER_INTERFACE_HPP_
#define OBJECT_MERGER__DATA_ASSOCIATION__SOLVER__GNN_SOLVER_INTERFACE_HPP_
#ifndef AUTOWARE_OBJECT_MERGER__ASSOCIATION__SOLVER__GNN_SOLVER_INTERFACE_HPP_
#define AUTOWARE_OBJECT_MERGER__ASSOCIATION__SOLVER__GNN_SOLVER_INTERFACE_HPP_

#include <unordered_map>
#include <vector>

namespace gnn_solver
namespace autoware::object_merger::gnn_solver
{
class GnnSolverInterface
{
Expand All @@ -30,6 +30,6 @@ class GnnSolverInterface
const std::vector<std::vector<double>> & cost, std::unordered_map<int, int> * direct_assignment,
std::unordered_map<int, int> * reverse_assignment) = 0;
};
} // namespace gnn_solver
} // namespace autoware::object_merger::gnn_solver

#endif // OBJECT_MERGER__DATA_ASSOCIATION__SOLVER__GNN_SOLVER_INTERFACE_HPP_
#endif // AUTOWARE_OBJECT_MERGER__ASSOCIATION__SOLVER__GNN_SOLVER_INTERFACE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OBJECT_MERGER__DATA_ASSOCIATION__SOLVER__MU_SUCCESSIVE_SHORTEST_PATH_HPP_
#define OBJECT_MERGER__DATA_ASSOCIATION__SOLVER__MU_SUCCESSIVE_SHORTEST_PATH_HPP_
#ifndef AUTOWARE_OBJECT_MERGER__ASSOCIATION__SOLVER__MU_SSP_HPP_
#define AUTOWARE_OBJECT_MERGER__ASSOCIATION__SOLVER__MU_SSP_HPP_

#include "object_merger/data_association/solver/gnn_solver_interface.hpp"
#include "autoware_object_merger/association/solver/gnn_solver_interface.hpp"

#include <unordered_map>
#include <vector>

namespace gnn_solver
namespace autoware::object_merger::gnn_solver
{
class MuSSP : public GnnSolverInterface
{
Expand All @@ -32,6 +32,6 @@ class MuSSP : public GnnSolverInterface
const std::vector<std::vector<double>> & cost, std::unordered_map<int, int> * direct_assignment,
std::unordered_map<int, int> * reverse_assignment) override;
};
} // namespace gnn_solver
} // namespace autoware::object_merger::gnn_solver

#endif // OBJECT_MERGER__DATA_ASSOCIATION__SOLVER__MU_SUCCESSIVE_SHORTEST_PATH_HPP_
#endif // AUTOWARE_OBJECT_MERGER__ASSOCIATION__SOLVER__MU_SSP_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OBJECT_MERGER__DATA_ASSOCIATION__SOLVER__SUCCESSIVE_SHORTEST_PATH_HPP_
#define OBJECT_MERGER__DATA_ASSOCIATION__SOLVER__SUCCESSIVE_SHORTEST_PATH_HPP_
#ifndef AUTOWARE_OBJECT_MERGER__ASSOCIATION__SOLVER__SSP_HPP_
#define AUTOWARE_OBJECT_MERGER__ASSOCIATION__SOLVER__SSP_HPP_

#include "object_merger/data_association/solver/gnn_solver_interface.hpp"
#include "autoware_object_merger/association/solver/gnn_solver_interface.hpp"

#include <unordered_map>
#include <vector>

namespace gnn_solver
namespace autoware::object_merger::gnn_solver
{
class SSP : public GnnSolverInterface
{
Expand All @@ -32,6 +32,6 @@ class SSP : public GnnSolverInterface
const std::vector<std::vector<double>> & cost, std::unordered_map<int, int> * direct_assignment,
std::unordered_map<int, int> * reverse_assignment) override;
};
} // namespace gnn_solver
} // namespace autoware::object_merger::gnn_solver

#endif // OBJECT_MERGER__DATA_ASSOCIATION__SOLVER__SUCCESSIVE_SHORTEST_PATH_HPP_
#endif // AUTOWARE_OBJECT_MERGER__ASSOCIATION__SOLVER__SSP_HPP_
73 changes: 0 additions & 73 deletions perception/object_merger/include/object_merger/utils/utils.hpp

This file was deleted.

1 change: 0 additions & 1 deletion perception/object_merger/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<depend>rclcpp_components</depend>
<depend>tf2</depend>
<depend>tf2_ros</depend>
<depend>tier4_perception_msgs</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "object_merger/data_association/data_association.hpp"
#include "autoware_object_merger/association/data_association.hpp"

#include "autoware/universe_utils/geometry/geometry.hpp"
#include "object_merger/data_association/solver/gnn_solver.hpp"
#include "object_merger/utils/utils.hpp"
#include "autoware_object_merger/association/solver/gnn_solver.hpp"
#include "object_recognition_utils/object_recognition_utils.hpp"

#include <algorithm>
Expand Down Expand Up @@ -47,6 +46,9 @@ double getFormedYawAngle(
}
} // namespace

namespace autoware::object_merger
{

DataAssociation::DataAssociation(
std::vector<int> can_assign_vector, std::vector<double> max_dist_vector,
std::vector<double> max_rad_vector, std::vector<double> min_iou_vector)
Expand Down Expand Up @@ -77,7 +79,7 @@ DataAssociation::DataAssociation(
min_iou_matrix_ = min_iou_matrix_tmp.transpose();
}

gnn_solver_ptr_ = std::make_unique<gnn_solver::MuSSP>();
gnn_solver_ptr_ = std::make_unique<autoware::object_merger::gnn_solver::MuSSP>();
}

void DataAssociation::assign(
Expand Down Expand Up @@ -172,3 +174,5 @@ Eigen::MatrixXd DataAssociation::calcScoreMatrix(

return score_matrix;
}

} // namespace autoware::object_merger
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "object_merger/data_association/solver/mu_successive_shortest_path.hpp"
#include "autoware_object_merger/association/solver/mu_ssp.hpp"

#include <mussp/mussp.h>

Expand All @@ -24,7 +24,7 @@
#include <unordered_map>
#include <vector>

namespace gnn_solver
namespace autoware::object_merger::gnn_solver
{
void MuSSP::maximizeLinearAssignment(
const std::vector<std::vector<double>> & cost, std::unordered_map<int, int> * direct_assignment,
Expand All @@ -38,4 +38,4 @@ void MuSSP::maximizeLinearAssignment(
// Solve DA by muSSP
solve_muSSP(cost, direct_assignment, reverse_assignment);
}
} // namespace gnn_solver
} // namespace autoware::object_merger::gnn_solver
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "object_merger/data_association/solver/successive_shortest_path.hpp"
#include "autoware_object_merger/association/solver/ssp.hpp"

#include <algorithm>
#include <cassert>
Expand All @@ -22,7 +22,7 @@
#include <utility>
#include <vector>

namespace gnn_solver
namespace autoware::object_merger::gnn_solver
{
struct ResidualEdge
{
Expand Down Expand Up @@ -367,4 +367,4 @@ void SSP::maximizeLinearAssignment(
}
#endif
}
} // namespace gnn_solver
} // namespace autoware::object_merger::gnn_solver
Loading

0 comments on commit c2f9579

Please sign in to comment.