Skip to content

Commit

Permalink
refactor(radar_object_tracker)!: fix namespace and directory structure (
Browse files Browse the repository at this point in the history
autowarefoundation#7658)

* chore: refactor radar_object_tracker_node.cpp and related files

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

* refactor: update include paths for radar_object_tracker files

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

* refactor: update include paths for radar_object_tracker files

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

* refactor: remove MSG_COV_IDX enum in utils.hpp

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

* refactor: fix the node name

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

* refactor: update include paths for radar_object_tracker files

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

---------

Signed-off-by: Taekjin LEE <[email protected]>
  • Loading branch information
technolojin authored and mitukou1109 committed Jul 2, 2024
1 parent 57e3155 commit 4120833
Show file tree
Hide file tree
Showing 25 changed files with 247 additions and 260 deletions.
28 changes: 14 additions & 14 deletions perception/radar_object_tracker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,47 +20,47 @@ include_directories(
${EIGEN3_INCLUDE_DIR}
)

ament_auto_add_library(radar_object_tracker_utils SHARED
ament_auto_add_library(${PROJECT_NAME}_utils SHARED
src/utils/utils.cpp
src/utils/radar_object_tracker_utils.cpp
)

ament_auto_add_library(radar_object_tracker_node SHARED
src/radar_object_tracker_node/radar_object_tracker_node.cpp
ament_auto_add_library(${PROJECT_NAME} SHARED
src/radar_object_tracker_node.cpp
src/tracker/model/tracker_base.cpp
src/tracker/model/linear_motion_tracker.cpp
src/tracker/model/constant_turn_rate_motion_tracker.cpp
src/data_association/data_association.cpp
src/data_association/mu_successive_shortest_path/mu_successive_shortest_path_wrapper.cpp
src/association/data_association.cpp
src/association/mu_ssp/mu_successive_shortest_path_wrapper.cpp
)

target_link_libraries(radar_object_tracker_node
target_link_libraries(${PROJECT_NAME}
Eigen3::Eigen
yaml-cpp
nlohmann_json::nlohmann_json # for debug
glog::glog
radar_object_tracker_utils
${PROJECT_NAME}_utils
)

rclcpp_components_register_node(radar_object_tracker_node
PLUGIN "RadarObjectTrackerNode"
EXECUTABLE radar_object_tracker
rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "autoware::radar_object_tracker::RadarObjectTrackerNode"
EXECUTABLE radar_object_tracker_node
)

# testing
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

ament_add_gtest(test_radar_object_tracker_utils
ament_add_gtest(test_${PROJECT_NAME}_utils
test/test_radar_object_tracker_utils.cpp
src/utils/radar_object_tracker_utils.cpp
)
target_include_directories(test_radar_object_tracker_utils PRIVATE
target_include_directories(test_${PROJECT_NAME}_utils PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_link_libraries(test_radar_object_tracker_utils
radar_object_tracker_utils
target_link_libraries(test_${PROJECT_NAME}_utils
${PROJECT_NAME}_utils
)
endif()

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

#ifndef RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__DATA_ASSOCIATION_HPP_
#define RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__DATA_ASSOCIATION_HPP_

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

#define EIGEN_MPL2_ONLY

#include "autoware_radar_object_tracker/association/solver/gnn_solver.hpp"
#include "autoware_radar_object_tracker/tracker/tracker.hpp"
#include "object_recognition_utils/object_recognition_utils.hpp"
#include "radar_object_tracker/data_association/solver/gnn_solver.hpp"
#include "radar_object_tracker/tracker/tracker.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 <string>
#include <unordered_map>
#include <vector>
namespace autoware::radar_object_tracker
{
class DataAssociation
{
private:
Expand Down Expand Up @@ -62,5 +64,5 @@ class DataAssociation
const std::string & file_name);
virtual ~DataAssociation() {}
};

#endif // RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__DATA_ASSOCIATION_HPP_
} // namespace autoware::radar_object_tracker
#endif // AUTOWARE_RADAR_OBJECT_TRACKER__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 RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__SOLVER__GNN_SOLVER_HPP_
#define RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__SOLVER__GNN_SOLVER_HPP_
#ifndef AUTOWARE_RADAR_OBJECT_TRACKER__ASSOCIATION__SOLVER__GNN_SOLVER_HPP_
#define AUTOWARE_RADAR_OBJECT_TRACKER__ASSOCIATION__SOLVER__GNN_SOLVER_HPP_

#include "radar_object_tracker/data_association/solver/gnn_solver_interface.hpp"
#include "radar_object_tracker/data_association/solver/mu_successive_shortest_path.hpp"
#include "radar_object_tracker/data_association/solver/successive_shortest_path.hpp"
#include "autoware_radar_object_tracker/association/solver/gnn_solver_interface.hpp"
#include "autoware_radar_object_tracker/association/solver/mu_ssp.hpp"
#include "autoware_radar_object_tracker/association/solver/ssp.hpp"

#endif // RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__SOLVER__GNN_SOLVER_HPP_
#endif // AUTOWARE_RADAR_OBJECT_TRACKER__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 RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__SOLVER__GNN_SOLVER_INTERFACE_HPP_
#define RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__SOLVER__GNN_SOLVER_INTERFACE_HPP_
#ifndef AUTOWARE_RADAR_OBJECT_TRACKER__ASSOCIATION__SOLVER__GNN_SOLVER_INTERFACE_HPP_
#define AUTOWARE_RADAR_OBJECT_TRACKER__ASSOCIATION__SOLVER__GNN_SOLVER_INTERFACE_HPP_

#include <unordered_map>
#include <vector>

namespace gnn_solver
namespace autoware::radar_object_tracker::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::radar_object_tracker::gnn_solver

#endif // RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__SOLVER__GNN_SOLVER_INTERFACE_HPP_
#endif // AUTOWARE_RADAR_OBJECT_TRACKER__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 RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__SOLVER__MU_SUCCESSIVE_SHORTEST_PATH_HPP_
#define RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__SOLVER__MU_SUCCESSIVE_SHORTEST_PATH_HPP_
#ifndef AUTOWARE_RADAR_OBJECT_TRACKER__ASSOCIATION__SOLVER__MU_SSP_HPP_
#define AUTOWARE_RADAR_OBJECT_TRACKER__ASSOCIATION__SOLVER__MU_SSP_HPP_

#include "radar_object_tracker/data_association/solver/gnn_solver_interface.hpp"
#include "autoware_radar_object_tracker/association/solver/gnn_solver_interface.hpp"

#include <unordered_map>
#include <vector>

namespace gnn_solver
namespace autoware::radar_object_tracker::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::radar_object_tracker::gnn_solver

#endif // RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__SOLVER__MU_SUCCESSIVE_SHORTEST_PATH_HPP_
#endif // AUTOWARE_RADAR_OBJECT_TRACKER__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 RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__SOLVER__SUCCESSIVE_SHORTEST_PATH_HPP_
#define RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__SOLVER__SUCCESSIVE_SHORTEST_PATH_HPP_
#ifndef AUTOWARE_RADAR_OBJECT_TRACKER__ASSOCIATION__SOLVER__SSP_HPP_
#define AUTOWARE_RADAR_OBJECT_TRACKER__ASSOCIATION__SOLVER__SSP_HPP_

#include "radar_object_tracker/data_association/solver/gnn_solver_interface.hpp"
#include "autoware_radar_object_tracker/association/solver/gnn_solver_interface.hpp"

#include <unordered_map>
#include <vector>

namespace gnn_solver
namespace autoware::radar_object_tracker::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::radar_object_tracker::gnn_solver

#endif // RADAR_OBJECT_TRACKER__DATA_ASSOCIATION__SOLVER__SUCCESSIVE_SHORTEST_PATH_HPP_
#endif // AUTOWARE_RADAR_OBJECT_TRACKER__ASSOCIATION__SOLVER__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 RADAR_OBJECT_TRACKER__TRACKER__MODEL__CONSTANT_TURN_RATE_MOTION_TRACKER_HPP_
#define RADAR_OBJECT_TRACKER__TRACKER__MODEL__CONSTANT_TURN_RATE_MOTION_TRACKER_HPP_
#ifndef AUTOWARE_RADAR_OBJECT_TRACKER__TRACKER__MODEL__CONSTANT_TURN_RATE_MOTION_TRACKER_HPP_
#define AUTOWARE_RADAR_OBJECT_TRACKER__TRACKER__MODEL__CONSTANT_TURN_RATE_MOTION_TRACKER_HPP_

#include "radar_object_tracker/tracker/model/tracker_base.hpp"

#include <kalman_filter/kalman_filter.hpp>
#include "autoware_radar_object_tracker/tracker/model/tracker_base.hpp"
#include "kalman_filter/kalman_filter.hpp"

#include <string>

namespace autoware::radar_object_tracker
{
using Label = autoware_perception_msgs::msg::ObjectClassification;
class ConstantTurnRateMotionTracker : public Tracker // means constant turn rate motion tracker
{
Expand Down Expand Up @@ -108,5 +108,5 @@ class ConstantTurnRateMotionTracker : public Tracker // means constant turn rat
autoware_perception_msgs::msg::TrackedObject & object) const override;
virtual ~ConstantTurnRateMotionTracker() {}
};

#endif // RADAR_OBJECT_TRACKER__TRACKER__MODEL__CONSTANT_TURN_RATE_MOTION_TRACKER_HPP_
} // namespace autoware::radar_object_tracker
#endif // AUTOWARE_RADAR_OBJECT_TRACKER__TRACKER__MODEL__CONSTANT_TURN_RATE_MOTION_TRACKER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RADAR_OBJECT_TRACKER__TRACKER__MODEL__LINEAR_MOTION_TRACKER_HPP_
#define RADAR_OBJECT_TRACKER__TRACKER__MODEL__LINEAR_MOTION_TRACKER_HPP_
#ifndef AUTOWARE_RADAR_OBJECT_TRACKER__TRACKER__MODEL__LINEAR_MOTION_TRACKER_HPP_
#define AUTOWARE_RADAR_OBJECT_TRACKER__TRACKER__MODEL__LINEAR_MOTION_TRACKER_HPP_

#include "radar_object_tracker/tracker/model/tracker_base.hpp"

#include <kalman_filter/kalman_filter.hpp>
#include "autoware_radar_object_tracker/tracker/model/tracker_base.hpp"
#include "kalman_filter/kalman_filter.hpp"

#include <string>

namespace autoware::radar_object_tracker
{

using Label = autoware_perception_msgs::msg::ObjectClassification;
class LinearMotionTracker : public Tracker
{
Expand Down Expand Up @@ -111,5 +113,5 @@ class LinearMotionTracker : public Tracker
autoware_perception_msgs::msg::TrackedObject & object) const override;
virtual ~LinearMotionTracker() {}
};

#endif // RADAR_OBJECT_TRACKER__TRACKER__MODEL__LINEAR_MOTION_TRACKER_HPP_
} // namespace autoware::radar_object_tracker
#endif // AUTOWARE_RADAR_OBJECT_TRACKER__TRACKER__MODEL__LINEAR_MOTION_TRACKER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
// Author: v1.0 Yukihiro Saito
//

#ifndef RADAR_OBJECT_TRACKER__TRACKER__MODEL__TRACKER_BASE_HPP_
#define RADAR_OBJECT_TRACKER__TRACKER__MODEL__TRACKER_BASE_HPP_
#ifndef AUTOWARE_RADAR_OBJECT_TRACKER__TRACKER__MODEL__TRACKER_BASE_HPP_
#define AUTOWARE_RADAR_OBJECT_TRACKER__TRACKER__MODEL__TRACKER_BASE_HPP_

#define EIGEN_MPL2_ONLY
#include "autoware_radar_object_tracker/utils/utils.hpp"
#include "object_recognition_utils/object_recognition_utils.hpp"
#include "radar_object_tracker/utils/utils.hpp"

#include <Eigen/Core>
#include <rclcpp/rclcpp.hpp>
Expand All @@ -33,6 +33,8 @@

#include <vector>

namespace autoware::radar_object_tracker
{
class Tracker
{
protected:
Expand Down Expand Up @@ -92,5 +94,5 @@ class Tracker
const rclcpp::Time & time, autoware_perception_msgs::msg::TrackedObject & object) const = 0;
virtual bool predict(const rclcpp::Time & time) = 0;
};

#endif // RADAR_OBJECT_TRACKER__TRACKER__MODEL__TRACKER_BASE_HPP_
} // namespace autoware::radar_object_tracker
#endif // AUTOWARE_RADAR_OBJECT_TRACKER__TRACKER__MODEL__TRACKER_BASE_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 RADAR_OBJECT_TRACKER__TRACKER__TRACKER_HPP_
#define RADAR_OBJECT_TRACKER__TRACKER__TRACKER_HPP_
#ifndef AUTOWARE_RADAR_OBJECT_TRACKER__TRACKER__TRACKER_HPP_
#define AUTOWARE_RADAR_OBJECT_TRACKER__TRACKER__TRACKER_HPP_

#include "model/constant_turn_rate_motion_tracker.hpp"
#include "model/linear_motion_tracker.hpp"
#include "model/tracker_base.hpp"

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

#ifndef RADAR_OBJECT_TRACKER__UTILS__RADAR_OBJECT_TRACKER_UTILS_HPP_
#define RADAR_OBJECT_TRACKER__UTILS__RADAR_OBJECT_TRACKER_UTILS_HPP_
#ifndef AUTOWARE_RADAR_OBJECT_TRACKER__UTILS__RADAR_OBJECT_TRACKER_UTILS_HPP_
#define AUTOWARE_RADAR_OBJECT_TRACKER__UTILS__RADAR_OBJECT_TRACKER_UTILS_HPP_

#include "autoware/universe_utils/geometry/geometry.hpp"
#include "autoware/universe_utils/math/unit_conversion.hpp"

#include <lanelet2_extension/utility/query.hpp>
#include <lanelet2_extension/utility/utilities.hpp>
#include <rclcpp/rclcpp.hpp>

#include "autoware_perception_msgs/msg/tracked_object.hpp"
#include <geometry_msgs/msg/transform.hpp>

#include <boost/optional.hpp>
Expand All @@ -33,21 +38,15 @@
#else
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#endif

#include <autoware/universe_utils/geometry/geometry.hpp>
#include <autoware/universe_utils/math/unit_conversion.hpp>
#include <rclcpp/rclcpp.hpp>

#include <autoware_perception_msgs/msg/tracked_object.hpp>

#include <tf2/LinearMath/Transform.h>
#include <tf2/convert.h>
#include <tf2/transform_datatypes.h>
#include <tf2_ros/buffer.h>

#include <string>
#include <utility>
namespace radar_object_tracker_utils

namespace autoware::radar_object_tracker::utils
{

boost::optional<geometry_msgs::msg::Transform> getTransformAnonymous(
Expand All @@ -72,6 +71,6 @@ bool hasValidVelocityDirectionToLanelet(
const autoware_perception_msgs::msg::TrackedObject & object,
const lanelet::ConstLanelets & lanelets, const double max_lateral_velocity);

} // namespace radar_object_tracker_utils
} // namespace autoware::radar_object_tracker::utils

#endif // RADAR_OBJECT_TRACKER__UTILS__RADAR_OBJECT_TRACKER_UTILS_HPP_
#endif // AUTOWARE_RADAR_OBJECT_TRACKER__UTILS__RADAR_OBJECT_TRACKER_UTILS_HPP_
Loading

0 comments on commit 4120833

Please sign in to comment.