Commit 838f6922 authored by oscar's avatar oscar

提交更新

parent e0aa98cb
......@@ -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
......
......@@ -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;//记录更新时间,如果时间长就删除
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment