Commit d2a856e5 authored by oscar's avatar oscar

提交时间点逻辑

parent e08fcfbb
......@@ -245,6 +245,10 @@ void EventsRos::TrackCallBackFunc(const jfxrosperceiver::det_tracking_arrayConst
obj.speed = sqrt(pow(item.v_x, 2) + pow(item.v_y, 2) + pow(item.v_z, 2));//计算出车的速度
objsPtr->objs.emplace_back(obj);
}
for (int i = 0; i < msg->pt.size(); i++)
{
objsPtr->pt.push_back(msg->pt[i]);
}
m_jfx_events.PushEventInfos(objsPtr);
}
#endif
......@@ -395,6 +399,15 @@ void EventsRos::SendRosEvents(TrkObjsPtr& outs)
traffic.lane_angle = angle > 360 ? angle - 360 : angle;
eventMsgs.traffic.emplace_back(traffic);
}
if (outs.pt.size() == 4)
{
eventMsgs.pt.push_back(outs.pt[0]);
eventMsgs.pt.push_back(outs.pt[1]);
eventMsgs.pt.push_back(outs.pt[3]);
auto time_p = ros::Time::now();
std::uint64_t tt = (std::uint64_t)time_p.sec * 1000 + time_p.nsec * 1e-6;
eventMsgs.pt.push_back(tt);//发送发送的时间点
}
m_pub.publish(eventMsgs);
//删除过时的记录
......
......@@ -143,6 +143,7 @@ typedef struct _TrkObjs {
std::vector<TrkObj> objs;
std::vector<trafficJamInfo> traffic;
std::vector<flowEvent> flowInfo;
std::vector<uint64_t> pt;
}TrkObjs;
using TrkObjsPtr = std::shared_ptr<TrkObjs>;
......
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