Skip to content
This repository was archived by the owner on Jan 7, 2023. It is now read-only.

Multi tracking #114

Open
wants to merge 45 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
06f50a8
Fix unittest compile issue
challenzhou Oct 1, 2019
d2b927e
refractor tracking module to decoupling with ROS
challenzhou Oct 1, 2019
debb9e6
integrate with tracker_kcf which also enabled kalman filter
challenzhou Oct 2, 2019
5da819d
regression tool integration in progress, ROS2 DDS got issue on messag…
challenzhou Oct 2, 2019
50b6c1a
improve KCF for padding and scaling ratio
challenzhou Oct 3, 2019
30d51e6
KM algorithm initial version
challenzhou Oct 4, 2019
0336ebf
KM algorithm works but with pool performance
challenzhou Oct 5, 2019
61c6812
Add external KM algorithm implementation, which would be more faster
challenzhou Oct 5, 2019
a06104e
Add timestamp check for track and detect
challenzhou Oct 6, 2019
7930445
improved KCF and tracker manager
challenzhou Oct 14, 2019
fe0db1e
add debug information
challenzhou Oct 14, 2019
cf6e057
tuning params
challenzhou Oct 14, 2019
84a302f
tuning parameters for ROS2
challenzhou Oct 16, 2019
f8ac05e
add state management
challenzhou Oct 16, 2019
dc165c5
tuning state management
challenzhou Oct 16, 2019
9e7e139
reformt code for merge
challenzhou Oct 17, 2019
4860170
reformat coding style
challenzhou Oct 18, 2019
c4cab30
refine log machanism
challenzhou Oct 18, 2019
8fcedc1
hungarian algorithm take effect, need more tuning
challenzhou Oct 21, 2019
56be5ea
add more log information
challenzhou Oct 21, 2019
4bd4ede
refine coding style
challenzhou Oct 22, 2019
80bd81c
add logger class
challenzhou Oct 29, 2019
a1d2ed7
improve node pub/sub according to ROS Dashing
challenzhou Oct 31, 2019
aea0f42
improve segmenter sub/pub for latest ROS2
challenzhou Oct 31, 2019
d32d0d4
tuning coding style to pass amend lint check
challenzhou Nov 1, 2019
f67da4b
tracker finish coding style improve
challenzhou Nov 1, 2019
8e0159b
improve coding style
challenzhou Nov 4, 2019
93d0835
fix compiling issue
challenzhou Nov 4, 2019
93f3c0c
fix module load corruption issue
challenzhou Nov 4, 2019
d217179
Merge pull request #106 from challenzhou/multi-tracking
challen-zhou Nov 4, 2019
31e32b0
enable unit test
challenzhou Nov 5, 2019
7689da8
fix tracking unit test issue
challenzhou Nov 5, 2019
cd0582d
Merge pull request #107 from challenzhou/multi-tracking
challen-zhou Nov 5, 2019
cf0c2c2
reformat partial coding style
challenzhou Nov 5, 2019
13841c0
Merge pull request #108 from challenzhou/multi-tracking
challen-zhou Nov 5, 2019
3fbbf7a
improve partial of files error on uncrustify coding style check
challenzhou Nov 5, 2019
8d2dcc9
Merge pull request #109 from challenzhou/multi-tracking
challen-zhou Nov 5, 2019
8bb535f
correct typo on image publisher
challenzhou Nov 5, 2019
2b3e623
Merge pull request #110 from challenzhou/multi-tracking
challen-zhou Nov 5, 2019
4ce10b6
improve visualizer to match ROS2 coding style
challenzhou Nov 5, 2019
7427d37
Merge pull request #111 from challenzhou/multi-tracking
challen-zhou Nov 5, 2019
b0d32cd
Merge common files in OA and Visualizer tool
challenzhou Nov 11, 2019
7010d5e
Merge pull request #112 from challenzhou/multi-tracking
challen-zhou Nov 11, 2019
d60f042
Add TRACE_FUNC macro to record function footprints
challenzhou Nov 12, 2019
7cdaaf0
Merge pull request #113 from challenzhou/multi-tracking
challen-zhou Nov 12, 2019
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
87 changes: 87 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ qtcreator-*
# Emacs
.#*

# Vim
*.swp

# Catkin custom files
CATKIN_IGNORE
tags
9 changes: 9 additions & 0 deletions object_analytics_node/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ find_package(PCL 1.7 REQUIRED COMPONENTS

include_directories(
include
include/object_analytics_node
include/object_analytics_node/common
${object_analytics_msgs_INCLUDE_DIRS}
${message_filters_INCLUDE_DIRS}
${pcl_conversions_INCLUDE_DIRS}
Expand Down Expand Up @@ -118,6 +120,7 @@ if(${BUILD_TRACKING})
add_executable(tracker_regression src/tracker/tracking_regression.cpp
src/dataset/tr_dataset.cpp
src/dataset/trimg_dataset.cpp
src/dataset/trimg_MTdataset.cpp
src/dataset/trvid_dataset.cpp)
ament_target_dependencies(tracker_regression
"object_analytics_msgs"
Expand All @@ -133,7 +136,12 @@ if(${BUILD_TRACKING})
add_library(tracking_component SHARED
src/tracker/tracking_node.cpp
src/tracker/tracking.cpp
src/tracker/trackerKCF.cpp
src/tracker/tracking_manager.cpp
src/filter/kalman.cpp
src/common/frame.cpp
src/common/frame_obj.cpp
src/util/logger.cpp
)
target_compile_definitions(tracking_component
PRIVATE "OBJECT_ANALYTICS_NODE_BUILDING_DLL"
Expand All @@ -159,6 +167,7 @@ add_library(segmenter_component SHARED
src/segmenter/segmenter.cpp
src/segmenter/algorithm_provider_impl.cpp
src/segmenter/organized_multi_plane_segmenter.cpp
src/util/logger.cpp
)
target_compile_definitions(segmenter_component
PRIVATE "OBJECT_ANALYTICS_NODE_BUILDING_DLL"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once
#ifndef OBJECT_ANALYTICS_NODE__COMMON__FRAME_HPP_
#define OBJECT_ANALYTICS_NODE__COMMON__FRAME_HPP_

#include <opencv2/opencv.hpp>

#include <atomic>
#include <chrono>
Expand All @@ -28,33 +31,44 @@
#include <thread>
#include <vector>

#include <opencv2/opencv.hpp>

#include "utility.hpp"
#include "object.hpp"
#include "utility.hpp"

class sFrame {
public:
sFrame(){};
sFrame(cv::Mat &cv_frame);
class sFrame
{
public:
sFrame() {}
explicit sFrame(cv::Mat & cv_frame);
sFrame(cv::Mat & cv_frame, struct timespec st);

virtual ~sFrame() = default;

bool operator==(const sFrame &c) { return (c.stamp == stamp); };
bool operator==(const sFrame & c)
{
return c.stamp.tv_sec == stamp.tv_sec && c.stamp.tv_nsec == stamp.tv_nsec;
}

bool operator!=(const sFrame &c) { return !(c.stamp == stamp); };
bool operator!=(const sFrame & c)
{
return c.stamp.tv_sec != stamp.tv_sec || c.stamp.tv_nsec != stamp.tv_nsec;
}

/**
* @brief Generate sframe from cv::Mat
*/
virtual void genFrame(cv::Mat &cv_frame);
virtual void genFrame(cv::Mat & cv_frame);

/**
* @brief Read time stamp for each frame
*/
std::time_t getTimeStamp();
struct timespec getTimeStamp();

public:
public:
cv::Mat frame;
std::time_t stamp;
struct timespec stamp;
};

extern bool operator<(const struct timespec & lhs, const struct timespec & rhs);
extern bool operator==(const struct timespec & lhs, const struct timespec & rhs);

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

#pragma once
#ifndef OBJECT_ANALYTICS_NODE__COMMON__FRAME_OBJ_HPP_
#define OBJECT_ANALYTICS_NODE__COMMON__FRAME_OBJ_HPP_

#include <opencv2/opencv.hpp>

#include <atomic>
#include <chrono>
Expand All @@ -28,35 +31,37 @@
#include <thread>
#include <vector>

#include <opencv2/opencv.hpp>

#include "utility.hpp"
#include "frame.hpp"
#include "utility.hpp"

class FrameObjs : public sFrame{
public:
FrameObjs(){};
class FrameObjs : public sFrame
{
public:
FrameObjs() {}

virtual ~FrameObjs() = default;

/**
* @brief Generate sframe from cv::Mat and frame index
*/
virtual void genFrame(cv::Mat &cv_frame, int idx);
virtual void genFrame(cv::Mat & cv_frame, int idx);

/**
* @brief Add detection for the frame
*/
void AddDetection(Object& detect);
void AddDetection(Object & detect);

/**
* @brief Add track for the frame
*/
void AddTrack(Object& track);
void AddTrack(Object & track);

public:
public:
int frame_idx = -1;

std::vector<Object> dets;
std::vector<Object> tracks;
};

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

#pragma once
#ifndef OBJECT_ANALYTICS_NODE__COMMON__OBJECT_HPP_
#define OBJECT_ANALYTICS_NODE__COMMON__OBJECT_HPP_

#include <opencv2/opencv.hpp>

#include <atomic>
#include <chrono>
Expand All @@ -28,18 +31,22 @@
#include <thread>
#include <vector>

#include <opencv2/opencv.hpp>

class Object {
class Object
{
public:
Object(){};
~Object(){};
Object() {}
~Object() {}

public:
int ObjectIdx_;
std::string Category_;
cv::Rect2d BoundBox_;
float Confidence;
float Confidence_;

struct timespec Stamp_;

cv::Mat Mean_;
cv::Mat Covariance_;
};

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

#pragma once
#ifndef OBJECT_ANALYTICS_NODE__COMMON__UTILITY_HPP_
#define OBJECT_ANALYTICS_NODE__COMMON__UTILITY_HPP_

#define __FILENAME__ \
(strrchr(__FILE__, '/') ? (strrchr(__FILE__, '/') + 1) : __FILE__)

#ifndef NDEBUG
#define TRACE_INFO(fmt, args...) \
printf("[INFO]: %s(%d)<%s>\t" fmt "\n", __FILENAME__, __LINE__, \
__FUNCTION__, ##args)
#else
#define TRACE_INFO(fmt, args...)
#ifndef UNUSED
#define UNUSED(var) \
do { \
(void)(var); \
} while (0)
#endif

#define TRACE_ERR(fmt, args...) \
printf("[ERR ]: %s(%d)<%s>\t" fmt "\n", __FILENAME__, __LINE__, \
__FUNCTION__, ##args)
#endif // OBJECT_ANALYTICS_NODE__COMMON__UTILITY_HPP_
21 changes: 14 additions & 7 deletions object_analytics_node/include/object_analytics_node/const.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ namespace object_analytics_node
class Const
{
public:
static const char kTopicRegisteredPC2[];/**< Topic name of splitter node's input message */
static const char kTopicPC2[]; /**< Topic name of segmenter node's input message */
static const char kTopicRgb[]; /**< Topic name of 2d detection's input message */
static const char kTopicSegmentation[]; /**< Topic name of segmenter node's output message*/
static const char kTopicDetection[]; /**< Topic name of 2d detection's output message */
static const char kTopicLocalization[]; /**< Topic name of merger node's output message */
static const char kTopicTracking[]; /**< Topic name of tracker node's output message */
static const char
kTopicRegisteredPC2[]; /**< Topic name of splitter node's input message */
static const char
kTopicPC2[]; /**< Topic name of segmenter node's input message */
static const char
kTopicRgb[]; /**< Topic name of 2d detection's input message */
static const char
kTopicSegmentation[]; /**< Topic name of segmenter node's output message*/
static const char
kTopicDetection[]; /**< Topic name of 2d detection's output message */
static const char
kTopicLocalization[]; /**< Topic name of merger node's output message */
static const char
kTopicTracking[]; /**< Topic name of tracker node's output message */
};
} // namespace object_analytics_node
#endif // OBJECT_ANALYTICS_NODE__CONST_HPP_
Loading