Commit e08fcfbb authored by oscar's avatar oscar

提交发送给发布节点逻辑

parent 70f95b87
...@@ -133,6 +133,10 @@ int EventsRos::loadConfig(ros::NodeHandle& nh) ...@@ -133,6 +133,10 @@ int EventsRos::loadConfig(ros::NodeHandle& nh)
#if defined(_ROS_XISHAN_) || defined(_ROS_HEFEI_R_) || defined(_ROS_HEFEI_L_) #if defined(_ROS_XISHAN_) || defined(_ROS_HEFEI_R_) || defined(_ROS_HEFEI_L_)
m_pubFlow = nh.advertise<jfx_common_msgs::TrafficFlow>("/FlowData", 100); m_pubFlow = nh.advertise<jfx_common_msgs::TrafficFlow>("/FlowData", 100);
#endif #endif
#ifdef _SEND_MSG_TO_PUBLIC_ROS_
m_pub = nh.advertise<jfx_common_msgs::OutFusionEventObjs>("/FusionEventData", 100);
#endif
char url[1024] = { 0 }; char url[1024] = { 0 };
// 自有平台 // 自有平台
snprintf(url, 1023, "http://%s:%d/traffic/uploadParticipants", m_ip.c_str(), m_port); snprintf(url, 1023, "http://%s:%d/traffic/uploadParticipants", m_ip.c_str(), m_port);
...@@ -262,6 +266,10 @@ int EventsRos::Start() ...@@ -262,6 +266,10 @@ int EventsRos::Start()
#if defined(_ROS_XISHAN_) || defined(_ROS_HEFEI_R_) || defined(_ROS_HEFEI_L_) #if defined(_ROS_XISHAN_) || defined(_ROS_HEFEI_R_) || defined(_ROS_HEFEI_L_)
SendRosEvents(outs); SendRosEvents(outs);
#else #else
#if defined(_SEND_MSG_TO_PUBLIC_ROS_) && defined(_ROS_QICHECHENG_NEW_)
SendRosEvents(outs);
#endif
//SendEventsCb(outs); //SendEventsCb(outs);
std::thread tmp(&EventsRos::SendEventsCb, this, outs); std::thread tmp(&EventsRos::SendEventsCb, this, outs);
tmp.detach(); tmp.detach();
...@@ -287,7 +295,7 @@ int EventsRos::Start() ...@@ -287,7 +295,7 @@ int EventsRos::Start()
} }
void EventsRos::SendRosEvents(TrkObjsPtr& outs) void EventsRos::SendRosEvents(TrkObjsPtr& outs)
{ {
#if defined(_ROS_XISHAN_) || defined(_ROS_HEFEI_R_) || defined(_ROS_HEFEI_L_) #if defined(_ROS_XISHAN_) || defined(_ROS_HEFEI_R_) || defined(_ROS_HEFEI_L_) || defined(_SEND_MSG_TO_PUBLIC_ROS_)
jfx_common_msgs::OutFusionEventObjs eventMsgs = {}; jfx_common_msgs::OutFusionEventObjs eventMsgs = {};
for (auto& iter : outs->objs) for (auto& iter : outs->objs)
{ {
...@@ -432,6 +440,7 @@ void EventsRos::SendRosEvents(TrkObjsPtr& outs) ...@@ -432,6 +440,7 @@ void EventsRos::SendRosEvents(TrkObjsPtr& outs)
void EventsRos::SendEventsCb(TrkObjsPtr outs) void EventsRos::SendEventsCb(TrkObjsPtr outs)
{ {
#ifndef _SEND_MSG_TO_PUBLIC_ROS_
for (auto& iter : outs->objs) for (auto& iter : outs->objs)
{ {
SDK_IDX_LOG(1, SDK_INFO, "%s,%d,%llu,%lld,%s,%.10f,%.10f,%f,%f,%d,%d,%d,%d,%f,%d,%d,%d,%d,%d,%d", GetTimeStr(iter.time).c_str(), SDK_IDX_LOG(1, SDK_INFO, "%s,%d,%llu,%lld,%s,%.10f,%.10f,%f,%f,%d,%d,%d,%d,%f,%d,%d,%d,%d,%d,%d", GetTimeStr(iter.time).c_str(),
...@@ -440,6 +449,7 @@ void EventsRos::SendEventsCb(TrkObjsPtr outs) ...@@ -440,6 +449,7 @@ void EventsRos::SendEventsCb(TrkObjsPtr outs)
iter.eventList.size() > 1 ? iter.eventList[1].eventId : 0, iter.eventList.size() > 1 ? iter.eventList[1].eventType : 0, iter.eventList.size() > 1 ? iter.eventList[1].eventStatus : 0 iter.eventList.size() > 1 ? iter.eventList[1].eventId : 0, iter.eventList.size() > 1 ? iter.eventList[1].eventType : 0, iter.eventList.size() > 1 ? iter.eventList[1].eventStatus : 0
); );
} }
#endif
if (m_port == 0) if (m_port == 0)
return; return;
std::string response; std::string response;
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include "jfxrosperceiver/det_tracking_array.h" #include "jfxrosperceiver/det_tracking_array.h"
#endif #endif
#ifdef _SEND_MSG_TO_PUBLIC_ROS_ //发送消息到公共的发布节点
#include "jfx_common_msgs/OutFusionEventObjs.h"
#endif
/** /**
* @brief ros系统和event类衔接的类,ros的发送和接受都放到这里 * @brief ros系统和event类衔接的类,ros的发送和接受都放到这里
......
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