Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace hungarian method with successive shortest path method in data association #4

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions euclidean_cluster/launch/euclidean_cluster.launch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<launch>
<arg name="input/pointcloud" default="/points_raw/filtered"/>
<arg name="input/map" default="/points_map" />
<!-- <arg name="input/map" default="/points_map" /> -->
<arg name="output/clusters" default="clusters"/>

<node pkg="nodelet" type="nodelet" name="euclidean_cluster_manager" args="manager" output="screen" />
Expand All @@ -11,22 +11,22 @@
<remap from="~output" to="voxel_grid/filtered" />
<rosparam>
filter_field_name: z
filter_limit_min: 0.1
filter_limit_min: -1.5
filter_limit_max: 2.5
filter_limit_negative: False
leaf_size: 0.1
input_frame: base_link
output_frame: base_link
</rosparam>
</node>
<node pkg="nodelet" type="nodelet" name="compare_map_filter" args="load points_preprocessor/voxel_based_compare_map_filter_nodelet euclidean_cluster_manager" output="screen">
<!-- <node pkg="nodelet" type="nodelet" name="compare_map_filter" args="load points_preprocessor/voxel_based_compare_map_filter_nodelet euclidean_cluster_manager" output="screen">
<remap from="~input" to="voxel_grid/filtered"/>
<remap from="~map" to="$(arg input/map)"/>
<remap from="~output" to="compare_map/filtered"/>
</node>
</node> -->

<node pkg="nodelet" type="nodelet" name="euclidean_cluster" args="load euclidean_cluster/euclidean_cluster_nodelet euclidean_cluster_manager" output="screen">
<remap from="~input" to="compare_map/filtered"/>
<remap from="~input" to="voxel_grid/filtered"/>
<remap from="~output" to="$(arg output/clusters)"/>
<rosparam>
target_frame: base_link
Expand Down
2 changes: 1 addition & 1 deletion multi_object_tracker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ add_executable(multi_object_tracker_node
src/tracker/model/bicycle_tracker.cpp
src/tracker/model/pedestrian_tracker.cpp
src/data_association/data_association.cpp
src/data_association/hungarian/hungarian.cc)
src/data_association/successive_shortest_path/successive_shortest_path.cpp)

add_dependencies(multi_object_tracker_node ${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS})
Expand Down
10 changes: 10 additions & 0 deletions multi_object_tracker/launch/multi_object_tracker.launch
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,15 @@
<remap from="output" to="$(arg output/objects)"/>
<param name="world_frame_id" value="$(arg world_frame_id)" />
</node>
<!-- visualization -->
<include file="$(find dynamic_object_visualization)/launch/dynamic_object_visualizer.launch">
<arg name="input" value="objects"/>
<arg name="with_feature" value="false"/>
<arg name="only_known_objects" default="true"/>
</include>

<node pkg="tf2_ros" type="static_transform_publisher" name="loam_velodyne_to_base_link" args="0 0 0 0 0 -1.57079632679 loam_velodyne/base_link base_link" />
<node pkg="tf2_ros" type="static_transform_publisher" name="base_link_to_velodyne" args="0 0 0 -1.57079632679 0 0 base_link velodyne" />
<node pkg="tf2_ros" type="static_transform_publisher" name="world_to_map" args="0 0 0 0 0 1.57079632679 world map" />

</launch>
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/

#include "multi_object_tracker/data_association/data_association.hpp"
#include "hungarian/hungarian.h"
#include "multi_object_tracker/utils/utils.hpp"
#include "successive_shortest_path/successive_shortest_path.h"

// #include <iostream>
DataAssociation::DataAssociation()
Expand Down Expand Up @@ -114,6 +114,7 @@ bool DataAssociation::assign(const Eigen::MatrixXd &src,
std::unordered_map<int, int> &direct_assignment,
std::unordered_map<int, int> &reverse_assignment)
{

std::vector<std::vector<double>> score(src.rows());
for (int row = 0; row < src.rows(); ++row)
{
Expand All @@ -123,7 +124,10 @@ bool DataAssociation::assign(const Eigen::MatrixXd &src,
score.at(row).at(col) = src(row, col);
}
}
operations_research::MaximizeLinearAssignment(score, &direct_assignment, &reverse_assignment);

// Solve
assignment_problem::MaximizeLinearAssignment(score, &direct_assignment, &reverse_assignment);

for (auto itr = direct_assignment.begin(); itr != direct_assignment.end();)
{
if (src(itr->first, itr->second) < score_threshold_)
Expand Down
Loading