自己的项目文件做一些备份
雷达数据获取解析:
//Target Info 目标消息
if (cmd[0] == 0x06 && cmd[1] == 0x0B){
Log.v(TAG," CanTestActivity data Target Info: " + bytes2hex(data));
//1.Objects_ID 目标ID 0x57=87,即目标 ID 为 87。目标在 0~255 之间循环产生。在稳定跟踪过 程中,目标 ID 保持不变;
double radar_id = data[0] & 0XFF;
//2.Objects_DistLong 目标纵向距离:(0x4E*32 +(0xC4>>3))*0.2-500 = 4 米;
double radar_distant_x;
radar_distant_x = (data[1]*32 + (data[2] >> 3))*0.2 -500;
//3.Objects_Distlat 目标横向距离:((0xC4&0x07)*256 + 0x0C) *0.2-204.6 = 2.6 米;
double radar_distant_y;
radar_distant_y = ((data[2]&0x07)*256 +data[3])*0.2 - 204.6;
//4.Objects_VrelLong 目标纵向速度:(0x7F*4+(0x60>>6))*0.25-128 = -0.75m/s;
double radar_speed_x;
radar_speed_x = (data[4]*4+(data[5] >> 6)) * 0.25 - 128;
//5.Objects_VrelLat 目标横向速度:((0x60&0x3F)*8+(0x18>>5))*0.25-64 = 0m/s;
double radar_speed_y;
radar_speed_y = ((data[5]&0x3F)*8+(data[6] >> 5)) * 0.25 - 64;
//6.Objects_DynProp 目标动态属性
double radar_trends_property;
radar_trends_property = data[6]&0x07;
//7.Objects_RCS 分辨率RCS 0x80 *0.5-64= 0,默认均为 0。
double radar_rcs;
radar_rcs = data[7] * 0.5 -64;
//8.目 标 径 向 距 离 R=sqrt(Objects_DistLong*Objects_DistLong+Objects_Distlat* Objects_Distlat)
double radar_r;
radar_r = Math.sqrt(radar_distant_x*radar_distant_x)+(radar_distant_y * radar_distant_y);
//9.目标角速度 tan ߠ ൌ Objects_Distlat ܱ ܾ݆ ݆ܿ ݁ݏ _ܦ ݏݐ ݁ܮ ̴݊ ܦ
double radar_θ;
double θ = Math.toRadians(radar_distant_y / radar_speed_y);
radar_θ = Math.tan(θ);
//10.目标速度
double radar_V;
radar_V = radar_speed_x * Math.cos(θ) + radar_speed_y * Math.sin(θ);
}
网友评论