更新: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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user