Commit f310159d authored by ChenKun's avatar ChenKun 🕺🏿

add udp server

parent 368acc3b
GlobalConfig:
mec_id: "00000051"
FusionConfig:
thread: 4
center_lon: 0
center_lat: 0
fusion_stdout: true
log_indata: true
log_path: "/workspace/fusion_data/origin"
filter_radius: 130
fusion_radius: 130
vision_vehicle_out_radius: 130
vision_unvehicle_out_radius: 130
first_mode: "r"
create_fobj_mode: "rv"
check_objtype: true
filter_radar_nonvehicle: true
filter_radar_vehicle: false
filter_vision_nonvehicle: false
filter_vision_vehicle: false
filter_devid_r: []
filter_devid_v: []
dynamicDropFrame: true
heading_keep: []
......@@ -22,6 +22,7 @@
#include "fusionCsv.h"
#include "sensDevice.h"
#include "fusionDataLog.h"
#include "fusionUdpObj.h"
using namespace std;
......
#ifndef FUSION_UDP_OBJ_H
#define FUSION_UDP_OBJ_H
#include <cstdint>
#include <string>
#pragma pack(1)
typedef struct _UdpRadarObj
{
std::string id;
std::string strId;
std::string type;
int32_t vehType;
double vehL;
double vehW;
double vehH;
double xPos;
double yPos;
double speed;
double heading;
double dist;
double bearing;
double rcs;
double prop;
double lon;
double lat;
double alt;
int32_t objPos;
std::string cross_name;
std::string inner_pos;
} UdpRadarObj;
typedef struct _UdpRadarData
{
std::string device;
uint64_t tm;
std::string str_tm;
int32_t size;
UdpRadarObj objs[100];
uint64_t pt[];
} UdpRadarData;
#pragma pack()
#endif // FUSION_UDP_OBJ_H
\ No newline at end of file
<launch>
<arg name="rvfusion_config_path" default="/workspace/etc/rvfusion_config.yaml" />
<arg name="rvfusion_config_path" default="$(find jfx_multi_site)/config/rvfusion_config.yaml" />
<node pkg="jfx_rvfusion_cx" type="jfx_rvfusion_cx" name="jfx_rvfusion_cx" output="screen" respawn="true" >
<param name="config_file" value="$(arg rvfusion_config_path)" />
</node>
......
......@@ -160,14 +160,12 @@ void FusionDistributeTask::onVisionData(const jfx_common_msgs::det_tracking_arra
}
}
// ToDO: 用实际的结构代替这个
typedef struct _tagSTTempData {
} STTempData;
void FusionDistributeTask::udpSrv()
{
int socketHandle;
struct sockaddr_in server, client;
STTempData data;
UdpRadarData data;
socketHandle = socket(AF_INET, SOCK_DGRAM, 0);
if (-1 == socketHandle) {
......@@ -198,14 +196,32 @@ void FusionDistributeTask::udpSrv()
continue;
}
// ToDO: set tObjPtr value
UdpRadarData radar_data = {};
memcpy((void*)radar_data, data, (size_t)sizeof(data));
tObjPtr->mDevIDStr = radar_data.device;
tObjPtr->mModeStr = "r";
for (const auto obj : radar_data.objs) {
tObjPtr->mID = obj.id;
tObjPtr->mMS = obj.create_stamp;
tObjPtr->mLon = obj.lon;
tObjPtr->mLat = obj.lat;
tObjPtr->mAlt = 0;
tObjPtr->mHeading = obj.heading;
tObjPtr->mSpeed = obj.speed;
tObjPtr->mLength = obj.vehL;
tObjPtr->mWidth = obj.vehW;
tObjPtr->mHeight = obj.vehH;
tObjPtr->mXPos = obj.xPos;
tObjPtr->mYPos = obj.yPos;
tObjPtr->mTypeStr = obj.type;
tObjPtr->mSubType = 0;
mBufTrafficObjListMutex.lock();
mBufTrafficObjList.push_back(tObjPtr);
mBufTrafficObjListMutex.unlock();
}
mBufTrafficObjListMutex.lock();
mBufTrafficObjList.push_back(tObjPtr);
mBufTrafficObjListMutex.unlock();
close(socketHandle);
}
close(socketHandle);
}
void FusionDistributeTask::run()
......
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