Browse Source

add radar4dobjec proto.

yuchuli 8 months ago
parent
commit
5c46a729b2

+ 55 - 11
src/driver/driver_radar_4d_ars548/ar548pac.cpp

@@ -63,25 +63,69 @@ bool ars548pac::IsValidPac()
 }
 
 void ars548pac::mototointel_unsignedshort(unsigned short &value)
+{
+    mototointel_value((char *)&value,2);
+}
+
+void ars548pac::mototointel_unsignedint(unsigned int &value)
+{
+    mototointel_value((char *)&value,4);
+}
+
+void ars548pac::mototointel_value(char * pvalue, int nlen)
 {
     int i;
-    char * pvalue = (char *)&value;
-    for(i=0;i<1;i++)
+    for(i=0;i<(nlen/2);i++)
     {
         char swap = pvalue[i];
-        pvalue[i] = pvalue[3 -i];
-        pvalue[3-i] = swap;
+        pvalue[i] = pvalue[(nlen-1) -i];
+        pvalue[(nlen-1)-i] = swap;
     }
 }
 
-void ars548pac::mototointel_unsignedint(unsigned int &value)
+iv::radar::radar4ddetectarray * ars548pac::GetDetArray()
 {
-    int i;
-    char * pvalue = (char *)&value;
-    for(i=0;i<2;i++)
+    if(mpactype == ars548pactype::TypeDectect)
     {
-        char swap = pvalue[i];
-        pvalue[i] = pvalue[3 -i];
-        pvalue[3-i] = swap;
+        return &mdetarray;
+    }
+    return NULL;
+}
+
+iv::radar::radar4dobjectarray * ars548pac::GetObjArray()
+{
+    if(mpactype == ars548pactype::TypeObject)
+    {
+        return &mobjarray;
     }
+    return NULL;
+}
+
+ars548pactype ars548pac::GetPacType()
+{
+    return mpactype;
+}
+
+void ars548pac::Decode()
+{
+    switch (mheader.MethodID) {
+    case 336:
+        DecodeDetect();
+        break;
+    case 329:
+        DecodeObj();
+        break;
+    default:
+        break;
+    }
+}
+
+void ars548pac::DecodeDetect()
+{
+
+}
+
+void ars548pac::DecodeObj()
+{
+
 }

+ 27 - 0
src/driver/driver_radar_4d_ars548/ar548pac.h

@@ -3,6 +3,9 @@
 
 #include <memory>
 
+#include "radar4ddetectarray.pb.h"
+#include "radar4dobjectarray.pb.h"
+
 namespace  iv {
 struct ars548pac_header
 {
@@ -29,12 +32,23 @@ struct ars548pac_Payload
 
 }
 
+enum ars548pactype
+{
+    TypeDectect = 1,
+    TypeObject = 2,
+    TypeUnknown = 3
+};
+
 class ars548pac
 {
+
 private:
     iv::ars548pac_header mheader;
     iv::ars548pac_Payload mPayload;
     bool mbPacValid = false;
+    ars548pactype mpactype = ars548pactype::TypeUnknown;
+    iv::radar::radar4ddetectarray mdetarray;
+    iv::radar::radar4dobjectarray mobjarray;
 
 public:
     ars548pac(const char * pdata,int ndatalen);
@@ -43,9 +57,22 @@ public:
     iv::ars548pac_header GetHeader();
     iv::ars548pac_Payload GetPayload();
     bool IsValidPac();
+    void Decode();
+
+    ars548pactype GetPacType();
+    iv::radar::radar4ddetectarray * GetDetArray();
+    iv::radar::radar4dobjectarray * GetObjArray();
 
+
+
+
+public:
     void mototointel_unsignedshort(unsigned short &value);
     void mototointel_unsignedint(unsigned int &value);
+    void mototointel_value(char * pvalue, int nlen);
+
+    void DecodeDetect();
+    void DecodeObj();
 
 };
 

+ 15 - 0
src/driver/driver_radar_4d_ars548/driver_radar_4d_ars548.pro

@@ -7,6 +7,10 @@ CONFIG += c++1z cmdline
 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
 
 SOURCES += \
+        ../../include/msgtype/radar4ddetect.pb.cc \
+        ../../include/msgtype/radar4ddetectarray.pb.cc \
+        ../../include/msgtype/radar4dobject.pb.cc \
+        ../../include/msgtype/radar4dobjectarray.pb.cc \
         ar548pac.cpp \
         main.cpp
 
@@ -16,4 +20,15 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
 !isEmpty(target.path): INSTALLS += target
 
 HEADERS += \
+    ../../include/msgtype/radar4ddetect.pb.h \
+    ../../include/msgtype/radar4ddetectarray.pb.h \
+    ../../include/msgtype/radar4dobject.pb.h \
+    ../../include/msgtype/radar4dobjectarray.pb.h \
     ar548pac.h
+
+
+!include(../../../include/ivprotobuf.pri ) {
+    error( "Couldn't find the ivprotobuf.pri file!" )
+}
+
+INCLUDEPATH += $$PWD/../../../src/include/msgtype

+ 1 - 1
src/include/proto/radar4ddetectarray.proto

@@ -5,7 +5,7 @@ package iv.radar;
 
 import "radar4ddetect.proto";
 
-message radar4ddetecttarray
+message radar4ddetectarray
 {
   optional int64 mnsTime = 1; //nano seconds since 1970
   repeated radar4ddetect mdetarray = 2;

+ 108 - 0
src/include/proto/radar4dobject.proto

@@ -0,0 +1,108 @@
+syntax = "proto2";
+
+package iv.radar;
+
+message radar4dobject
+{
+  optional uint32 u_StatusSensor = 1;//tbd 雷达状态,uint16,-
+  optional uint32 u_ID = 2;//"Unique ID of object 跟踪目标Object的唯一ID编号",uint32,-
+  optional uint32 u_Age = 3;//"Age of object Object寿命",uint16,ms
+  enum StatusMeasurementType{
+  		MeasurementMeasured = 0;
+  		MeasurementNew = 1;
+  		MeasurementPredicted = 2;
+  		MeasurementInvalid = 255;
+  	}
+  optional StatusMeasurementType u_StatusMeasurement = 4;// "Object Status Object目标测量状态",uint8,-
+  enum StatusMovementType{
+  		MovementMoved = 0;
+  		MovementStationary = 1;
+  		MovementInvalid = 255;
+  	}
+  optional StatusMovementType u_StatusMovement = 5;//"Object Movement Status Object目标运动状态",uint8,-
+  optional uint32 u_Position_InvalidFlags = 6; //"tbd Object目标坐标无效标记",uint16,-
+  enum PositionReferenceType{
+  		CornerFrontLeft = 0;
+  		MiddleFront = 1;
+  		CornerFrontRight = 2; 
+  		MiddleSideRight = 3;
+  		CornerRearRight = 4;
+  		MiddleRear = 5;
+  		CornerRearLeft = 6;
+  		MiddleSideLeft = 7;
+  		SignalUnfilled= 255;
+  	}
+  optional PositionReferenceType u_Position_Reference = 7; //"Reference point position Object目标坐标参考点位置(在目标边缘的哪个点)",uint8,-
+  optional float u_Position_X = 8; //"X Position of reference point Object目标X坐标",float32,m
+  optional float u_Position_X_STD = 9; //"X Position Std Object目标X坐标标准差",float32,m
+  optional float u_Position_Y = 10; //"Y Position of reference point Object目标Y坐标",float32,m
+  optional float u_Position_Y_STD = 11; //"Y Position Std Object目标Y坐标标准差",float32,m
+  optional float u_Position_Z = 12; //"Z Position of reference point Object目标Z坐标",float32,m
+  optional float u_Position_Z_STD = 13; //"Z Position Std Object目标Z坐标标准差",float32,m
+  optional float u_Position_CovarianceXY = 14; //"Covariance X Y X和Y坐标协方差",float32,m²
+  optional float u_Position_Orientation = 15; //"Object Orientation Object目标航向角",float32,rad
+  optional float u_Position_Orientation_STD = 16; //"Orientation Std Object目标航向角标准差",float32,rad
+  optional uint32 u_Existence_InvalidFlags = 17; //unused,uint8,-
+  optional float u_Existence_Probability = 18; //"Probability of Existence(Object目标)存在概率",float32,%
+  optional float u_Existence_PPV = 19; //unused,float32,%
+  optional uint32 u_Classification_Car = 20; //"Car Classification Probability Object目标类别为Car(乘用车/小汽车)",uint8,%
+  optional uint32 u_Classification_Truck = 21; //"Truck Classification Probability Object目标类别为Truck(客货车/卡车/大巴/公交车)",uint8,%
+  optional uint32 u_Classification_Motorcycle = 22; //"Motorcycle Classification Probability Object目标类别为Motorcycle(摩托车/电动车)",uint8,%
+  optional uint32 u_Classification_Bicycle = 23; //"Bicycle Classification Probability Object目标类别为Bicycle(自行车)",uint8,%
+  optional uint32 u_Classification_Pedestrian = 24; //"Pedestrian Classification Probability Object目标类别为Pedestrian(行人)",uint8,%
+  optional uint32 u_Classification_Animal = 25; //"Animal Classification Probability Object目标类别为Animal(动物)",uint8,%
+  optional uint32 u_Classification_Hazard = 26; //"Hazard Classification Probability Object目标类别为Hazard(危险障碍物)",uint8,%
+  optional uint32 u_Classification_Unknown = 27; //"Unknown Classification Probability Object目标类别为Unknown(未知类型)",uint8,%
+  optional uint32 u_Classification_Overdrivable = 28; //unused(可下穿的),uint8,%
+  optional uint32 u_Classification_Underdrivable = 29; //unused(可碾压的),uint8,%
+  optional uint32 u_Dynamics_AbsVel_InvalidFlags = 30; //unused,uint8,-
+  optional float f_Dynamics_AbsVel_X = 31; //"X Absolute Velocity Object目标X轴方向绝对速度",float32,m/s
+  optional float f_Dynamics_AbsVel_X_STD = 32; //"X Absolute Velocity Std Object目标X轴方向绝对速度标准差",float32,m/s
+  optional float f_Dynamics_AbsVel_Y = 33; //"Y Absolute Velocity Object目标Y轴方向绝对速度",float32,m/s
+  optional float f_Dynamics_AbsVel_Y_STD = 34; //"Y Absolute Velocity Std Object目标Y轴方向绝对速度标准差",float32,m/s
+  optional float f_Dynamics_AbsVel_CovarianceXY = 35; //"Covariance Absolute Velocity X Y Object目标X轴和Y轴方向绝对速度协方差",float32,(m/s)²
+  optional uint32 u_Dynamics_RelVel_InvalidFlags = 36; //unused,uint8,-
+  optional float f_Dynamics_RelVel_X = 37; //"X Relative Velocity Object目标X轴方向相对速度",float32,m/s
+  optional float f_Dynamics_RelVel_X_STD = 38; //"X Relative Velocity Std Object目标X轴方向相对速度标准差",float32,m/s
+  optional float f_Dynamics_RelVel_Y = 39; //"Y Relative Velocity Object目标Y轴方向相对速度",float32,m/s
+  optional float f_Dynamics_RelVel_Y_STD = 40; //"Y Relative Velocity Std Object目标Y轴方向相对速度标准差",float32,m/s
+  optional float f_Dynamics_RelVel_CovarianceXY = 41; //"Covariance Relative Velocity X Y Object目标X轴和Y轴方向相对速度协方差",float32,(m/s)²
+  optional uint32 u_Dynamics_AbsAccel_InvalidFlags = 42; //unused,uint8,-
+  optional float f_Dynamics_AbsAccel_X = 43; //"X Absolute Acceleration Object目标X轴方向绝对加速度",float32,m/s²
+  optional float f_Dynamics_AbsAccel_X_STD = 44; //"X Absolute Acceleration Std Object目标X轴方向绝对加速度标准差",float32,m/s²
+  optional float f_Dynamics_AbsAccel_Y = 45; //"Y Absolute Acceleration Object目标Y轴方向绝对加速度",float32,m/s²
+  optional float f_Dynamics_AbsAccel_Y_STD = 46; //"Y Absolute Acceleration Std Object目标Y轴方向绝对加速度标准差",float32,m/s²
+  optional float f_Dynamics_AbsAccel_CovarianceXY = 47; //"Covariance Absolute Acceleration X Y Object目标X轴和Y轴方向绝对加速度协方差",float32,(m/s²)²
+  optional uint32 u_Dynamics_RelAccel_InvalidFlags = 48; //unused,uint8,-
+  optional float f_Dynamics_RelAccel_X = 49; //"X Relative Acceleration Object目标X轴方向相对加速度",float32,m/s²
+  optional float f_Dynamics_RelAccel_X_STD = 50; //"X Relative Acceleration Std Object目标X轴方向相对加速度标准差",float32,m/s²
+  optional float f_Dynamics_RelAccel_Y = 51; //"Y Relative Acceleration Object目标Y轴方向相对加速度",float32,m/s²
+  optional float f_Dynamics_RelAccel_Y_STD = 52; //"Y Relative Acceleration Std Object目标Y轴方向相对加速度标准差",float32,m/s²
+  optional float f_Dynamics_RelAccel_CovarianceXY = 53; //"Covariance Relative Acceleration X Y Object目标X轴和Y轴方向相对加速度协方差",float32,(m/s²)²
+  optional uint32 u_Dynamics_Orientation_InvalidFlags = 54; //unused,uint8,-
+  optional float u_Dynamics_Orientation_Rate_Mean = 55; //"Object Orientation Rate Object目标航向角平均变化率",float32,rad/s
+  optional float u_Dynamics_Orientation_Rate_STD = 56; //"Orientation Rate Std Object目标航向角平均变化率标准差",float32,rad/s
+  enum ShapeLengthStatusType{
+  		LengthCompletelyVisible = 0;
+  		LengthPartiallOccluded = 1;
+  		LengthCompletelyOccluded = 2;
+  		ShapeLengthStatusInvalid = 255;
+  	}
+  optional ShapeLengthStatusType u_Shape_Length_Status = 57; //Shape Length Status (unused),uint32,-
+  optional uint32 u_Shape_Length_Edge_InvalidFlags = 58; //Invalid Flags Shape Length (unused),uint8,-
+  optional float u_Shape_Length_Edge_Mean = 59; //"Mean Shape Length Object目标平均长度",float32,m
+  optional float u_Shape_Length_Edge_STD = 60; //Shape Length Std (unused),float32,m
+  enum ShapeWidthStatusType{
+  		WidthCompletelyVisible = 0;
+  		WidthPartiallOccluded = 1;
+  		WidthCompletelyOccluded = 2;
+  		ShapeWidthStatusInvalid = 255;
+  	}
+  optional ShapeWidthStatusType u_Shape_Width_Status = 61; //Shape Width Status (unused),uint32,-
+  optional uint32 u_Shape_Width_Edge_InvalidFlags = 62; //Invalid Flags Shape Width (unused),uint8,-
+  optional float u_Shape_Width_Edge_Mean = 63; //"Mean Shape Width Object目标平均宽度",float32,m
+  optional float u_Shape_Width_Edge_STD = 64; //Shape Width Std (unused),float32,m
+  
+ }
+
+

+ 29 - 0
src/include/proto/radar4dobjectarray.proto

@@ -0,0 +1,29 @@
+
+syntax = "proto2";
+
+package iv.radar;
+
+import "radar4dobject.proto";
+
+message radar4dobjectarray
+{
+  optional int64 mnsTime = 1; //nano seconds since 1970
+  repeated radar4dobject mobjarray = 2;
+  optional uint64 CRC = 3; //Checksum (E2E Profile 7) (Reserved),uint64,-
+  optional uint32 Length = 4; //Len (E2E Profile 7) (Reserved),uint32,-
+  optional uint32 SQC = 5; //SQC (E2E Profile 7) (Reserved),uint32,-
+  optional uint32 DataID = 6; //Data ID (E2E Profile 7) (Reserved),uint32,-
+  optional uint32 Timestamp_Nanoseconds = 7; //Timestamp Nanoseconds,uint32,ns
+  optional uint32 Timestamp_Seconds = 8; //Timestamp Seconds,uint32,s
+  enum TimestampSyncStatusType{
+  		SYNC_OK = 1;
+  		SYNC_NEVERSYNC = 2;
+  		SYNC_LOST = 3;
+  	}
+  optional TimestampSyncStatusType Timestamp_SyncStatus = 9; //Timestamp Sync Status,uint8,-
+  optional uint32 EventDataQualifier = 10; //Event Data Qualifier (unused),uint32,-
+  optional uint32 ExtendedQualifier = 11; //Extended Qualifier (unused),uint8,-
+  optional uint32 ObjectList_NumOfObjects = 12; //"Number of Objects Object目标数量",uint8,-
+};
+  
+