更新:1、新增数据记录功能,将过程数据录入数据库;
2、增加输入点迹数据、凝聚后点迹数据记录; Signed-off-by: waiwaylee <waiwaylee@foxmail.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "data_process.h"
|
||||
#include "rdp_log.h"
|
||||
#include "rdp_record.h"
|
||||
#include "rdp_record_entity.h"
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
@@ -17,6 +19,7 @@ int Data_Process::data_preprocess(struct DataRev Data_Input[150])
|
||||
{
|
||||
// 更新当前系统时间
|
||||
latest_timestamp = Data_Input[0].CPI_time;
|
||||
frame_id++;
|
||||
|
||||
//数据存入缓存区域 Data_buffer
|
||||
if(Data_Input[0].point_type == 0) //tws数据
|
||||
@@ -26,24 +29,35 @@ int Data_Process::data_preprocess(struct DataRev Data_Input[150])
|
||||
for (int i=0; i<data_num;i++)
|
||||
{
|
||||
PointRecv Data_buffer_temp;
|
||||
Data_buffer_temp.Amplitude=Data_Input[i].Amplitude;
|
||||
Data_buffer_temp.Azimuth=Data_Input[i].Azimuth/180*PI;
|
||||
Data_buffer_temp.snr = Data_Input[i].Snr;
|
||||
Data_buffer_temp.point_id = point_id++;
|
||||
Data_buffer_temp.frame_id = frame_id;
|
||||
Data_buffer_temp.amplitude=Data_Input[i].Amplitude;
|
||||
Data_buffer_temp.azimuth=Data_Input[i].Azimuth/180*PI;
|
||||
Data_buffer_temp.SNR = Data_Input[i].Snr;
|
||||
Data_buffer_temp.RCS = Data_Input[i].RCS;
|
||||
Data_buffer_temp.CPI_Time = Data_Input[i].CPI_time;
|
||||
Data_buffer_temp.CPI_time = Data_Input[i].CPI_time;
|
||||
Data_buffer_temp.GNSS_time = Data_Input[i].GNSS_time;
|
||||
Data_buffer_temp.Freq_index = Data_Input[i].Freq_index;
|
||||
Data_buffer_temp.freq_index = Data_Input[i].Freq_index;
|
||||
Data_buffer_temp.PRF_index = Data_Input[i].PRI;
|
||||
Data_buffer_temp.Range = Data_Input[i].Range;
|
||||
Data_buffer_temp.Height= Data_Input[i].Range*sin(Data_Input[i].Elevation/180*PI);
|
||||
Data_buffer_temp.Use_Flag = 0;
|
||||
Data_buffer_temp.Velocity = Data_Input[i].Velocity;
|
||||
|
||||
Data_buffer_temp.pitch_num = Data_Input[i].pitch_num;
|
||||
Data_buffer_temp.range = Data_Input[i].Range;
|
||||
Data_buffer_temp.height= Data_Input[i].Range*sin(Data_Input[i].Elevation/180*PI);
|
||||
Data_buffer_temp.use_flag = 0;
|
||||
Data_buffer_temp.velocity = Data_Input[i].Velocity;
|
||||
Data_buffer_temp.encoder_value = Data_Input[i].Encoder_value;
|
||||
Data_buffer_temp.pitch_beam_index = Data_Input[i].pitch_num;
|
||||
Data_buffer_temp.azimuth_beam_index = Data_Input[i].Beam_index_aiz;
|
||||
Data_buffer_temp.point_type = Data_Input[i].point_type;
|
||||
Data_buffer_temp.amp_asv_point = Data_Input[i].amp_asv;
|
||||
Data_buffer_temp.prn_fftn_point = Data_Input[i].prn_fftn;
|
||||
|
||||
std::memcpy(Data_buffer_temp.speed_dim, Data_Input[i].speed_dim, sizeof(Data_buffer_temp.speed_dim));
|
||||
std::memcpy(Data_buffer_temp.range_dim, Data_Input[i].range_dim, sizeof(Data_buffer_temp.range_dim));
|
||||
|
||||
//数据记录示例①:把本次接收的输入点迹写入表 RdpRecPointTws(字段为示例,可按需增删)。
|
||||
//记录功能关闭时该语句展开为空操作(实参不求值),交付构建不产生任何代码,
|
||||
//用法与新增记录点配方见 rdp_record.h 与 docs/data_record_debug.md。
|
||||
RDP_RECORD(RdpRecPoint(Data_buffer_temp));
|
||||
|
||||
Data_buffer.push_back(Data_buffer_temp);
|
||||
}
|
||||
|
||||
@@ -59,17 +73,6 @@ int Data_Process::data_preprocess(struct DataRev Data_Input[150])
|
||||
last_beam_num = Data_Input[0].Beam_index_aiz;
|
||||
return 2;
|
||||
}
|
||||
// if(Data_Input[0].Beam_index_aiz < last_beam_num) //TWS
|
||||
// {
|
||||
// last_beam_num = Data_Input[0].Beam_index_aiz;
|
||||
|
||||
// return 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// last_beam_num = Data_Input[0].Beam_index_aiz;
|
||||
// return 2;
|
||||
// }
|
||||
}
|
||||
|
||||
else if(Data_Input[0].point_type == 1) //tas数据
|
||||
@@ -82,22 +85,32 @@ int Data_Process::data_preprocess(struct DataRev Data_Input[150])
|
||||
for (int i=0; i<data_num;i++)
|
||||
{
|
||||
PointRecv Data_buffer_temp;
|
||||
Data_buffer_temp.Amplitude=Data_Input[i].Amplitude;
|
||||
Data_buffer_temp.Azimuth=Data_Input[i].Azimuth/180*PI;
|
||||
Data_buffer_temp.snr = Data_Input[i].Snr;
|
||||
Data_buffer_temp.point_id = point_id++;
|
||||
Data_buffer_temp.frame_id = frame_id;
|
||||
Data_buffer_temp.amplitude=Data_Input[i].Amplitude;
|
||||
Data_buffer_temp.azimuth=Data_Input[i].Azimuth/180*PI;
|
||||
Data_buffer_temp.SNR = Data_Input[i].Snr;
|
||||
Data_buffer_temp.RCS = Data_Input[i].RCS;
|
||||
Data_buffer_temp.CPI_Time = Data_Input[i].CPI_time;
|
||||
Data_buffer_temp.CPI_time = Data_Input[i].CPI_time;
|
||||
Data_buffer_temp.GNSS_time = Data_Input[i].GNSS_time;
|
||||
Data_buffer_temp.Freq_index = Data_Input[i].Freq_index;
|
||||
Data_buffer_temp.freq_index = Data_Input[i].Freq_index;
|
||||
Data_buffer_temp.PRF_index = Data_Input[i].PRI;
|
||||
Data_buffer_temp.Range = Data_Input[i].Range;
|
||||
Data_buffer_temp.Height= Data_Input[i].Range*sin(Data_Input[i].Elevation/180*PI);
|
||||
Data_buffer_temp.Use_Flag = 0;
|
||||
Data_buffer_temp.Velocity = Data_Input[i].Velocity;
|
||||
Data_buffer_temp.pitch_num = Data_Input[i].pitch_num;
|
||||
Data_buffer_temp.range = Data_Input[i].Range;
|
||||
Data_buffer_temp.height= Data_Input[i].Range*sin(Data_Input[i].Elevation/180*PI);
|
||||
Data_buffer_temp.use_flag = 0;
|
||||
Data_buffer_temp.velocity = Data_Input[i].Velocity;
|
||||
Data_buffer_temp.pitch_beam_index = Data_Input[i].pitch_num;
|
||||
Data_buffer_temp.encoder_value = Data_Input[i].Encoder_value;
|
||||
Data_buffer_temp.azimuth_beam_index = Data_Input[i].Beam_index_aiz;
|
||||
Data_buffer_temp.point_type = Data_Input[i].point_type;
|
||||
Data_buffer_temp.amp_asv_point = Data_Input[i].amp_asv;
|
||||
Data_buffer_temp.prn_fftn_point = Data_Input[i].prn_fftn;
|
||||
|
||||
std::memcpy(Data_buffer_temp.speed_dim, Data_Input[i].speed_dim, sizeof(Data_buffer_temp.speed_dim));
|
||||
std::memcpy(Data_buffer_temp.range_dim, Data_Input[i].range_dim, sizeof(Data_buffer_temp.range_dim));
|
||||
|
||||
RDP_RECORD(RdpRecPoint(Data_buffer_temp));
|
||||
|
||||
Data_buffer_tas.push_back(Data_buffer_temp);
|
||||
|
||||
// std::cout << "Azimuth:" << Data_Input[i].Azimuth
|
||||
@@ -118,6 +131,35 @@ int Data_Process::data_preprocess(struct DataRev Data_Input[150])
|
||||
|
||||
}
|
||||
|
||||
#ifdef RDP_RECORD_ENABLE
|
||||
//数据记录示例②:把本圈输出的航迹批量写入表 RdpRecTrackOut(TWS/TAS 共用一张表,用 track_mode 区分)。
|
||||
//该辅助函数只在记录功能开启时编译(RDP_RECORD_ENABLE 由构建系统定义),交付构建完全不参与编译
|
||||
static void rdp_record_output_tracks(struct Track Trust_Track_Output[][10], int track_num)
|
||||
{
|
||||
if (track_num <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (track_num > MAX_TRACK_NUM) //防御:输出行数理论上不应超过航迹容量(见 README 11.2 BUG-08)
|
||||
{
|
||||
track_num = MAX_TRACK_NUM;
|
||||
}
|
||||
|
||||
std::vector<RdpRecTrackOut> recs;
|
||||
recs.reserve(static_cast<size_t>(track_num));
|
||||
for (int i = 0; i < track_num; ++i)
|
||||
{
|
||||
const struct Track &t = Trust_Track_Output[i][0]; //每行第 0 列为该航迹的主记录
|
||||
recs.push_back(RdpRecTrackOut{0, t.Track_Index, t.Track_Mode, t.Point_Sum, t.Flag_Point,
|
||||
t.Flag_Direction, t.GNSS_time, t.track_time,
|
||||
t.x, t.y, t.z, t.v_x, t.v_y, t.v_z,
|
||||
t.Range, t.Azimuth, t.Elevation, t.Range_V,
|
||||
t.track_snr, t.track_rcs});
|
||||
}
|
||||
RDP_RECORD_BATCH(recs);
|
||||
}
|
||||
#endif
|
||||
|
||||
//数据处理
|
||||
int Data_Process::track_process(struct Track Trust_Track_Output[MAX_TRACK_NUM][10],
|
||||
int *Trust_track_num_Output,
|
||||
@@ -131,7 +173,6 @@ int model)
|
||||
{
|
||||
|
||||
dot_coh.dot_coh_process_buff(&Data_buffer,&point_recv,Work_Parameter);
|
||||
//std::cout << "point_recv :" <<point_recv.size();
|
||||
std::vector<PointRecv>().swap(Data_buffer);
|
||||
}
|
||||
|
||||
@@ -188,6 +229,14 @@ int model)
|
||||
//std::cout << "Extrapolate_round :" << trust_track[TAS_track_idx].Extrapolate_round;
|
||||
}
|
||||
|
||||
//数据记录示例②:本圈输出的航迹(仅 TWS/TAS 处理帧有输出;记录功能关闭时不产生任何代码)
|
||||
#ifdef RDP_RECORD_ENABLE
|
||||
if (model == 1 || model == 3)
|
||||
{
|
||||
rdp_record_output_tracks(Trust_Track_Output, *Trust_track_num_Output);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,10 @@ private:
|
||||
|
||||
long long latest_timestamp = 0; //最新时间戳
|
||||
|
||||
long long point_id = 0; //点迹id
|
||||
|
||||
long long frame_id = 0; //帧id
|
||||
|
||||
struct RadarPara Work_Parameter; //工作参数 参数设置函数外部输入
|
||||
|
||||
Dot_Coh dot_coh; //点迹凝聚
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "data_process_class_dll.h"
|
||||
#include "data_process.h"
|
||||
#include "rdp_log.h"
|
||||
#include "rdp_record.h"
|
||||
|
||||
/*
|
||||
Data_process_class_dll::Data_process_class_dll()
|
||||
@@ -19,6 +20,11 @@ Data_process_class_dll *Data_Process_Factory::GetB()
|
||||
{
|
||||
//初始化日志输出:RDP_LOG_ENABLE 开启时重定向 std::cout 到日志文件
|
||||
//rdp_log::Init();
|
||||
|
||||
//初始化数据记录:RDP_DATA_RECORD 开启时创建记录目录、打开本次运行的记录库;
|
||||
//关闭时 rdp_record::Init() 为空实现,不产生任何开销
|
||||
rdp_record::Init();
|
||||
|
||||
p=new Data_Process();
|
||||
}
|
||||
|
||||
@@ -36,5 +42,8 @@ void Data_Process_Factory::Destroy()
|
||||
|
||||
//恢复 std::cout 到控制台并关闭日志文件
|
||||
//rdp_log::Shutdown();
|
||||
|
||||
//关闭记录库(RDP_DATA_RECORD 关闭时为空实现)
|
||||
rdp_record::Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include "rdp_record.h"
|
||||
#include "rdp_record_entity.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int Dot_Coh::dot_coh_process(std::vector <PointRecv> *data_input,
|
||||
@@ -14,20 +17,20 @@ int Dot_Coh::dot_coh_process(std::vector <PointRecv> *data_input,
|
||||
|
||||
for (unsigned int loop_of_point=0; loop_of_point<data_input->size()-1;loop_of_point++ )
|
||||
{
|
||||
if( (*data_input)[loop_of_point].Use_Flag!=1)
|
||||
if( (*data_input)[loop_of_point].use_flag!=1)
|
||||
{
|
||||
float point_0_R=static_cast<float>((*data_input)[loop_of_point].Range);
|
||||
float point_0_V=static_cast<float>((*data_input)[loop_of_point].Velocity);
|
||||
float point_0_F=static_cast<float>((*data_input)[loop_of_point].Azimuth);
|
||||
float point_0_A=static_cast<float>((*data_input)[loop_of_point].Amplitude);
|
||||
float point_0_R=static_cast<float>((*data_input)[loop_of_point].range);
|
||||
float point_0_V=static_cast<float>((*data_input)[loop_of_point].velocity);
|
||||
float point_0_F=static_cast<float>((*data_input)[loop_of_point].azimuth);
|
||||
float point_0_A=static_cast<float>((*data_input)[loop_of_point].amplitude);
|
||||
for (unsigned int i=loop_of_point+1;i<data_input->size();i++)
|
||||
{
|
||||
if((*data_input)[loop_of_point].Use_Flag!=1 && (*data_input)[i].Use_Flag!=1)
|
||||
if((*data_input)[loop_of_point].use_flag!=1 && (*data_input)[i].use_flag!=1)
|
||||
{
|
||||
float point_1_R=static_cast<float>((*data_input)[i].Range);
|
||||
float point_1_V=static_cast<float>((*data_input)[i].Velocity);
|
||||
float point_1_F=static_cast<float>((*data_input)[i].Azimuth);
|
||||
float point_1_A=static_cast<float>((*data_input)[i].Amplitude);
|
||||
float point_1_R=static_cast<float>((*data_input)[i].range);
|
||||
float point_1_V=static_cast<float>((*data_input)[i].velocity);
|
||||
float point_1_F=static_cast<float>((*data_input)[i].azimuth);
|
||||
float point_1_A=static_cast<float>((*data_input)[i].amplitude);
|
||||
|
||||
//凝聚条件: 距离、方位接近
|
||||
if(Work_Parameter.work_mode == 0)
|
||||
@@ -36,16 +39,16 @@ int Dot_Coh::dot_coh_process(std::vector <PointRecv> *data_input,
|
||||
if( (fabs(point_0_R-point_1_R)<=DOT_COH_RANGE && delta_F <=DOT_COH_AZI/180.0*PI && fabs(point_0_V-point_1_V)<=DOT_COH_V)//
|
||||
&& point_0_A <point_1_A )//
|
||||
{
|
||||
point_0_R=static_cast<float>((*data_input)[i].Range);
|
||||
point_0_V=static_cast<float>((*data_input)[i].Velocity);
|
||||
point_0_A=static_cast<float>((*data_input)[i].Amplitude);
|
||||
point_0_F=static_cast<float>((*data_input)[i].Azimuth);
|
||||
(*data_input)[loop_of_point].Use_Flag=1;
|
||||
point_0_R=static_cast<float>((*data_input)[i].range);
|
||||
point_0_V=static_cast<float>((*data_input)[i].velocity);
|
||||
point_0_A=static_cast<float>((*data_input)[i].amplitude);
|
||||
point_0_F=static_cast<float>((*data_input)[i].azimuth);
|
||||
(*data_input)[loop_of_point].use_flag=1;
|
||||
}
|
||||
else if( (fabs(point_0_R-point_1_R)<=DOT_COH_RANGE && delta_F <=DOT_COH_AZI/180.0*PI && fabs(point_0_V-point_1_V)<=DOT_COH_V)//
|
||||
&& point_0_A >= point_1_A)//
|
||||
{
|
||||
(*data_input)[i].Use_Flag=1;
|
||||
(*data_input)[i].use_flag=1;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -54,16 +57,16 @@ int Dot_Coh::dot_coh_process(std::vector <PointRecv> *data_input,
|
||||
if( (fabs(point_0_R-point_1_R)<=DOT_COH_RANGE && delta_F <=DOT_COH_AZI/180.0*PI )//
|
||||
&& point_0_A <point_1_A )//
|
||||
{
|
||||
point_0_R=static_cast<float>((*data_input)[i].Range);
|
||||
point_0_V=static_cast<float>((*data_input)[i].Velocity);
|
||||
point_0_A=static_cast<float>((*data_input)[i].Amplitude);
|
||||
point_0_F=static_cast<float>((*data_input)[i].Azimuth);
|
||||
(*data_input)[loop_of_point].Use_Flag=1;
|
||||
point_0_R=static_cast<float>((*data_input)[i].range);
|
||||
point_0_V=static_cast<float>((*data_input)[i].velocity);
|
||||
point_0_A=static_cast<float>((*data_input)[i].amplitude);
|
||||
point_0_F=static_cast<float>((*data_input)[i].azimuth);
|
||||
(*data_input)[loop_of_point].use_flag=1;
|
||||
}
|
||||
else if( (fabs(point_0_R-point_1_R)<=DOT_COH_RANGE && delta_F <=DOT_COH_AZI/180.0*PI )//
|
||||
&& point_0_A >= point_1_A)//
|
||||
{
|
||||
(*data_input)[i].Use_Flag=1;
|
||||
(*data_input)[i].use_flag=1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -77,7 +80,7 @@ int Dot_Coh::dot_coh_process(std::vector <PointRecv> *data_input,
|
||||
std::vector <PointRecv>::iterator Iter;
|
||||
for (Iter=data_input->begin(); Iter!=data_input->end();)
|
||||
{
|
||||
if((*Iter).Use_Flag==1 || (*Iter).Range <R_MIN || (*Iter).Range > R_MAX )
|
||||
if((*Iter).use_flag==1 || (*Iter).range <R_MIN || (*Iter).range > R_MAX )
|
||||
{
|
||||
data_input->erase(Iter);
|
||||
Iter=data_input->begin();
|
||||
@@ -130,20 +133,20 @@ int Dot_Coh::dot_coh_process_buff( std::vector <PointRecv> *data_input,
|
||||
|
||||
for (unsigned int loop_of_point=0; loop_of_point<data_tmp.size()-1;loop_of_point++ )
|
||||
{
|
||||
if( data_tmp[loop_of_point].Use_Flag!=1)
|
||||
if( data_tmp[loop_of_point].use_flag!=1)
|
||||
{
|
||||
float point_0_R=static_cast<float>(data_tmp[loop_of_point].Range);
|
||||
float point_0_V=static_cast<float>(data_tmp[loop_of_point].Velocity);
|
||||
float point_0_F=static_cast<float>(data_tmp[loop_of_point].Azimuth);
|
||||
float point_0_A=static_cast<float>(data_tmp[loop_of_point].Amplitude);
|
||||
float point_0_R=static_cast<float>(data_tmp[loop_of_point].range);
|
||||
float point_0_V=static_cast<float>(data_tmp[loop_of_point].velocity);
|
||||
float point_0_F=static_cast<float>(data_tmp[loop_of_point].azimuth);
|
||||
float point_0_A=static_cast<float>(data_tmp[loop_of_point].amplitude);
|
||||
for (unsigned int i=loop_of_point+1;i<data_tmp.size();i++)
|
||||
{
|
||||
if(data_tmp[loop_of_point].Use_Flag!=1 && data_tmp[i].Use_Flag!=1)
|
||||
if(data_tmp[loop_of_point].use_flag!=1 && data_tmp[i].use_flag!=1)
|
||||
{
|
||||
float point_1_R=static_cast<float>(data_tmp[i].Range);
|
||||
float point_1_V=static_cast<float>(data_tmp[i].Velocity);
|
||||
float point_1_F=static_cast<float>(data_tmp[i].Azimuth);
|
||||
float point_1_A=static_cast<float>(data_tmp[i].Amplitude);
|
||||
float point_1_R=static_cast<float>(data_tmp[i].range);
|
||||
float point_1_V=static_cast<float>(data_tmp[i].velocity);
|
||||
float point_1_F=static_cast<float>(data_tmp[i].azimuth);
|
||||
float point_1_A=static_cast<float>(data_tmp[i].amplitude);
|
||||
|
||||
//凝聚条件: 距离、方位接近
|
||||
if(Work_Parameter.work_mode == 0)
|
||||
@@ -152,16 +155,16 @@ int Dot_Coh::dot_coh_process_buff( std::vector <PointRecv> *data_input,
|
||||
if( (fabs(point_0_R-point_1_R)<=DOT_COH_RANGE && delta_F <=DOT_COH_AZI/180.0*PI && fabs(point_0_V-point_1_V)<=DOT_COH_V)//
|
||||
&& point_0_A <point_1_A )//
|
||||
{
|
||||
point_0_R=static_cast<float>(data_tmp[i].Range);
|
||||
point_0_V=static_cast<float>(data_tmp[i].Velocity);
|
||||
point_0_A=static_cast<float>(data_tmp[i].Amplitude);
|
||||
point_0_F=static_cast<float>(data_tmp[i].Azimuth);
|
||||
data_tmp[loop_of_point].Use_Flag=1;
|
||||
point_0_R=static_cast<float>(data_tmp[i].range);
|
||||
point_0_V=static_cast<float>(data_tmp[i].velocity);
|
||||
point_0_A=static_cast<float>(data_tmp[i].amplitude);
|
||||
point_0_F=static_cast<float>(data_tmp[i].azimuth);
|
||||
data_tmp[loop_of_point].use_flag=1;
|
||||
}
|
||||
else if( (fabs(point_0_R-point_1_R)<=DOT_COH_RANGE && delta_F <=DOT_COH_AZI/180.0*PI && fabs(point_0_V-point_1_V)<=DOT_COH_V)//
|
||||
&& point_0_A >= point_1_A)//
|
||||
{
|
||||
data_tmp[i].Use_Flag=1;
|
||||
data_tmp[i].use_flag=1;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -170,16 +173,16 @@ int Dot_Coh::dot_coh_process_buff( std::vector <PointRecv> *data_input,
|
||||
if( (fabs(point_0_R-point_1_R)<=DOT_COH_RANGE && delta_F <=DOT_COH_AZI/180.0*PI )//
|
||||
&& point_0_A <point_1_A )//
|
||||
{
|
||||
point_0_R=static_cast<float>(data_tmp[i].Range);
|
||||
point_0_V=static_cast<float>(data_tmp[i].Velocity);
|
||||
point_0_A=static_cast<float>(data_tmp[i].Amplitude);
|
||||
point_0_F=static_cast<float>(data_tmp[i].Azimuth);
|
||||
data_tmp[loop_of_point].Use_Flag=1;
|
||||
point_0_R=static_cast<float>(data_tmp[i].range);
|
||||
point_0_V=static_cast<float>(data_tmp[i].velocity);
|
||||
point_0_A=static_cast<float>(data_tmp[i].amplitude);
|
||||
point_0_F=static_cast<float>(data_tmp[i].azimuth);
|
||||
data_tmp[loop_of_point].use_flag=1;
|
||||
}
|
||||
else if( (fabs(point_0_R-point_1_R)<=DOT_COH_RANGE && delta_F <=DOT_COH_AZI/180.0*PI )//
|
||||
&& point_0_A >= point_1_A)//
|
||||
{
|
||||
data_tmp[i].Use_Flag=1;
|
||||
data_tmp[i].use_flag=1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -193,7 +196,7 @@ int Dot_Coh::dot_coh_process_buff( std::vector <PointRecv> *data_input,
|
||||
std::vector <PointRecv>::iterator Iter;
|
||||
for (Iter=data_tmp.begin(); Iter!=data_tmp.end();)
|
||||
{
|
||||
if((*Iter).Use_Flag==1 || (*Iter).Range <R_MIN || (*Iter).Range > R_MAX )
|
||||
if((*Iter).use_flag==1 || (*Iter).range <R_MIN || (*Iter).range > R_MAX )
|
||||
{
|
||||
data_tmp.erase(Iter);
|
||||
Iter=data_tmp.begin();
|
||||
@@ -223,7 +226,8 @@ int Dot_Coh::dot_coh_process_buff( std::vector <PointRecv> *data_input,
|
||||
|
||||
for (size_t i=0;i<data_input_buff.size();i++)
|
||||
{
|
||||
(*point_recv).push_back(data_input_buff[i]);
|
||||
(*point_recv).push_back(data_input_buff[i]);
|
||||
RDP_RECORD(RdpRecPointCohesionTWS(data_input_buff[i]));
|
||||
}
|
||||
|
||||
std::vector<PointRecv>().swap(data_input_buff);
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include "rdp_record.h"
|
||||
#include "rdp_record_entity.h"
|
||||
using namespace std;
|
||||
|
||||
int Dot_Coh_TAS::dot_coh_tas_process(std::vector <PointRecv> *data_input, //输入点迹
|
||||
@@ -14,36 +16,36 @@ int Dot_Coh_TAS::dot_coh_tas_process(std::vector <PointRecv> *dat
|
||||
|
||||
for (size_t loop_of_point=0; loop_of_point<data_input->size()-1;loop_of_point++ )
|
||||
{
|
||||
if( (*data_input)[loop_of_point].Use_Flag!=1)
|
||||
if( (*data_input)[loop_of_point].use_flag!=1)
|
||||
{
|
||||
float point_0_R=static_cast<float>((*data_input)[loop_of_point].Range);
|
||||
float point_0_V=static_cast<float>((*data_input)[loop_of_point].Velocity);
|
||||
float point_0_F=static_cast<float>((*data_input)[loop_of_point].Azimuth);
|
||||
float point_0_A=static_cast<float>((*data_input)[loop_of_point].Amplitude);
|
||||
float point_0_R=static_cast<float>((*data_input)[loop_of_point].range);
|
||||
float point_0_V=static_cast<float>((*data_input)[loop_of_point].velocity);
|
||||
float point_0_F=static_cast<float>((*data_input)[loop_of_point].azimuth);
|
||||
float point_0_A=static_cast<float>((*data_input)[loop_of_point].amplitude);
|
||||
for ( size_t i=loop_of_point+1;i<(*data_input).size();i++)
|
||||
{
|
||||
if((*data_input)[loop_of_point].Use_Flag!=1 && (*data_input)[i].Use_Flag!=1)
|
||||
if((*data_input)[loop_of_point].use_flag!=1 && (*data_input)[i].use_flag!=1)
|
||||
{
|
||||
float point_1_R=static_cast<float>((*data_input)[i].Range);
|
||||
float point_1_V=static_cast<float>((*data_input)[i].Velocity);
|
||||
float point_1_F=static_cast<float>((*data_input)[i].Azimuth);
|
||||
float point_1_A=static_cast<float>((*data_input)[i].Amplitude);
|
||||
float point_1_R=static_cast<float>((*data_input)[i].range);
|
||||
float point_1_V=static_cast<float>((*data_input)[i].velocity);
|
||||
float point_1_F=static_cast<float>((*data_input)[i].azimuth);
|
||||
float point_1_A=static_cast<float>((*data_input)[i].amplitude);
|
||||
|
||||
//凝聚条件: 距离、方位接近
|
||||
float delta_F = fabs(point_0_F-point_1_F)<2*PI-fabs(point_0_F-point_1_F) ? fabs(point_0_F-point_1_F) :2*PI-fabs(point_0_F-point_1_F);
|
||||
if( (fabs(point_0_R-point_1_R)<=DOT_COH_RANGE && delta_F <=DOT_COH_AZI/180.0*PI && fabs(point_0_V-point_1_V)<=DOT_COH_V)
|
||||
&& point_0_A <point_1_A )
|
||||
{
|
||||
point_0_R=static_cast<float>((*data_input)[i].Range);
|
||||
point_0_V=static_cast<float>((*data_input)[i].Velocity);
|
||||
point_0_A=static_cast<float>((*data_input)[i].Amplitude);
|
||||
point_0_F=static_cast<float>((*data_input)[i].Azimuth);
|
||||
(*data_input)[loop_of_point].Use_Flag=1;
|
||||
point_0_R=static_cast<float>((*data_input)[i].range);
|
||||
point_0_V=static_cast<float>((*data_input)[i].velocity);
|
||||
point_0_A=static_cast<float>((*data_input)[i].amplitude);
|
||||
point_0_F=static_cast<float>((*data_input)[i].azimuth);
|
||||
(*data_input)[loop_of_point].use_flag=1;
|
||||
}
|
||||
else if( (fabs(point_0_R-point_1_R)<=DOT_COH_RANGE && delta_F <=DOT_COH_AZI/180.0*PI && fabs(point_0_V-point_1_V)<=DOT_COH_V)
|
||||
&& point_0_A >= point_1_A)
|
||||
{
|
||||
(*data_input)[i].Use_Flag=1;
|
||||
(*data_input)[i].use_flag=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +56,7 @@ int Dot_Coh_TAS::dot_coh_tas_process(std::vector <PointRecv> *dat
|
||||
std::vector <PointRecv>::iterator Iter;
|
||||
for (Iter=data_input->begin(); Iter!=data_input->end();)
|
||||
{
|
||||
if((*Iter).Use_Flag==1 || (*Iter).Range <R_MIN || (*Iter).Range > R_MAX )
|
||||
if((*Iter).use_flag==1 || (*Iter).range <R_MIN || (*Iter).range > R_MAX )
|
||||
{
|
||||
data_input->erase(Iter);
|
||||
Iter=data_input->begin();
|
||||
@@ -68,6 +70,7 @@ int Dot_Coh_TAS::dot_coh_tas_process(std::vector <PointRecv> *dat
|
||||
for (size_t i=0;i<data_input->size();i++)
|
||||
{
|
||||
(*point_recv_tas).push_back((*data_input)[i]);
|
||||
RDP_RECORD(RdpRecPointCohesionTAS((*data_input)[i]));
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -18,6 +18,15 @@
|
||||
//日志文件输出目录(相对当前工作目录的路径,目录不存在时自动创建)
|
||||
#define RDP_LOG_DIR ".\\rdp_logs\\"
|
||||
|
||||
/**********************************数据记录调试开关*******************************************/
|
||||
// 数据记录调试功能(结构体 -> SQLite 数据表,ORM 由内置 ormpp 完成)由 CMake 选项
|
||||
// RDP_DATA_RECORD(AUTO/ON/OFF)控制:AUTO 时 Debug 构建启用、Release 构建关闭(交付默认)。
|
||||
// 启用时由构建系统定义 RDP_RECORD_ENABLE,记录模块(rdp_record.cpp + sqlite3)才参与编译;
|
||||
// 关闭时 RDP_RECORD 宏展开为 ((void)0),实参不求值,不做任何记录、不留任何运行开销。
|
||||
// 注意:此处不提供手工开关宏,请在构建配置中选择(详见 docs/data_record_debug.md)。
|
||||
//记录数据库存放目录(相对宿主进程当前工作目录,不存在时自动创建)
|
||||
#define RDP_RECORD_DB_DIR ".\\rdp_records\\"
|
||||
|
||||
//#define MECHANICAL_SCANNING
|
||||
//#define PHASE_SCANNING
|
||||
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
/***********************************数据记录调试模块实现****************************************/
|
||||
// 本文件仅在构建系统定义 RDP_RECORD_ENABLE(CMake 选项 RDP_DATA_RECORD 开启)时参与编译,
|
||||
// 且以 C++20 编译(ormpp 要求);雷达处理代码仍为 C++17,二者通过 rdp_record.h 的
|
||||
// 「仅声明 + 显式实例化」跨标准边界,详见 docs/data_record_debug.md。
|
||||
#ifdef RDP_RECORD_ENABLE
|
||||
|
||||
#include "rdp_record.h"
|
||||
#include "rdp_record_entity.h"
|
||||
#include "parameters.h"
|
||||
#include "rdp_log.h"
|
||||
|
||||
#include <climits>
|
||||
#include <direct.h>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <time.h>
|
||||
#include <vector>
|
||||
|
||||
//第三方库(ormpp / iguana)模板代码在 /W3 下可能产生告警,按 third_party/ormpp/UPSTREAM.md
|
||||
//的约定在此隔离;本文件自身的逻辑仍按工程 /W3 标准编译
|
||||
#pragma warning(push, 0)
|
||||
#include "dbng.hpp"
|
||||
#include "sqlite.hpp"
|
||||
#pragma warning(pop)
|
||||
|
||||
//记录实体写入函数的显式实例化宏(与 rdp_record_entity.h 的 RDP_RECORD_DECLARE 配套使用)
|
||||
#define RDP_RECORD_DEFINE(Entity) \
|
||||
template void rdp_record::Write<Entity>(const Entity&); \
|
||||
template void rdp_record::Write<Entity>(const std::vector<Entity>&)
|
||||
|
||||
namespace
|
||||
{
|
||||
//记录模块内部状态(Pimpl:ormpp / SQLite 类型不出现在 rdp_record.h 中)
|
||||
struct Record_State
|
||||
{
|
||||
ormpp::dbng<ormpp::sqlite> db; //SQLite 连接(单连接,写入时串行使用)
|
||||
std::string path; //当前 db 文件全路径
|
||||
bool ready; //是否已成功打开并完成初始化
|
||||
bool failed; //初始化失败:后续写入全部忽略,不再反复报错
|
||||
std::mutex mtx; //写入串行化(宿主多线程调用时保护单连接)
|
||||
|
||||
Record_State() : ready(false), failed(false) {}
|
||||
};
|
||||
|
||||
std::unique_ptr<Record_State>& State()
|
||||
{
|
||||
//函数内静态:宿主未调用 Data_Process_Factory::Destroy() 时由析构兜底关库
|
||||
static std::unique_ptr<Record_State> s;
|
||||
return s;
|
||||
}
|
||||
|
||||
//当前本地时间字符串,格式 "YYYYMMDD_HHMMSS"(与 rdp_log 的日志文件命名风格一致)
|
||||
bool TimeStamp(char* buf, size_t size)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
struct tm local;
|
||||
if (localtime_s(&local, &now) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return strftime(buf, size, "%Y%m%d_%H%M%S", &local) != 0;
|
||||
}
|
||||
|
||||
//写入失败提示(「每个实体只提示一次」由调用方的静态标志控制)
|
||||
void ReportError(Record_State& st, const char* what)
|
||||
{
|
||||
RDP_LOG << "[rdp_record] " << what << " failed: " << st.db.get_last_error() << std::endl;
|
||||
}
|
||||
|
||||
//确保实体的数据表存在:每个实体类型只尝试建表一次(失败后该实体永久跳过)
|
||||
//注意:ormpp 的 ormpp_auto_key 定义在全局命名空间(third_party/ormpp/ormpp/entity.hpp),
|
||||
// 传该参数可在建表时登记自增主键,使后续插入自动跳过 id 列
|
||||
template <typename T>
|
||||
bool EnsureTable(Record_State& st)
|
||||
{
|
||||
static const bool created = st.db.create_datatable<T>(::ormpp_auto_key{"id"});
|
||||
return created;
|
||||
}
|
||||
|
||||
//写入前置处理:自动建表;返回 true 表示可以向该表写入
|
||||
template <typename T>
|
||||
bool PrepareWrite(Record_State& st)
|
||||
{
|
||||
static bool reported = false;
|
||||
if (EnsureTable<T>(st))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!reported)
|
||||
{
|
||||
reported = true;
|
||||
ReportError(st, "create table");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace rdp_record
|
||||
{
|
||||
bool Init()
|
||||
{
|
||||
std::unique_ptr<Record_State>& sp = State();
|
||||
if (sp.get() != 0)
|
||||
{
|
||||
return sp->ready; //已经初始化过(含失败的幂等返回)
|
||||
}
|
||||
|
||||
sp.reset(new Record_State());
|
||||
Record_State& st = *sp;
|
||||
|
||||
//创建记录目录(目录已存在时 _mkdir 返回 EEXIST,忽略;逻辑与 rdp_log.cpp 一致)
|
||||
std::string dir = RDP_RECORD_DB_DIR;
|
||||
while (dir.size() > 0 && (dir[dir.size() - 1] == '\\' || dir[dir.size() - 1] == '/'))
|
||||
{
|
||||
dir.erase(dir.size() - 1);
|
||||
}
|
||||
if (dir.size() > 0)
|
||||
{
|
||||
_mkdir(dir.c_str());
|
||||
}
|
||||
|
||||
//按当前日期+时间生成记录库文件名:rdp_record_YYYYMMDD_HHMMSS.db
|
||||
char stamp[32] = {0};
|
||||
if (!TimeStamp(stamp, sizeof(stamp)))
|
||||
{
|
||||
RDP_LOG << "[rdp_record] cannot get local time, recording disabled" << std::endl;
|
||||
st.failed = true;
|
||||
return false;
|
||||
}
|
||||
st.path = RDP_RECORD_DB_DIR;
|
||||
st.path += "rdp_record_";
|
||||
st.path += stamp;
|
||||
st.path += ".db";
|
||||
|
||||
if (!st.db.connect(st.path))
|
||||
{
|
||||
RDP_LOG << "[rdp_record] cannot open database: " << st.path << std::endl;
|
||||
st.failed = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//调试用途的性能取舍:关闭同步刷盘(提交时不再 fsync),崩溃时可能丢失尾部数据;
|
||||
//如需崩溃安全可改为 PRAGMA synchronous=NORMAL(或在 sqlite3 层自行开启 WAL)。
|
||||
//注意:ormpp 的 execute() 只接受「不返回结果行」的语句,故不在此设置 journal_mode。
|
||||
st.db.execute("PRAGMA synchronous=OFF;");
|
||||
|
||||
st.ready = true;
|
||||
RDP_LOG << "[rdp_record] enabled, database: " << st.path << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
{
|
||||
std::unique_ptr<Record_State>& sp = State();
|
||||
if (sp.get() == 0 || !sp->ready)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(sp->mtx);
|
||||
RDP_LOG << "[rdp_record] shutdown, database: " << sp->path << std::endl;
|
||||
sp->db.disconnect();
|
||||
sp->ready = false; //path 保留,便于宿主在关库后仍能取到本次记录库路径
|
||||
}
|
||||
|
||||
std::string db_path()
|
||||
{
|
||||
std::unique_ptr<Record_State>& sp = State();
|
||||
return (sp.get() == 0) ? std::string() : sp->path;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Write(const T& v)
|
||||
{
|
||||
std::unique_ptr<Record_State>& sp = State();
|
||||
if (sp.get() == 0 || !sp->ready || sp->failed)
|
||||
{
|
||||
return; //未初始化 / 初始化失败 / 已关库:静默忽略
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(sp->mtx);
|
||||
if (!PrepareWrite<T>(*sp))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//写入失败时每个实体只提示一次:不重试、不抛出、不影响雷达数据处理
|
||||
static bool reported = false;
|
||||
if (sp->db.insert(v) == INT_MIN && !reported)
|
||||
{
|
||||
reported = true;
|
||||
ReportError(*sp, "insert");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Write(const std::vector<T>& v)
|
||||
{
|
||||
if (v.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::unique_ptr<Record_State>& sp = State();
|
||||
if (sp.get() == 0 || !sp->ready || sp->failed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(sp->mtx);
|
||||
if (!PrepareWrite<T>(*sp))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//写入失败时每个实体只提示一次:不重试、不抛出、不影响雷达数据处理
|
||||
static bool reported = false;
|
||||
if (sp->db.insert(v) == INT_MIN && !reported)
|
||||
{
|
||||
reported = true;
|
||||
ReportError(*sp, "insert");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************记录实体注册区*********************************************/
|
||||
// 新增记录实体时在此追加两行(字段顺序必须与 rdp_record_entity.h 中的结构体声明顺序一致):
|
||||
// YLT_REFL(结构体名, 字段1, 字段2, ...);
|
||||
// RDP_RECORD_DEFINE(结构体名);
|
||||
|
||||
//输入点迹
|
||||
YLT_REFL(RdpRecPoint, id,point_id,frame_id,range,azimuth, velocity,amplitude ,height,SNR,RCS,
|
||||
encoder_value,amp_asv_point,prn_fftn_point,CPI_time,GNSS_time,use_flag,azimuth_beam_index,pitch_beam_index,PRF_index,freq_index,point_type,point_section_asso);
|
||||
RDP_RECORD_DEFINE(RdpRecPoint);
|
||||
|
||||
//TWS凝聚后点迹
|
||||
YLT_REFL(RdpRecPointCohesionTWS, id,point_id,frame_id,range,azimuth, velocity,amplitude ,height,SNR,RCS,
|
||||
encoder_value,amp_asv_point,prn_fftn_point,CPI_time,GNSS_time,use_flag,azimuth_beam_index,pitch_beam_index,PRF_index,freq_index,point_type,point_section_asso);
|
||||
RDP_RECORD_DEFINE(RdpRecPointCohesionTWS);
|
||||
|
||||
//TAS凝聚后点迹
|
||||
YLT_REFL(RdpRecPointCohesionTAS, id,point_id,frame_id,range,azimuth, velocity,amplitude ,height,SNR,RCS,
|
||||
encoder_value,amp_asv_point,prn_fftn_point,CPI_time,GNSS_time,use_flag,azimuth_beam_index,pitch_beam_index,PRF_index,freq_index,point_type,point_section_asso);
|
||||
RDP_RECORD_DEFINE(RdpRecPointCohesionTAS);
|
||||
|
||||
// 示例②:本圈输出的航迹
|
||||
YLT_REFL(RdpRecTrackOut, id, track_index, track_mode, point_sum, flag_point, flag_direction,
|
||||
gnss_time_ms, track_time_s, x, y, z, v_x, v_y, v_z, range_m, azi_deg, elev_deg,
|
||||
range_v_mps, snr, rcs);
|
||||
RDP_RECORD_DEFINE(RdpRecTrackOut);
|
||||
|
||||
#endif // RDP_RECORD_ENABLE
|
||||
@@ -0,0 +1,56 @@
|
||||
#ifndef RDP_RECORD_H
|
||||
#define RDP_RECORD_H
|
||||
#pragma once
|
||||
/***********************************数据记录调试模块********************************************/
|
||||
// 功能(完整说明见 docs/data_record_debug.md):
|
||||
// 1) 把结构体数据按「一个记录实体一张表」的方式写入 SQLite 数据库,结构体到数据表的映射由
|
||||
// 内置的 ormpp 完成(third_party/ormpp,见该目录 UPSTREAM.md);
|
||||
// 2) 整个功能由构建开关控制:CMake 选项 RDP_DATA_RECORD(AUTO/ON/OFF)开启时由构建系统定义
|
||||
// RDP_RECORD_ENABLE,rdp_record.cpp 与 sqlite3 amalgamation 才参与编译;关闭(交付/Release
|
||||
// 构建默认)时本模块完全不编译,RDP_RECORD / RDP_RECORD_BATCH 展开为 ((void)0)、实参不求值,
|
||||
// 不留任何代码与运行开销;
|
||||
// 3) 生命周期:Data_Process_Factory::GetB() 调用 rdp_record::Init()(建目录、开库),
|
||||
// Data_Process_Factory::Destroy() 调用 rdp_record::Shutdown()(关库);Init 之前、初始化
|
||||
// 失败之后或 Shutdown 之后的写入一律静默忽略,不影响雷达数据处理;
|
||||
// 4) 记录点用法(新增数据 = 加结构体 + 注册 + 一行记录点,配方见 docs/data_record_debug.md):
|
||||
// 单条:RDP_RECORD(RdpRecPointTws{0, 值1, 值2, ...});
|
||||
// 批量:RDP_RECORD_BATCH(recs); // recs 为 std::vector<某记录实体>
|
||||
// 需要语句/局部变量的记录点请整体用 #ifdef RDP_RECORD_ENABLE ... #endif 包裹,
|
||||
// 保证关闭记录功能时既无代码也无「变量未使用」告警;
|
||||
// 5) 记录实体类型必须先在 rdp_record_entity.h 中声明并注册,否则链接期报 LNK2019
|
||||
// (extern template 已阻止 C++17 调用方隐式实例化)。
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace rdp_record
|
||||
{
|
||||
bool Init(); //初始化记录库(由 Data_Process_Factory::GetB() 调用)
|
||||
void Shutdown(); //关闭记录库(由 Data_Process_Factory::Destroy() 调用)
|
||||
std::string db_path(); //当前记录库文件全路径(未启用或未成功打开时返回空串)
|
||||
|
||||
//写入单条记录实体(T 为记录实体类型,须在 rdp_record.cpp 中显式实例化)
|
||||
template <typename T> void Write(const T& v);
|
||||
//批量写入同一记录实体的多条记录(内部使用事务)
|
||||
template <typename T> void Write(const std::vector<T>& v);
|
||||
}
|
||||
|
||||
#ifdef RDP_RECORD_ENABLE
|
||||
//记录宏:把指定记录实体写入数据库(首次写入该实体时自动建表)
|
||||
#define RDP_RECORD(...) ::rdp_record::Write(__VA_ARGS__)
|
||||
//批量记录宏:把 std::vector<记录实体> 一次性写入(每批一个事务)
|
||||
#define RDP_RECORD_BATCH(...) ::rdp_record::Write(__VA_ARGS__)
|
||||
#else
|
||||
//记录功能关闭:记录模块不参与编译,宏展开为空(实参不求值)
|
||||
#define RDP_RECORD(...) ((void)0)
|
||||
#define RDP_RECORD_BATCH(...) ((void)0)
|
||||
namespace rdp_record
|
||||
{
|
||||
inline bool Init() { return false; }
|
||||
inline void Shutdown() {}
|
||||
inline std::string db_path() { return std::string(); }
|
||||
template <typename T> inline void Write(const T&) {}
|
||||
template <typename T> inline void Write(const std::vector<T>&) {}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // RDP_RECORD_H
|
||||
@@ -0,0 +1,232 @@
|
||||
#ifndef RDP_RECORD_ENTITY_H
|
||||
#define RDP_RECORD_ENTITY_H
|
||||
#pragma once
|
||||
/*******************************数据记录实体(=数据库表)定义区*********************************/
|
||||
// 使用说明(完整配方见 docs/data_record_debug.md):
|
||||
// 1) 新增一张记录表:在本文件「记录实体定义区」添加结构体,并在其后紧跟一行
|
||||
// RDP_RECORD_DECLARE(结构体名);
|
||||
// 再到 rdp_record.cpp 的「记录实体注册区」添加两行
|
||||
// YLT_REFL(结构体名, 字段1, 字段2, ...); // 顺序必须与结构体声明顺序一致
|
||||
// RDP_RECORD_DEFINE(结构体名);
|
||||
// 最后在需要记录的位置写 RDP_RECORD(结构体名{0, 值1, 值2, ...}); 或 RDP_RECORD_BATCH(向量);
|
||||
// 建表无需任何代码:首次写入该实体时自动 CREATE TABLE IF NOT EXISTS;
|
||||
// 2) 命名与建表约定:结构体定义在全局命名空间(勿放入 namespace),结构体名即数据库表名
|
||||
// (ormpp 取「短结构体名」),建议以 RdpRec 开头;首个字段固定为 int64_t id(自增主键,
|
||||
// 写入时固定填 0,由 SQLite 分配);
|
||||
// 3) 字段类型仅限标量:int / int64_t / float / double / bool(SQLite 侧映射 INTEGER / INTEGER /
|
||||
// FLOAT / DOUBLE / INTEGER)。禁止使用数组(含 float speed_dim[129]、char[N] 等)——ormpp 对
|
||||
// C 数组按 C 字符串语义(strlen)绑定,会读越界或写入错误数据;大批量数组请另建「元素展开表」
|
||||
// 或改用 blob 字段;
|
||||
// 4) 表结构变更(增删字段)不会迁移已存在的旧表:本模块每次运行生成新的 db 文件,天然规避。
|
||||
#include "rdp_record.h"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "struct.h"
|
||||
|
||||
//记录实体的写入函数实例化声明宏:声明「该实体的 Write 在 rdp_record.cpp 中显式实例化」,
|
||||
//阻止 C++17 调用方隐式实例化(本模块的 ormpp 实现以 C++20 编译,见 docs/data_record_debug.md)
|
||||
#define RDP_RECORD_DECLARE(Entity) \
|
||||
extern template void rdp_record::Write<Entity>(const Entity&); \
|
||||
extern template void rdp_record::Write<Entity>(const std::vector<Entity>&)
|
||||
|
||||
// ============================ 记录实体定义区(在此新增结构体) ============================
|
||||
// 输入点迹 —— 输入的原始点迹数据
|
||||
struct RdpRecPoint
|
||||
{
|
||||
int64_t id; //自增主键(写入时固定填 0)
|
||||
long long point_id; //点迹ID
|
||||
long long frame_id; //帧ID
|
||||
double range; //径向距离
|
||||
double azimuth; //方位 (弧度)
|
||||
double velocity ; //速度
|
||||
double amplitude ; //幅度
|
||||
double height; //高度
|
||||
double SNR; //信噪比
|
||||
double RCS; //目标RCS
|
||||
float encoder_value; //码盘值
|
||||
float amp_asv_point; //归一化幅度dB
|
||||
float prn_fftn_point; //点迹速度维FFT点数
|
||||
long long CPI_time; //CPI时间
|
||||
long long GNSS_time; //GNSS时间
|
||||
int use_flag; //点迹使用标志 1使用 0未使用
|
||||
int azimuth_beam_index; //方位波位号
|
||||
int pitch_beam_index; //俯仰波位号
|
||||
int PRF_index; //PRF号
|
||||
int freq_index; //频点
|
||||
int point_type; //TAS 1 TWS0
|
||||
int point_section_asso; //点迹区
|
||||
|
||||
RdpRecPoint(){
|
||||
id = 0;
|
||||
}
|
||||
|
||||
RdpRecPoint(PointRecv& p){
|
||||
id = 0;
|
||||
point_id = p.point_id;
|
||||
frame_id = p.frame_id;
|
||||
range = p.range;
|
||||
azimuth = p.azimuth;
|
||||
velocity = p.velocity;
|
||||
amplitude = p.amplitude;
|
||||
height = p.height;
|
||||
SNR = p.SNR;
|
||||
RCS = p.RCS;
|
||||
encoder_value = p.encoder_value;
|
||||
amp_asv_point = p.amp_asv_point;
|
||||
prn_fftn_point = p.prn_fftn_point;
|
||||
CPI_time = p.CPI_time;
|
||||
GNSS_time = p.GNSS_time;
|
||||
use_flag = p.use_flag;
|
||||
azimuth_beam_index = p.azimuth_beam_index;
|
||||
pitch_beam_index = p.pitch_beam_index;
|
||||
PRF_index = p.PRF_index;
|
||||
freq_index = p.freq_index;
|
||||
point_type = p.point_type;
|
||||
point_section_asso = p.point_section_asso;
|
||||
}
|
||||
};
|
||||
RDP_RECORD_DECLARE(RdpRecPoint);
|
||||
|
||||
// TWS凝聚后点迹 —— 凝聚后的点迹数据
|
||||
struct RdpRecPointCohesionTWS
|
||||
{
|
||||
int64_t id; //自增主键(写入时固定填 0)
|
||||
long long point_id; //点迹ID
|
||||
long long frame_id; //帧ID
|
||||
double range; //径向距离
|
||||
double azimuth; //方位 (弧度)
|
||||
double velocity ; //速度
|
||||
double amplitude ; //幅度
|
||||
double height; //高度
|
||||
double SNR; //信噪比
|
||||
double RCS; //目标RCS
|
||||
float encoder_value; //码盘值
|
||||
float amp_asv_point; //归一化幅度dB
|
||||
float prn_fftn_point; //点迹速度维FFT点数
|
||||
long long CPI_time; //CPI时间
|
||||
long long GNSS_time; //GNSS时间
|
||||
int use_flag; //点迹使用标志 1使用 0未使用
|
||||
int azimuth_beam_index; //方位波位号
|
||||
int pitch_beam_index; //俯仰波位号
|
||||
int PRF_index; //PRF号
|
||||
int freq_index; //频点
|
||||
int point_type; //TAS 1 TWS0
|
||||
int point_section_asso; //点迹区
|
||||
|
||||
RdpRecPointCohesionTWS(){
|
||||
id = 0;
|
||||
}
|
||||
|
||||
RdpRecPointCohesionTWS(PointRecv& p){
|
||||
id = 0;
|
||||
point_id = p.point_id;
|
||||
frame_id = p.frame_id;
|
||||
range = p.range;
|
||||
azimuth = p.azimuth;
|
||||
velocity = p.velocity;
|
||||
amplitude = p.amplitude;
|
||||
height = p.height;
|
||||
SNR = p.SNR;
|
||||
RCS = p.RCS;
|
||||
encoder_value = p.encoder_value;
|
||||
amp_asv_point = p.amp_asv_point;
|
||||
prn_fftn_point = p.prn_fftn_point;
|
||||
CPI_time = p.CPI_time;
|
||||
GNSS_time = p.GNSS_time;
|
||||
use_flag = p.use_flag;
|
||||
azimuth_beam_index = p.azimuth_beam_index;
|
||||
pitch_beam_index = p.pitch_beam_index;
|
||||
PRF_index = p.PRF_index;
|
||||
freq_index = p.freq_index;
|
||||
point_type = p.point_type;
|
||||
point_section_asso = p.point_section_asso;
|
||||
}
|
||||
};
|
||||
RDP_RECORD_DECLARE(RdpRecPointCohesionTWS);
|
||||
|
||||
// TAS凝聚后点迹 —— 凝聚后的点迹数据
|
||||
struct RdpRecPointCohesionTAS
|
||||
{
|
||||
int64_t id; //自增主键(写入时固定填 0)
|
||||
long long point_id; //点迹ID
|
||||
long long frame_id; //帧ID
|
||||
double range; //径向距离
|
||||
double azimuth; //方位 (弧度)
|
||||
double velocity ; //速度
|
||||
double amplitude ; //幅度
|
||||
double height; //高度
|
||||
double SNR; //信噪比
|
||||
double RCS; //目标RCS
|
||||
float encoder_value; //码盘值
|
||||
float amp_asv_point; //归一化幅度dB
|
||||
float prn_fftn_point; //点迹速度维FFT点数
|
||||
long long CPI_time; //CPI时间
|
||||
long long GNSS_time; //GNSS时间
|
||||
int use_flag; //点迹使用标志 1使用 0未使用
|
||||
int azimuth_beam_index; //方位波位号
|
||||
int pitch_beam_index; //俯仰波位号
|
||||
int PRF_index; //PRF号
|
||||
int freq_index; //频点
|
||||
int point_type; //TAS 1 TWS0
|
||||
int point_section_asso; //点迹区
|
||||
|
||||
RdpRecPointCohesionTAS(){
|
||||
id = 0;
|
||||
}
|
||||
|
||||
RdpRecPointCohesionTAS(PointRecv& p){
|
||||
id = 0;
|
||||
point_id = p.point_id;
|
||||
frame_id = p.frame_id;
|
||||
range = p.range;
|
||||
azimuth = p.azimuth;
|
||||
velocity = p.velocity;
|
||||
amplitude = p.amplitude;
|
||||
height = p.height;
|
||||
SNR = p.SNR;
|
||||
RCS = p.RCS;
|
||||
encoder_value = p.encoder_value;
|
||||
amp_asv_point = p.amp_asv_point;
|
||||
prn_fftn_point = p.prn_fftn_point;
|
||||
CPI_time = p.CPI_time;
|
||||
GNSS_time = p.GNSS_time;
|
||||
use_flag = p.use_flag;
|
||||
azimuth_beam_index = p.azimuth_beam_index;
|
||||
pitch_beam_index = p.pitch_beam_index;
|
||||
PRF_index = p.PRF_index;
|
||||
freq_index = p.freq_index;
|
||||
point_type = p.point_type;
|
||||
point_section_asso = p.point_section_asso;
|
||||
}
|
||||
};
|
||||
RDP_RECORD_DECLARE(RdpRecPointCohesionTAS);
|
||||
|
||||
// 示例②:本圈输出的航迹 —— 记录点位于 data_process.cpp::track_process()「数据记录示例②」处,
|
||||
// TWS/TAS 共用一张表并用 track_mode 区分;每行取输出数组的 [i][0]
|
||||
struct RdpRecTrackOut
|
||||
{
|
||||
int64_t id; //自增主键(写入时固定填 0)
|
||||
int track_index; //航迹号
|
||||
int track_mode; //跟踪模式 TAS 1/TWS 0
|
||||
int point_sum; //该行点数(起批输出为历史点数 L)
|
||||
int flag_point; //1实点/0补点
|
||||
int flag_direction; //1靠近/0远离
|
||||
int64_t gnss_time_ms; //GNSS 时间(ms)
|
||||
float track_time_s; //航迹时间(s)
|
||||
float x; //x坐标(m)
|
||||
float y; //y坐标(m)
|
||||
float z; //z坐标(m)
|
||||
float v_x; //x速度(m/s)
|
||||
float v_y; //y速度(m/s)
|
||||
float v_z; //z速度(m/s)
|
||||
float range_m; //径向距离(m)
|
||||
float azi_deg; //方位(度)
|
||||
float elev_deg; //俯仰(度)
|
||||
float range_v_mps; //速度(m/s,接口字段 Range_V)
|
||||
float snr; //信噪比
|
||||
float rcs; //RCS
|
||||
};
|
||||
RDP_RECORD_DECLARE(RdpRecTrackOut);
|
||||
|
||||
#endif // RDP_RECORD_ENTITY_H
|
||||
@@ -9,27 +9,28 @@ using namespace std;
|
||||
// 点迹数据结构
|
||||
struct PointRecv
|
||||
{
|
||||
double Range; //径向距离
|
||||
double Azimuth; //方位 (弧度)
|
||||
double Velocity ; //速度
|
||||
double Amplitude ; //幅度
|
||||
double Height; //高度
|
||||
double snr; //信噪比
|
||||
long long point_id; //点迹ID
|
||||
long long frame_id; //帧ID
|
||||
double range; //径向距离
|
||||
double azimuth; //方位 (弧度)
|
||||
double velocity ; //速度
|
||||
double amplitude ; //幅度
|
||||
double height; //高度
|
||||
double SNR; //信噪比
|
||||
double RCS; //目标RCS
|
||||
float encoder_value; //码盘值
|
||||
float amp_asv_point; //归一化幅度dB
|
||||
float prn_fftn_point; //点迹速度维FFT点数
|
||||
long long CPI_Time; //CPI时间
|
||||
long long GNSS_time; //GNSS时间
|
||||
int Point_index; //点迹号 1~50
|
||||
int Point_Sum; //点迹总数
|
||||
int Use_Flag; //点迹使用标志 1使用 0未使用
|
||||
int beam_index; //波位号
|
||||
long long CPI_time; //CPI时间
|
||||
long long GNSS_time; //GNSS时间
|
||||
int use_flag; //点迹使用标志 1使用 0未使用
|
||||
int azimuth_beam_index; //方位波位号
|
||||
int pitch_beam_index; //俯仰波位号
|
||||
int PRF_index; //PRF号
|
||||
int Freq_index; //频点
|
||||
int track_mode; //TAS 1 TWS0
|
||||
int freq_index; //频点
|
||||
int point_type; //TAS 1 TWS0
|
||||
int point_section_asso; //点迹区
|
||||
|
||||
int pitch_num; // 俯仰波位号
|
||||
|
||||
float speed_dim[129]; // 目标的十字星数据,目标点速度维129个点
|
||||
float range_dim[8]; // 目标的十字星数据,目标点距离维8个点
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ int Track_Asso:: track_asso_process(std::vector<PointRecv> *point_
|
||||
std::vector <PointRecv>::iterator Iter;
|
||||
for (Iter= point_process.begin(); Iter!=point_process.end();)
|
||||
{
|
||||
if((*Iter).Use_Flag==1 )
|
||||
if((*Iter).use_flag==1 )
|
||||
{
|
||||
point_process.erase(Iter);
|
||||
Iter=point_process.begin();
|
||||
@@ -443,7 +443,7 @@ void Track_Asso:: model_filter(std::vector <Trust_Track> *trust_track,struct Ra
|
||||
{
|
||||
|
||||
//时间差
|
||||
double delta_T = (point_process[loop_of_point].CPI_Time - (*trust_track)[loop_of_track].T_track)/1000.0;
|
||||
double delta_T = (point_process[loop_of_point].CPI_time - (*trust_track)[loop_of_track].T_track)/1000.0;
|
||||
//航迹X P
|
||||
double X1[6],X2[6],X3[6],P1[6][6],P2[6][6],P3[6][6];
|
||||
memcpy(X1,(*trust_track)[loop_of_track].X1,6*sizeof(double));
|
||||
@@ -457,12 +457,12 @@ void Track_Asso:: model_filter(std::vector <Trust_Track> *trust_track,struct Ra
|
||||
double r_track = sqrt(pow((*trust_track)[loop_of_track].X[0],2)+pow((*trust_track)[loop_of_track].X[3],2));
|
||||
|
||||
//量测信息
|
||||
double Z[3] = {point_process[loop_of_point].Range,
|
||||
point_process[loop_of_point].Azimuth,
|
||||
point_process[loop_of_point].Velocity};
|
||||
double Z[3] = {point_process[loop_of_point].range,
|
||||
point_process[loop_of_point].azimuth,
|
||||
point_process[loop_of_point].velocity};
|
||||
double prt = point_process[loop_of_point].PRF_index;
|
||||
double freq_ind = point_process[loop_of_point].Freq_index;
|
||||
double h_point = point_process[loop_of_point].Height;
|
||||
double freq_ind = point_process[loop_of_point].freq_index;
|
||||
double h_point = point_process[loop_of_point].height;
|
||||
|
||||
//计算统计距离d
|
||||
double d1,d2,d3;
|
||||
@@ -498,8 +498,8 @@ void Track_Asso:: model_filter(std::vector <Trust_Track> *trust_track,struct Ra
|
||||
double& t_x0 = (*trust_track)[loop_of_track].X[0];
|
||||
double& t_y0 = (*trust_track)[loop_of_track].X[3];
|
||||
double a_track = atan2(t_y0, t_x0); //航迹方位角
|
||||
double& r_point = point_process[loop_of_point].Range; //点迹距离
|
||||
double a_delta = abs(a_track - point_process[loop_of_point].Azimuth); //方位差
|
||||
double& r_point = point_process[loop_of_point].range; //点迹距离
|
||||
double a_delta = abs(a_track - point_process[loop_of_point].azimuth); //方位差
|
||||
if(a_delta > PI){
|
||||
a_delta = 2*PI - a_delta;
|
||||
}
|
||||
@@ -567,9 +567,9 @@ void Track_Asso:: model_filter(std::vector <Trust_Track> *trust_track,struct Ra
|
||||
double d3=associated_info[min_index-1].d3;
|
||||
|
||||
//卡尔曼滤波
|
||||
double Z[3]={point_process[point_index-1].Range,point_process[point_index-1].Azimuth,point_process[point_index-1].Velocity};
|
||||
double Z[3]={point_process[point_index-1].range,point_process[point_index-1].azimuth,point_process[point_index-1].velocity};
|
||||
double prt = point_process[point_index-1].PRF_index;
|
||||
double freq_ind = point_process[point_index-1].Freq_index;
|
||||
double freq_ind = point_process[point_index-1].freq_index;
|
||||
double X1[6],X2[6],X3[6],P1[6][6],P2[6][6],P3[6][6];
|
||||
memcpy(X1,(*trust_track)[track_index-1].X1,6*sizeof(double));
|
||||
memcpy(X2,(*trust_track)[track_index-1].X2,6*sizeof(double));
|
||||
@@ -578,7 +578,7 @@ void Track_Asso:: model_filter(std::vector <Trust_Track> *trust_track,struct Ra
|
||||
memcpy(P2,(*trust_track)[track_index-1].P2,6*6*sizeof(double));
|
||||
memcpy(P3,(*trust_track)[track_index-1].P3,6*6*sizeof(double));
|
||||
double v_track = sqrt(pow((*trust_track)[track_index-1].X[1],2)+pow((*trust_track)[track_index-1].X[4],2));
|
||||
double delta_T = (point_process[point_index-1].CPI_Time - (*trust_track)[track_index-1].T_track)/1000.0;
|
||||
double delta_T = (point_process[point_index-1].CPI_time - (*trust_track)[track_index-1].T_track)/1000.0;
|
||||
double F[6][6], Q1[6][6], Q2[6][6], Q3[6][6];
|
||||
IMM_F_Q_gen( v_track, delta_T,F, Q1, Q2, Q3,Work_Parameter);
|
||||
|
||||
@@ -645,24 +645,24 @@ void Track_Asso:: model_filter(std::vector <Trust_Track> *trust_track,struct Ra
|
||||
}
|
||||
|
||||
//更新航迹时间
|
||||
(*trust_track)[track_index-1].T_track = point_process[point_index-1].CPI_Time;
|
||||
(*trust_track)[track_index-1].T_track = point_process[point_index-1].CPI_time;
|
||||
(*trust_track)[track_index-1].GNSS_time = point_process[point_index-1].GNSS_time;
|
||||
|
||||
//更新关联上的点迹信息
|
||||
(*trust_track)[track_index-1].range_point=point_process[point_index-1].Range;
|
||||
(*trust_track)[track_index-1].azi_point=point_process[point_index-1].Azimuth/PI*180;
|
||||
(*trust_track)[track_index-1].elev_point= asin(point_process[point_index-1].Height/point_process[point_index-1].Range)/PI*180;
|
||||
(*trust_track)[track_index-1].vr_point=point_process[point_index-1].Velocity;
|
||||
(*trust_track)[track_index-1].range_point=point_process[point_index-1].range;
|
||||
(*trust_track)[track_index-1].azi_point=point_process[point_index-1].azimuth/PI*180;
|
||||
(*trust_track)[track_index-1].elev_point= asin(point_process[point_index-1].height/point_process[point_index-1].range)/PI*180;
|
||||
(*trust_track)[track_index-1].vr_point=point_process[point_index-1].velocity;
|
||||
(*trust_track)[track_index-1].point_type = 0;
|
||||
(*trust_track)[track_index-1].prf_point = point_process[point_index-1].PRF_index;
|
||||
(*trust_track)[track_index-1].snr_point = point_process[point_index-1].snr;
|
||||
(*trust_track)[track_index-1].Amplitude= point_process[point_index-1].Amplitude; //幅度
|
||||
(*trust_track)[track_index-1].snr_point = point_process[point_index-1].SNR;
|
||||
(*trust_track)[track_index-1].Amplitude= point_process[point_index-1].amplitude; //幅度
|
||||
|
||||
(*trust_track)[track_index-1].RCS = point_process[point_index-1].RCS;
|
||||
(*trust_track)[track_index-1].amp_asv_point = point_process[point_index-1].amp_asv_point;
|
||||
(*trust_track)[track_index-1].prn_fftn_point = point_process[point_index-1].prn_fftn_point;
|
||||
|
||||
(*trust_track)[track_index-1].pitch_num = point_process[point_index-1].pitch_num;
|
||||
(*trust_track)[track_index-1].pitch_num = point_process[point_index-1].pitch_beam_index;
|
||||
|
||||
std::memcpy((*trust_track)[track_index-1].speed_dim, point_process[point_index-1].speed_dim, sizeof((*trust_track)[track_index-1].speed_dim));
|
||||
std::memcpy((*trust_track)[track_index-1].range_dim, point_process[point_index-1].range_dim, sizeof((*trust_track)[track_index-1].range_dim));
|
||||
@@ -701,7 +701,7 @@ void Track_Asso:: model_filter(std::vector <Trust_Track> *trust_track,struct Ra
|
||||
associated_num=static_cast<int>(associated_info.size());
|
||||
|
||||
//在接收点迹中 将关联上的点迹的使用标记位置为1 等待删除
|
||||
point_process[point_index-1].Use_Flag = 1;
|
||||
point_process[point_index-1].use_flag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -882,7 +882,7 @@ void Track_Asso:: track_hight_update(int updata_
|
||||
if(updata_track_index<=static_cast<int>(trust_track->size()) && asso_point_index<=static_cast<int>(point_process.size()))
|
||||
{
|
||||
|
||||
(*trust_track)[updata_track_index-1].Hight_smooth.push_back(point_process[asso_point_index-1].Height);
|
||||
(*trust_track)[updata_track_index-1].Hight_smooth.push_back(point_process[asso_point_index-1].height);
|
||||
|
||||
int height_win_length;
|
||||
|
||||
|
||||
@@ -223,14 +223,14 @@ void Track_Asso_Direct_Tracking::model_filter(Trust_Track *trust_track,
|
||||
//量测信息
|
||||
// double Z[2]={point_process[loop_of_point].Range*cos(point_process[loop_of_point].Azimuth),
|
||||
// point_process[loop_of_point].Range*sin(point_process[loop_of_point].Azimuth)};
|
||||
double Z[3] = {point_process[loop_of_point].Range,
|
||||
point_process[loop_of_point].Azimuth,
|
||||
point_process[loop_of_point].Velocity};
|
||||
double Z[3] = {point_process[loop_of_point].range,
|
||||
point_process[loop_of_point].azimuth,
|
||||
point_process[loop_of_point].velocity};
|
||||
// double v_point = point_process[loop_of_point].Velocity;
|
||||
double prt = point_process[loop_of_point].PRF_index;
|
||||
double freq_ind = point_process[loop_of_point].Freq_index;
|
||||
double delta_T = (point_process[loop_of_point].CPI_Time - T_track)/1000.0;
|
||||
double h_point = point_process[loop_of_point].Height;
|
||||
double freq_ind = point_process[loop_of_point].freq_index;
|
||||
double delta_T = (point_process[loop_of_point].CPI_time - T_track)/1000.0;
|
||||
double h_point = point_process[loop_of_point].height;
|
||||
|
||||
//计算统计距离d
|
||||
double d1,d2,d3;
|
||||
@@ -329,13 +329,13 @@ void Track_Asso_Direct_Tracking::model_filter(Trust_Track *trust_track,
|
||||
double d3=associated_info[min_index-1].d3;
|
||||
|
||||
//卡尔曼滤波
|
||||
double Z[3]={point_process[point_index-1].Range,point_process[point_index-1].Azimuth,point_process[point_index-1].Velocity};
|
||||
double Z[3]={point_process[point_index-1].range,point_process[point_index-1].azimuth,point_process[point_index-1].velocity};
|
||||
double prt = point_process[point_index-1].PRF_index;
|
||||
double freq_ind = point_process[point_index-1].Freq_index;
|
||||
double freq_ind = point_process[point_index-1].freq_index;
|
||||
// double Z[2];
|
||||
// Z[0]=point_process[point_index-1].Range*cos(point_process[point_index-1].Azimuth);
|
||||
// Z[1]=point_process[point_index-1].Range*sin(point_process[point_index-1].Azimuth);
|
||||
double delta_T = (point_process[point_index-1].CPI_Time - T_track)/1000.0;
|
||||
double delta_T = (point_process[point_index-1].CPI_time - T_track)/1000.0;
|
||||
double F[6][6], Q1[6][6], Q2[6][6], Q3[6][6];
|
||||
IMM_F_Q_gen( v_track, delta_T,F, Q1, Q2, Q3,Work_Parameter);
|
||||
|
||||
@@ -401,19 +401,19 @@ void Track_Asso_Direct_Tracking::model_filter(Trust_Track *trust_track,
|
||||
}
|
||||
|
||||
//更新航迹时间
|
||||
(*trust_track).T_track = point_process[point_index-1].CPI_Time;
|
||||
(*trust_track).T_track = point_process[point_index-1].CPI_time;
|
||||
|
||||
//更新关联上的点迹信息
|
||||
(*trust_track).range_point=point_process[point_index-1].Range;
|
||||
(*trust_track).azi_point=point_process[point_index-1].Azimuth/PI*180;
|
||||
(*trust_track).elev_point= asin(point_process[point_index-1].Height/point_process[point_index-1].Range)/PI*180;
|
||||
(*trust_track).vr_point=point_process[point_index-1].Velocity;
|
||||
(*trust_track).range_point=point_process[point_index-1].range;
|
||||
(*trust_track).azi_point=point_process[point_index-1].azimuth/PI*180;
|
||||
(*trust_track).elev_point= asin(point_process[point_index-1].height/point_process[point_index-1].range)/PI*180;
|
||||
(*trust_track).vr_point=point_process[point_index-1].velocity;
|
||||
(*trust_track).point_type = 1;
|
||||
(*trust_track).prf_point = point_process[point_index-1].PRF_index;
|
||||
(*trust_track).snr_point = point_process[point_index-1].snr;
|
||||
(*trust_track).snr_point = point_process[point_index-1].SNR;
|
||||
(*trust_track).Extrapolate_round = 0; //连续未用实点更新时间
|
||||
(*trust_track).point_flag=1; //实点
|
||||
(*trust_track).Amplitude= point_process[point_index-1].Amplitude; //幅度
|
||||
(*trust_track).Amplitude= point_process[point_index-1].amplitude; //幅度
|
||||
(*trust_track).associate_point_number = (*trust_track).associate_point_number+1; //关联点数+1
|
||||
(*trust_track).RCS = point_process[point_index-1].RCS;
|
||||
|
||||
@@ -648,7 +648,7 @@ void Track_Asso_Direct_Tracking::track_hight_update(int asso_point
|
||||
)
|
||||
{
|
||||
|
||||
(*trust_track).Hight_smooth.push_back(point_process[asso_point_index-1].Height);
|
||||
(*trust_track).Hight_smooth.push_back(point_process[asso_point_index-1].height);
|
||||
|
||||
int height_win_length;
|
||||
if((*trust_track).range_point <= 1000)
|
||||
|
||||
@@ -289,19 +289,19 @@ void Track_Asso_Tas::model_filter( std::vector<Trust_Track> *t
|
||||
//量测信息
|
||||
// double Z[2]={point_process[loop_of_point].Range*cos(point_process[loop_of_point].Azimuth),
|
||||
// point_process[loop_of_point].Range*sin(point_process[loop_of_point].Azimuth)};
|
||||
double Z[3] = {point_process[loop_of_point].Range,
|
||||
point_process[loop_of_point].Azimuth,
|
||||
point_process[loop_of_point].Velocity};
|
||||
double Z[3] = {point_process[loop_of_point].range,
|
||||
point_process[loop_of_point].azimuth,
|
||||
point_process[loop_of_point].velocity};
|
||||
// double v_point = point_process[loop_of_point].Velocity;
|
||||
double prt = point_process[loop_of_point].PRF_index;
|
||||
double freq_ind = point_process[loop_of_point].Freq_index;
|
||||
double delta_T = (point_process[loop_of_point].CPI_Time - T_track)/1000.0;
|
||||
double freq_ind = point_process[loop_of_point].freq_index;
|
||||
double delta_T = (point_process[loop_of_point].CPI_time - T_track)/1000.0;
|
||||
if (delta_T <= 0){
|
||||
RDP_LOG << "Warning: delta_T <= 0, skipping point association for point index " << point_process[loop_of_point].CPI_Time << " " << T_track << std::endl;
|
||||
RDP_LOG << "Warning: delta_T <= 0, skipping point association for point index " << point_process[loop_of_point].CPI_time << " " << T_track << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
double h_point = point_process[loop_of_point].Height;
|
||||
double h_point = point_process[loop_of_point].height;
|
||||
|
||||
//计算统计距离d
|
||||
double d1,d2,d3;
|
||||
@@ -371,13 +371,13 @@ void Track_Asso_Tas::model_filter( std::vector<Trust_Track> *t
|
||||
double d3=associated_info[min_index-1].d3;
|
||||
|
||||
//卡尔曼滤波
|
||||
double Z[3]={point_process[point_index-1].Range,point_process[point_index-1].Azimuth,point_process[point_index-1].Velocity};
|
||||
double Z[3]={point_process[point_index-1].range,point_process[point_index-1].azimuth,point_process[point_index-1].velocity};
|
||||
double prt = point_process[point_index-1].PRF_index;
|
||||
double freq_ind = point_process[point_index-1].Freq_index;
|
||||
double freq_ind = point_process[point_index-1].freq_index;
|
||||
// double Z[2];
|
||||
// Z[0]=point_process[point_index-1].Range*cos(point_process[point_index-1].Azimuth);
|
||||
// Z[1]=point_process[point_index-1].Range*sin(point_process[point_index-1].Azimuth);
|
||||
double delta_T = (point_process[point_index-1].CPI_Time - T_track)/1000.0;
|
||||
double delta_T = (point_process[point_index-1].CPI_time - T_track)/1000.0;
|
||||
double F[6][6], Q1[6][6], Q2[6][6], Q3[6][6];
|
||||
IMM_F_Q_gen( v_track, delta_T,F, Q1, Q2, Q3,Work_Parameter);
|
||||
|
||||
@@ -446,25 +446,25 @@ void Track_Asso_Tas::model_filter( std::vector<Trust_Track> *t
|
||||
}
|
||||
|
||||
//更新航迹时间
|
||||
(*trust_track)[i].T_track = point_process[point_index-1].CPI_Time;
|
||||
(*trust_track)[i].T_track = point_process[point_index-1].CPI_time;
|
||||
(*trust_track)[i].GNSS_time = point_process[point_index-1].GNSS_time;
|
||||
|
||||
//更新关联上的点迹信息
|
||||
(*trust_track)[i].range_point=point_process[point_index-1].Range;
|
||||
(*trust_track)[i].azi_point=point_process[point_index-1].Azimuth/PI*180;
|
||||
(*trust_track)[i].elev_point= asin(point_process[point_index-1].Height/point_process[point_index-1].Range)/PI*180;
|
||||
(*trust_track)[i].vr_point=point_process[point_index-1].Velocity;
|
||||
(*trust_track)[i].range_point=point_process[point_index-1].range;
|
||||
(*trust_track)[i].azi_point=point_process[point_index-1].azimuth/PI*180;
|
||||
(*trust_track)[i].elev_point= asin(point_process[point_index-1].height/point_process[point_index-1].range)/PI*180;
|
||||
(*trust_track)[i].vr_point=point_process[point_index-1].velocity;
|
||||
(*trust_track)[i].point_type = 1;
|
||||
(*trust_track)[i].prf_point = point_process[point_index-1].PRF_index;
|
||||
(*trust_track)[i].snr_point = point_process[point_index-1].snr;
|
||||
(*trust_track)[i].snr_point = point_process[point_index-1].SNR;
|
||||
(*trust_track)[i].Extrapolate_round = 0; //连续未用实点更新时间
|
||||
(*trust_track)[i].point_flag=1; //实点
|
||||
(*trust_track)[i].Amplitude= point_process[point_index-1].Amplitude; //幅度
|
||||
(*trust_track)[i].Amplitude= point_process[point_index-1].amplitude; //幅度
|
||||
(*trust_track)[i].associate_point_number = (*trust_track)[i].associate_point_number+1; //关联点数+1
|
||||
(*trust_track)[i].RCS = point_process[point_index-1].RCS;
|
||||
(*trust_track)[i].Track_Update_Flag = 1; //航迹更新标志
|
||||
|
||||
(*trust_track)[i].pitch_num = point_process[point_index-1].pitch_num;
|
||||
(*trust_track)[i].pitch_num = point_process[point_index-1].pitch_beam_index;
|
||||
|
||||
std::memcpy((*trust_track)[i].speed_dim, point_process[point_index-1].speed_dim, sizeof((*trust_track)[i].speed_dim));
|
||||
std::memcpy((*trust_track)[i].range_dim, point_process[point_index-1].range_dim, sizeof((*trust_track)[i].range_dim));
|
||||
@@ -730,7 +730,7 @@ void Track_Asso_Tas::track_hight_update(int tas_
|
||||
for(size_t i=0; i<trust_track->size(); i++)
|
||||
if((*trust_track)[i].Track_Index==tas_track_idx)
|
||||
{
|
||||
(*trust_track)[i].Hight_smooth.push_back(point_process[asso_point_index-1].Height);
|
||||
(*trust_track)[i].Hight_smooth.push_back(point_process[asso_point_index-1].height);
|
||||
|
||||
int height_win_length;
|
||||
if((*trust_track)[i].range_point <= 1000)
|
||||
|
||||
@@ -58,7 +58,7 @@ int Track_Init::track_init_process_logic( std::vector <PointRecv>
|
||||
std::vector <PointRecv>::iterator Iter;
|
||||
for (Iter=point_process.begin(); Iter!=point_process.end();)
|
||||
{
|
||||
if((*Iter).Use_Flag==1)
|
||||
if((*Iter).use_flag==1)
|
||||
{
|
||||
point_process.erase(Iter);
|
||||
Iter=point_process.begin();
|
||||
@@ -78,22 +78,22 @@ int Track_Init::track_init_process_logic( std::vector <PointRecv>
|
||||
for (unsigned int i=0;i<point_process.size();i++)
|
||||
{
|
||||
Temp_track temp_track_tmp = {};
|
||||
temp_track_tmp.r = point_process[i].Range;
|
||||
temp_track_tmp.azi = point_process[i].Azimuth;
|
||||
temp_track_tmp.height = point_process[i].Height;
|
||||
temp_track_tmp.Amp = point_process[i].Amplitude;
|
||||
temp_track_tmp.vr = point_process[i].Velocity;
|
||||
temp_track_tmp.snr = point_process[i].snr;
|
||||
temp_track_tmp.r = point_process[i].range;
|
||||
temp_track_tmp.azi = point_process[i].azimuth;
|
||||
temp_track_tmp.height = point_process[i].height;
|
||||
temp_track_tmp.Amp = point_process[i].amplitude;
|
||||
temp_track_tmp.vr = point_process[i].velocity;
|
||||
temp_track_tmp.snr = point_process[i].SNR;
|
||||
temp_track_tmp.RCS = point_process[i].RCS;
|
||||
temp_track_tmp.pitch_num = point_process[i].pitch_num;
|
||||
temp_track_tmp.pitch_num = point_process[i].pitch_beam_index;
|
||||
std::memcpy(temp_track_tmp.speed_dim, point_process[i].speed_dim, sizeof(temp_track_tmp.speed_dim));
|
||||
std::memcpy(temp_track_tmp.range_dim, point_process[i].range_dim, sizeof(temp_track_tmp.range_dim));
|
||||
temp_track_tmp.asso_flag = 0;
|
||||
temp_track_tmp.X[0]=point_process[i].Range*cos(point_process[i].Azimuth);
|
||||
temp_track_tmp.X[0]=point_process[i].range*cos(point_process[i].azimuth);
|
||||
temp_track_tmp.X[1]=0;
|
||||
temp_track_tmp.X[2]=point_process[i].Range*sin(point_process[i].Azimuth);
|
||||
temp_track_tmp.X[2]=point_process[i].range*sin(point_process[i].azimuth);
|
||||
temp_track_tmp.X[3]=0;
|
||||
temp_track_tmp.T = point_process[i].CPI_Time;
|
||||
temp_track_tmp.T = point_process[i].CPI_time;
|
||||
temp_track_tmp.GNSS_time = point_process[i].GNSS_time;
|
||||
temp_track_tmp.buff_round = 1;
|
||||
// temp_track_tmp.Temp_track_section_idx = floor(point_process[i].beam_index/BEAM_NUM_DOT_SECTION)+1;
|
||||
@@ -166,15 +166,15 @@ void Track_Init::point_temp_track_asso(std::vector <std::vector<Temp_track>>
|
||||
|
||||
//点迹信息
|
||||
// double Z[2]={ point_process[i].Range*cos(point_process[i].Azimuth),point_process[i].Range*sin(point_process[i].Azimuth)} ;
|
||||
double Z[3]={point_process[i].Range,
|
||||
point_process[i].Azimuth,
|
||||
point_process[i].Velocity};
|
||||
double vr_point=point_process[i].Velocity;
|
||||
double r_point=point_process[i].Range;
|
||||
double Z[3]={point_process[i].range,
|
||||
point_process[i].azimuth,
|
||||
point_process[i].velocity};
|
||||
double vr_point=point_process[i].velocity;
|
||||
double r_point=point_process[i].range;
|
||||
double prt = point_process[i].PRF_index;
|
||||
double freq_ind = point_process[i].Freq_index;
|
||||
double h_point = point_process[i].Height;
|
||||
double T_point = static_cast<double>(point_process[i].CPI_Time);
|
||||
double freq_ind = point_process[i].freq_index;
|
||||
double h_point = point_process[i].height;
|
||||
double T_point = static_cast<double>(point_process[i].CPI_time);
|
||||
|
||||
//航迹信息
|
||||
double X[4];
|
||||
@@ -226,7 +226,7 @@ void Track_Init::point_temp_track_asso(std::vector <std::vector<Temp_track>>
|
||||
asso_info_tmp.d = d;
|
||||
asso_info.push_back(asso_info_tmp);
|
||||
(*temp_track)[j][L-1].asso_flag = 1;
|
||||
point_process[i].Use_Flag = 1;
|
||||
point_process[i].use_flag = 1;
|
||||
//std::cout << "v_temp_track : " << v_temp_track << "vr_point : "<< vr_point;
|
||||
}
|
||||
}
|
||||
@@ -249,30 +249,30 @@ void Track_Init::point_temp_track_asso(std::vector <std::vector<Temp_track>>
|
||||
|
||||
//关联上的点
|
||||
Temp_track asso_track_info_tmp = {};
|
||||
asso_track_info_tmp.r = point_process[asso_info[i].point_idx-1].Range;
|
||||
asso_track_info_tmp.azi = point_process[asso_info[i].point_idx-1].Azimuth;
|
||||
asso_track_info_tmp.height = point_process[asso_info[i].point_idx-1].Height;
|
||||
asso_track_info_tmp.Amp = point_process[asso_info[i].point_idx-1].Amplitude;
|
||||
asso_track_info_tmp.T = point_process[asso_info[i].point_idx-1].CPI_Time;
|
||||
asso_track_info_tmp.r = point_process[asso_info[i].point_idx-1].range;
|
||||
asso_track_info_tmp.azi = point_process[asso_info[i].point_idx-1].azimuth;
|
||||
asso_track_info_tmp.height = point_process[asso_info[i].point_idx-1].height;
|
||||
asso_track_info_tmp.Amp = point_process[asso_info[i].point_idx-1].amplitude;
|
||||
asso_track_info_tmp.T = point_process[asso_info[i].point_idx-1].CPI_time;
|
||||
asso_track_info_tmp.GNSS_time = point_process[asso_info[i].point_idx-1].GNSS_time;
|
||||
asso_track_info_tmp.vr = point_process[asso_info[i].point_idx-1].Velocity;
|
||||
asso_track_info_tmp.snr = point_process[asso_info[i].point_idx-1].snr;
|
||||
asso_track_info_tmp.vr = point_process[asso_info[i].point_idx-1].velocity;
|
||||
asso_track_info_tmp.snr = point_process[asso_info[i].point_idx-1].SNR;
|
||||
asso_track_info_tmp.RCS = point_process[asso_info[i].point_idx-1].RCS;
|
||||
asso_track_info_tmp.asso_flag=0;
|
||||
asso_track_info_tmp.buff_round = 1;
|
||||
asso_track_info_tmp.pitch_num = point_process[asso_info[i].point_idx-1].pitch_num;
|
||||
asso_track_info_tmp.pitch_num = point_process[asso_info[i].point_idx-1].pitch_beam_index;
|
||||
std::memcpy(asso_track_info_tmp.speed_dim, point_process[asso_info[i].point_idx-1].speed_dim, sizeof(asso_track_info_tmp.speed_dim));
|
||||
std::memcpy(asso_track_info_tmp.range_dim, point_process[asso_info[i].point_idx-1].range_dim, sizeof(asso_track_info_tmp.range_dim));
|
||||
asso_track_info_tmp.d = asso_info[i].d;
|
||||
// asso_track_info_tmp.Temp_track_section_idx = floor(point_process[asso_info[i].point_idx-1].beam_index/BEAM_NUM_DOT_SECTION)+1;
|
||||
double Z0[2]={(*temp_track)[asso_info[i].track_idx-1][L-1].r*cos((*temp_track)[asso_info[i].track_idx-1][L-1].azi),
|
||||
(*temp_track)[asso_info[i].track_idx-1][L-1].r*sin((*temp_track)[asso_info[i].track_idx-1][L-1].azi)};
|
||||
double Z1[2]={point_process[asso_info[i].point_idx-1].Range*cos(point_process[asso_info[i].point_idx-1].Azimuth),
|
||||
point_process[asso_info[i].point_idx-1].Range*sin(point_process[asso_info[i].point_idx-1].Azimuth)};
|
||||
double Z1[2]={point_process[asso_info[i].point_idx-1].range*cos(point_process[asso_info[i].point_idx-1].azimuth),
|
||||
point_process[asso_info[i].point_idx-1].range*sin(point_process[asso_info[i].point_idx-1].azimuth)};
|
||||
double X[4];
|
||||
double P[4][4];
|
||||
kalman Kalman;
|
||||
double T = ( point_process[asso_info[i].point_idx-1].CPI_Time - (*temp_track)[asso_info[i].track_idx-1][L-1].T)/1000.0;
|
||||
double T = ( point_process[asso_info[i].point_idx-1].CPI_time - (*temp_track)[asso_info[i].track_idx-1][L-1].T)/1000.0;
|
||||
|
||||
Kalman.kalman_filter_init_2dots(Z0,Z1,T,X,P);
|
||||
memcpy(asso_track_info_tmp.X, X, 4*sizeof(double));
|
||||
@@ -328,11 +328,11 @@ void Track_Init::point_track_head_asso( std::vector <std::vector<Temp_track>>
|
||||
//点迹信息
|
||||
double x_point, y_point, vr_point;
|
||||
coor_trans Coor_trans;
|
||||
Coor_trans.polar2cart(&x_point,&y_point,point_process[i].Range,point_process[i].Azimuth);
|
||||
vr_point=point_process[i].Velocity;
|
||||
double r_point=point_process[i].Range;
|
||||
double h_point = point_process[i].Height;
|
||||
double T_point = static_cast<double>(point_process[i].CPI_Time);
|
||||
Coor_trans.polar2cart(&x_point,&y_point,point_process[i].range,point_process[i].azimuth);
|
||||
vr_point=point_process[i].velocity;
|
||||
double r_point=point_process[i].range;
|
||||
double h_point = point_process[i].height;
|
||||
double T_point = static_cast<double>(point_process[i].CPI_time);
|
||||
|
||||
//航迹信息
|
||||
double x_track_head, y_track_head;
|
||||
@@ -376,7 +376,7 @@ void Track_Init::point_track_head_asso( std::vector <std::vector<Temp_track>>
|
||||
asso_info_tmp.track_idx = static_cast<int>(j)+1;
|
||||
asso_info.push_back(asso_info_tmp);
|
||||
(*temp_track)[j][0].asso_flag = 1;
|
||||
point_process[i].Use_Flag = 1;
|
||||
point_process[i].use_flag = 1;
|
||||
//std::cout << "v_track_head: " << v_track_head << "vr_point: " << vr_point;
|
||||
}
|
||||
|
||||
@@ -395,16 +395,16 @@ void Track_Init::point_track_head_asso( std::vector <std::vector<Temp_track>>
|
||||
|
||||
//第二个点
|
||||
struct Temp_track asso_track_info_tmp = {};
|
||||
asso_track_info_tmp.r = point_process[asso_info[i].point_idx-1].Range;
|
||||
asso_track_info_tmp.azi = point_process[asso_info[i].point_idx-1].Azimuth;
|
||||
asso_track_info_tmp.height = point_process[asso_info[i].point_idx-1].Height;
|
||||
asso_track_info_tmp.Amp = point_process[asso_info[i].point_idx-1].Amplitude;
|
||||
asso_track_info_tmp.vr = point_process[asso_info[i].point_idx-1].Velocity;
|
||||
asso_track_info_tmp.snr = point_process[asso_info[i].point_idx-1].snr;
|
||||
asso_track_info_tmp.r = point_process[asso_info[i].point_idx-1].range;
|
||||
asso_track_info_tmp.azi = point_process[asso_info[i].point_idx-1].azimuth;
|
||||
asso_track_info_tmp.height = point_process[asso_info[i].point_idx-1].height;
|
||||
asso_track_info_tmp.Amp = point_process[asso_info[i].point_idx-1].amplitude;
|
||||
asso_track_info_tmp.vr = point_process[asso_info[i].point_idx-1].velocity;
|
||||
asso_track_info_tmp.snr = point_process[asso_info[i].point_idx-1].SNR;
|
||||
asso_track_info_tmp.RCS = point_process[asso_info[i].point_idx-1].RCS;
|
||||
asso_track_info_tmp.T = point_process[asso_info[i].point_idx-1].CPI_Time;
|
||||
asso_track_info_tmp.T = point_process[asso_info[i].point_idx-1].CPI_time;
|
||||
asso_track_info_tmp.GNSS_time = point_process[asso_info[i].point_idx-1].GNSS_time;
|
||||
asso_track_info_tmp.pitch_num = point_process[asso_info[i].point_idx-1].pitch_num;
|
||||
asso_track_info_tmp.pitch_num = point_process[asso_info[i].point_idx-1].pitch_beam_index;
|
||||
std::memcpy(asso_track_info_tmp.speed_dim, point_process[asso_info[i].point_idx-1].speed_dim, sizeof(asso_track_info_tmp.speed_dim));
|
||||
std::memcpy(asso_track_info_tmp.range_dim, point_process[asso_info[i].point_idx-1].range_dim, sizeof(asso_track_info_tmp.range_dim));
|
||||
asso_track_info_tmp.asso_flag = 0;
|
||||
@@ -412,12 +412,12 @@ void Track_Init::point_track_head_asso( std::vector <std::vector<Temp_track>>
|
||||
// asso_track_info_tmp.Temp_track_section_idx = floor(point_process[asso_info[i].point_idx-1].beam_index/BEAM_NUM_DOT_SECTION)+1;;
|
||||
double Z0[2]={(*temp_track)[asso_info[i].track_idx-1][0].r*cos((*temp_track)[asso_info[i].track_idx-1][0].azi),
|
||||
(*temp_track)[asso_info[i].track_idx-1][0].r*sin((*temp_track)[asso_info[i].track_idx-1][0].azi)};
|
||||
double Z1[2]={point_process[asso_info[i].point_idx-1].Range*cos(point_process[asso_info[i].point_idx-1].Azimuth),
|
||||
point_process[asso_info[i].point_idx-1].Range*sin(point_process[asso_info[i].point_idx-1].Azimuth)};
|
||||
double Z1[2]={point_process[asso_info[i].point_idx-1].range*cos(point_process[asso_info[i].point_idx-1].azimuth),
|
||||
point_process[asso_info[i].point_idx-1].range*sin(point_process[asso_info[i].point_idx-1].azimuth)};
|
||||
double X[4];
|
||||
double P[4][4];
|
||||
kalman Kalman;
|
||||
double T = (point_process[asso_info[i].point_idx-1].CPI_Time - (*temp_track)[asso_info[i].track_idx-1][0].T)/1000.0;
|
||||
double T = (point_process[asso_info[i].point_idx-1].CPI_time - (*temp_track)[asso_info[i].track_idx-1][0].T)/1000.0;
|
||||
|
||||
Kalman.kalman_filter_init_2dots(Z0,Z1,T,X,P);
|
||||
memcpy(asso_track_info_tmp.X, X, 4*sizeof(double));
|
||||
|
||||
@@ -44,15 +44,15 @@ void Track_Init_Direct_Tracking::point_temp_track_asso(std::vector <std::vector<
|
||||
|
||||
//点迹信息
|
||||
// double Z[2]={ point_process[i].Range*cos(point_process[i].Azimuth),point_process[i].Range*sin(point_process[i].Azimuth)} ;
|
||||
double Z[3]={point_process[i].Range,
|
||||
point_process[i].Azimuth,
|
||||
point_process[i].Velocity};
|
||||
double vr_point=point_process[i].Velocity;
|
||||
double r_point=point_process[i].Range;
|
||||
double Z[3]={point_process[i].range,
|
||||
point_process[i].azimuth,
|
||||
point_process[i].velocity};
|
||||
double vr_point=point_process[i].velocity;
|
||||
double r_point=point_process[i].range;
|
||||
double prt = point_process[i].PRF_index;
|
||||
double freq_ind = point_process[i].Freq_index;
|
||||
double h_point = point_process[i].Height;
|
||||
double T_point = static_cast<double>(point_process[i].CPI_Time);
|
||||
double freq_ind = point_process[i].freq_index;
|
||||
double h_point = point_process[i].height;
|
||||
double T_point = static_cast<double>(point_process[i].CPI_time);
|
||||
|
||||
//航迹信息
|
||||
double X[4];
|
||||
@@ -89,7 +89,7 @@ void Track_Init_Direct_Tracking::point_temp_track_asso(std::vector <std::vector<
|
||||
asso_info_tmp.track_idx = static_cast<int>(j)+1;
|
||||
asso_info.push_back(asso_info_tmp);
|
||||
(*temp_track)[j][L-1].asso_flag = 1;
|
||||
point_process[i].Use_Flag = 1;
|
||||
point_process[i].use_flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,15 +111,15 @@ void Track_Init_Direct_Tracking::point_temp_track_asso(std::vector <std::vector<
|
||||
|
||||
//关联上的点
|
||||
Temp_track asso_track_info_tmp = {};
|
||||
asso_track_info_tmp.r = point_process[asso_info[i].point_idx-1].Range;
|
||||
asso_track_info_tmp.azi = point_process[asso_info[i].point_idx-1].Azimuth;
|
||||
asso_track_info_tmp.height = point_process[asso_info[i].point_idx-1].Height;
|
||||
asso_track_info_tmp.Amp = point_process[asso_info[i].point_idx-1].Amplitude;
|
||||
asso_track_info_tmp.T = point_process[asso_info[i].point_idx-1].CPI_Time;
|
||||
asso_track_info_tmp.vr = point_process[asso_info[i].point_idx-1].Velocity;
|
||||
asso_track_info_tmp.snr = point_process[asso_info[i].point_idx-1].snr;
|
||||
asso_track_info_tmp.r = point_process[asso_info[i].point_idx-1].range;
|
||||
asso_track_info_tmp.azi = point_process[asso_info[i].point_idx-1].azimuth;
|
||||
asso_track_info_tmp.height = point_process[asso_info[i].point_idx-1].height;
|
||||
asso_track_info_tmp.Amp = point_process[asso_info[i].point_idx-1].amplitude;
|
||||
asso_track_info_tmp.T = point_process[asso_info[i].point_idx-1].CPI_time;
|
||||
asso_track_info_tmp.vr = point_process[asso_info[i].point_idx-1].velocity;
|
||||
asso_track_info_tmp.snr = point_process[asso_info[i].point_idx-1].SNR;
|
||||
asso_track_info_tmp.RCS = point_process[asso_info[i].point_idx-1].RCS;
|
||||
asso_track_info_tmp.pitch_num = point_process[asso_info[i].point_idx-1].pitch_num;
|
||||
asso_track_info_tmp.pitch_num = point_process[asso_info[i].point_idx-1].pitch_beam_index;
|
||||
std::memcpy(asso_track_info_tmp.speed_dim, point_process[asso_info[i].point_idx-1].speed_dim, sizeof(asso_track_info_tmp.speed_dim));
|
||||
std::memcpy(asso_track_info_tmp.range_dim, point_process[asso_info[i].point_idx-1].range_dim, sizeof(asso_track_info_tmp.range_dim));
|
||||
asso_track_info_tmp.asso_flag=0;
|
||||
@@ -127,12 +127,12 @@ void Track_Init_Direct_Tracking::point_temp_track_asso(std::vector <std::vector<
|
||||
// asso_track_info_tmp.Temp_track_section_idx = floor(point_process[asso_info[i].point_idx-1].beam_index/BEAM_NUM_DOT_SECTION)+1;
|
||||
double Z0[2]={(*temp_track)[asso_info[i].track_idx-1][L-1].r*cos((*temp_track)[asso_info[i].track_idx-1][L-1].azi),
|
||||
(*temp_track)[asso_info[i].track_idx-1][L-1].r*sin((*temp_track)[asso_info[i].track_idx-1][L-1].azi)};
|
||||
double Z1[2]={point_process[asso_info[i].point_idx-1].Range*cos(point_process[asso_info[i].point_idx-1].Azimuth),
|
||||
point_process[asso_info[i].point_idx-1].Range*sin(point_process[asso_info[i].point_idx-1].Azimuth)};
|
||||
double Z1[2]={point_process[asso_info[i].point_idx-1].range*cos(point_process[asso_info[i].point_idx-1].azimuth),
|
||||
point_process[asso_info[i].point_idx-1].range*sin(point_process[asso_info[i].point_idx-1].azimuth)};
|
||||
double X[4];
|
||||
double P[4][4];
|
||||
kalman Kalman;
|
||||
double T = ( point_process[asso_info[i].point_idx-1].CPI_Time - (*temp_track)[asso_info[i].track_idx-1][L-1].T)/1000.0;
|
||||
double T = ( point_process[asso_info[i].point_idx-1].CPI_time - (*temp_track)[asso_info[i].track_idx-1][L-1].T)/1000.0;
|
||||
|
||||
Kalman.kalman_filter_init_2dots(Z0,Z1,T,X,P);
|
||||
memcpy(asso_track_info_tmp.X, X, 4*sizeof(double));
|
||||
@@ -187,11 +187,11 @@ void Track_Init_Direct_Tracking::point_track_head_asso( std::vector <std::vector
|
||||
//点迹信息
|
||||
double x_point, y_point, vr_point;
|
||||
coor_trans Coor_trans;
|
||||
Coor_trans.polar2cart(&x_point,&y_point,point_process[i].Range,point_process[i].Azimuth);
|
||||
vr_point=point_process[i].Velocity;
|
||||
double r_point=point_process[i].Range;
|
||||
double h_point = point_process[i].Height;
|
||||
double T_point = static_cast<double>(point_process[i].CPI_Time);
|
||||
Coor_trans.polar2cart(&x_point,&y_point,point_process[i].range,point_process[i].azimuth);
|
||||
vr_point=point_process[i].velocity;
|
||||
double r_point=point_process[i].range;
|
||||
double h_point = point_process[i].height;
|
||||
double T_point = static_cast<double>(point_process[i].CPI_time);
|
||||
|
||||
//航迹信息
|
||||
double x_track_head, y_track_head;
|
||||
@@ -229,7 +229,7 @@ void Track_Init_Direct_Tracking::point_track_head_asso( std::vector <std::vector
|
||||
asso_info_tmp.track_idx = static_cast<int>(j)+1;
|
||||
asso_info.push_back(asso_info_tmp);
|
||||
(*temp_track)[j][0].asso_flag = 1;
|
||||
point_process[i].Use_Flag = 1;
|
||||
point_process[i].use_flag = 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -247,15 +247,15 @@ void Track_Init_Direct_Tracking::point_track_head_asso( std::vector <std::vector
|
||||
|
||||
//第二个点
|
||||
struct Temp_track asso_track_info_tmp = {};
|
||||
asso_track_info_tmp.r = point_process[asso_info[i].point_idx-1].Range;
|
||||
asso_track_info_tmp.azi = point_process[asso_info[i].point_idx-1].Azimuth;
|
||||
asso_track_info_tmp.height = point_process[asso_info[i].point_idx-1].Height;
|
||||
asso_track_info_tmp.Amp = point_process[asso_info[i].point_idx-1].Amplitude;
|
||||
asso_track_info_tmp.vr = point_process[asso_info[i].point_idx-1].Velocity;
|
||||
asso_track_info_tmp.snr = point_process[asso_info[i].point_idx-1].snr;
|
||||
asso_track_info_tmp.r = point_process[asso_info[i].point_idx-1].range;
|
||||
asso_track_info_tmp.azi = point_process[asso_info[i].point_idx-1].azimuth;
|
||||
asso_track_info_tmp.height = point_process[asso_info[i].point_idx-1].height;
|
||||
asso_track_info_tmp.Amp = point_process[asso_info[i].point_idx-1].amplitude;
|
||||
asso_track_info_tmp.vr = point_process[asso_info[i].point_idx-1].velocity;
|
||||
asso_track_info_tmp.snr = point_process[asso_info[i].point_idx-1].SNR;
|
||||
asso_track_info_tmp.RCS = point_process[asso_info[i].point_idx-1].RCS;
|
||||
asso_track_info_tmp.T = point_process[asso_info[i].point_idx-1].CPI_Time;
|
||||
asso_track_info_tmp.pitch_num = point_process[asso_info[i].point_idx-1].pitch_num;
|
||||
asso_track_info_tmp.T = point_process[asso_info[i].point_idx-1].CPI_time;
|
||||
asso_track_info_tmp.pitch_num = point_process[asso_info[i].point_idx-1].pitch_beam_index;
|
||||
std::memcpy(asso_track_info_tmp.speed_dim, point_process[asso_info[i].point_idx-1].speed_dim, sizeof(asso_track_info_tmp.speed_dim));
|
||||
std::memcpy(asso_track_info_tmp.range_dim, point_process[asso_info[i].point_idx-1].range_dim, sizeof(asso_track_info_tmp.range_dim));
|
||||
asso_track_info_tmp.asso_flag = 0;
|
||||
@@ -263,12 +263,12 @@ void Track_Init_Direct_Tracking::point_track_head_asso( std::vector <std::vector
|
||||
// asso_track_info_tmp.Temp_track_section_idx = floor(point_process[asso_info[i].point_idx-1].beam_index/BEAM_NUM_DOT_SECTION)+1;;
|
||||
double Z0[2]={(*temp_track)[asso_info[i].track_idx-1][0].r*cos((*temp_track)[asso_info[i].track_idx-1][0].azi),
|
||||
(*temp_track)[asso_info[i].track_idx-1][0].r*sin((*temp_track)[asso_info[i].track_idx-1][0].azi)};
|
||||
double Z1[2]={point_process[asso_info[i].point_idx-1].Range*cos(point_process[asso_info[i].point_idx-1].Azimuth),
|
||||
point_process[asso_info[i].point_idx-1].Range*sin(point_process[asso_info[i].point_idx-1].Azimuth)};
|
||||
double Z1[2]={point_process[asso_info[i].point_idx-1].range*cos(point_process[asso_info[i].point_idx-1].azimuth),
|
||||
point_process[asso_info[i].point_idx-1].range*sin(point_process[asso_info[i].point_idx-1].azimuth)};
|
||||
double X[4];
|
||||
double P[4][4];
|
||||
kalman Kalman;
|
||||
double T = (point_process[asso_info[i].point_idx-1].CPI_Time - (*temp_track)[asso_info[i].track_idx-1][0].T)/1000.0;
|
||||
double T = (point_process[asso_info[i].point_idx-1].CPI_time - (*temp_track)[asso_info[i].track_idx-1][0].T)/1000.0;
|
||||
|
||||
Kalman.kalman_filter_init_2dots(Z0,Z1,T,X,P);
|
||||
memcpy(asso_track_info_tmp.X, X, 4*sizeof(double));
|
||||
|
||||
Reference in New Issue
Block a user