Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
E
event_src
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
oscar
event_src
Commits
838f6922
Commit
838f6922
authored
Mar 22, 2022
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交更新
parent
e0aa98cb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
5 deletions
+30
-5
EventsRos.cpp
EventsRos.cpp
+25
-4
EventsRos.h
EventsRos.h
+3
-1
EventInfo.h
msg/EventInfo.h
+2
-0
No files found.
EventsRos.cpp
View file @
838f6922
...
...
@@ -10,6 +10,9 @@
#include <memory>
#include "Component.h"
#include "utils/yaml_parser.h"
#ifdef _USING_TIMESTAMP_TRACKING_
#incude "std_msgs/UInt64MultiArray.h"
#endif
int
EventsRos
::
loadConfig
(
ros
::
NodeHandle
&
nh
)
{
...
...
@@ -139,10 +142,13 @@ int EventsRos::loadConfig(ros::NodeHandle& nh)
SDK_LOG
(
SDK_INFO
,
"m_port == 0, no send http info"
);
}
time_t
tt
=
time
(
NULL
);
uint64_t
timestamp
=
1639119613898
/
1000
;
std
::
string
tStr
=
GetTimeStr
(
timestamp
);
SDK_LOG
(
SDK_INFO
,
"tt = %llu,timestamp = %llu, time = %s"
,
tt
,
timestamp
,
tStr
.
c_str
());
#ifdef _USING_TIMESTAMP_TRACKING_
m_pubTimeStracking
=
nh
.
advertise
<
std_msgs
::
UInt64MultiArray
>
(
"/TimeTracking"
,
100
);
#endif
//time_t tt = time(NULL);
//uint64_t timestamp = 1639119613898/1000;
//std::string tStr = GetTimeStr(timestamp);
//SDK_LOG(SDK_INFO, "tt = %llu,timestamp = %llu, time = %s", tt, timestamp,tStr.c_str());
return
0
;
}
...
...
@@ -204,6 +210,11 @@ void EventsRos::TrackCallBackFunc(const jfxrosperceiver::det_tracking_arrayConst
}
TrkObjsPtr
objsPtr
=
std
::
make_shared
<
TrkObjs
>
();
#ifdef _USING_TIMESTAMP_TRACKING_
objsPtr
->
timestamp
=
(
unsigned
long
long
)
msg
->
cloud
.
header
.
stamp
.
sec
*
1000
+
(
unsigned
long
long
)
msg
->
cloud
.
header
.
stamp
.
nsec
*
1e-6
;
auto
curT
=
ros
::
Time
::
now
();
objsPtr
->
recv_time
=
(
unsigned
long
long
)
curT
.
sec
*
1000
+
(
unsigned
long
long
)
curT
.
nsec
*
1e-6
;
#endif
objsPtr
->
devNo
=
m_devNo
;
objsPtr
->
mecNo
=
m_mecNo
;
for
(
auto
&
item
:
msg
->
array
)
...
...
@@ -238,6 +249,16 @@ int EventsRos::Start()
{
SDK_LOG
(
SDK_INFO
,
"EventsRos::Start"
);
m_jfx_events
.
SetEventsCallback
([
=
](
TrkObjsPtr
&
outs
)
{
#ifdef _USING_TIMESTAMP_TRACKING_
std_msgs
::
UInt64MultiArray
tim
=
{};
auto
curT
=
ros
::
Time
::
now
();
uint64_t
curTimestamp
=
(
unsigned
long
long
)
curT
.
sec
*
1000
+
(
unsigned
long
long
)
curT
.
nsec
*
1e-6
;
tim
.
data
.
push_back
(
1
);
//发送数据类型
tim
.
data
.
push_back
(
outs
->
timestamp
);
tim
.
data
.
push_back
(
outs
->
recv_time
);
tim
.
data
.
push_back
(
curTimestamp
);
m_pubTimeStracking
.
publish
(
tim
);
#endif
#if defined(_ROS_XISHAN_) || defined(_ROS_HEFEI_R_) || defined(_ROS_HEFEI_L_)
SendRosEvents
(
outs
);
#else
...
...
EventsRos.h
View file @
838f6922
...
...
@@ -63,7 +63,9 @@ public:
ros
::
Publisher
m_pub
;
//发送所有物体信息的publisher
ros
::
Publisher
m_pubFlow
;
//发送流量信息的publisher
#ifdef _USING_TIMESTAMP_TRACKING_
ros
::
Publisher
m_pubTimeStracking
;
//发送事件戳信息
#endif
std
::
map
<
uint64_t
,
std
::
vector
<
std
::
string
>
>
m_recordCsvStr
;
//记录物品信息的字符串队列
std
::
map
<
uint64_t
,
int
>
m_recordEventState
;
//记录是否需要保存的标识
std
::
map
<
uint64_t
,
uint64_t
>
m_recordUpdateTime
;
//记录更新时间,如果时间长就删除
...
...
msg/EventInfo.h
View file @
838f6922
...
...
@@ -136,6 +136,8 @@ AJSON(flowEvent,
)
typedef
struct
_TrkObjs
{
uint64_t
timestamp
;
//数据包的时间戳
uint64_t
recv_time
;
//接收到数据的时间
std
::
string
devNo
;
// 设备相机id
std
::
string
mecNo
;
// MecNo 工控机id
std
::
vector
<
TrkObj
>
objs
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment