Browse Source

add 4d radar detect proto.

yuchuli 8 months ago
parent
commit
47cec0b381

+ 30 - 0
src/driver/driver_radar_4d_ars548/ar548pac.cpp

@@ -31,6 +31,12 @@ ars548pac::ars548pac(const char * pdata,int ndatalen)
     memcpy(&mheader.MessageType,pdata+POS_MessageType,1);
     memcpy(&mheader.ReturnCode,pdata+POS_ReturnCode,1);
 
+    mototointel_unsignedshort(mheader.ServiceID);
+    mototointel_unsignedshort(mheader.MethodID);
+    mototointel_unsignedint(mheader.Length);
+    mototointel_unsignedshort(mheader.ClientID);
+    mototointel_unsignedshort(mheader.SessionID);
+
     if(mheader.Length != (unsigned short)(ndatalen-8))
     {
         std::cout<<" Packet Length Error. "<<"Length Told in header, "<<mheader.Length<<" ndatalen:"<<ndatalen<<std::endl;
@@ -55,3 +61,27 @@ bool ars548pac::IsValidPac()
 {
     return mbPacValid;
 }
+
+void ars548pac::mototointel_unsignedshort(unsigned short &value)
+{
+    int i;
+    char * pvalue = (char *)&value;
+    for(i=0;i<1;i++)
+    {
+        char swap = pvalue[i];
+        pvalue[i] = pvalue[3 -i];
+        pvalue[3-i] = swap;
+    }
+}
+
+void ars548pac::mototointel_unsignedint(unsigned int &value)
+{
+    int i;
+    char * pvalue = (char *)&value;
+    for(i=0;i<2;i++)
+    {
+        char swap = pvalue[i];
+        pvalue[i] = pvalue[3 -i];
+        pvalue[3-i] = swap;
+    }
+}

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

@@ -44,6 +44,9 @@ public:
     iv::ars548pac_Payload GetPayload();
     bool IsValidPac();
 
+    void mototointel_unsignedshort(unsigned short &value);
+    void mototointel_unsignedint(unsigned int &value);
+
 };
 
 #endif // AR548PAC_H

+ 45 - 0
src/include/proto/radar4ddetect.proto

@@ -0,0 +1,45 @@
+syntax = "proto2";
+
+package iv.radar;
+
+message radar4ddetect
+{
+  optional float mfAziAngle = 1; //Unaligned Detection Azimuth Angle,rad
+  optional float mfAziAngleStd = 2; //Azimuth Angle Std(Detection目标方位角标准差),rad
+  enum DetectionInvalidFlagsType{
+            InValidDistance = 1;
+            InvalidDistanceStd = 2;
+            InvalidAzimuth = 4;
+            InvalidAzimuthStd = 8;
+            InvalidElevation = 16;
+            InvalidElevationStd = 32;
+            InvalidRangeRate = 64;
+            InvalidRangeRateStd = 128;
+        }
+  optional DetectionInvalidFlagsType mdetinvalidtype = 3; //Detection Invalid Flags
+  optional float mfEleAngle = 4; //Unaligned Detection Elevation Angle,rad
+  optional float mfEleAngleStd = 5; //Elevation Angle Std,rad
+  optional float mfRadialDis = 6; //Detection Radial Distance,m
+  optional float mfRadialDisStd =7; //Radial Distance Std,m
+  optional float mfRadialVel =8; //Detection Radial Velocity,m/s
+  optional float mfRadialVelStd =9; //Radial Velocity Std,m/s
+  optional int32 mDectectionRCS =10; //Detecition RCS,dBm²
+  optional uint32 mID =11; //Detection ID
+  optional uint32 mnProb =12; //Existence Probability, 0~100%
+  enum DetectionClassficationType{
+  		NoClassification = 0;
+  		Noise = 1;
+  		Ground = 2;
+  		TraversableUnder = 3;
+  		Obstacle = 4;
+  		Invalid = 5;
+  	}
+  optional DetectionClassficationType mClass = 13; //Detection Classification
+  optional uint32 mnMultiTargetProb =14; //Multi-Target Probability, 0~100%
+  optional uint32 mnAssocObjID =15; //Associated Object ID
+  optional uint32 mnProbVelAmbig =16; //Probability for resolved velocity ambiguity, 0~100%
+  optional uint32 mntbd =17; //tbd
+
+};
+
+

+ 51 - 0
src/include/proto/radar4ddetectarray.proto

@@ -0,0 +1,51 @@
+
+syntax = "proto2";
+
+package iv.radar;
+
+import "radar4ddetect.proto";
+
+message radar4ddetecttarray
+{
+  optional int64 mnsTime = 1; //nano seconds since 1970
+  repeated radar4ddetect mdetarray = 2;
+  optional uint64 mCRC =3; //Checksum (E2E Profile 7) (Reserved)
+  optional uint32 mLength =4; //Len (E2E Profile 7) (Reserved)
+  optional uint32 mSOC =5; //SQC (E2E Profile 7) (Reserved)
+  optional uint32 mDataID =6; //Data ID (E2E Profile 7) (Reserved)
+  optional uint32 mTimestamp_ns =7; //Timestamp Nanoseconds
+  optional uint32 mTimestamp_s =8; //Timestamp Seconds
+  enum Timestamp_SyncStatus_Type{
+  		SYNC_OK = 1;
+  		SYNC_NEVERSYNC = 2;
+  		SYNC_LOST = 3;
+  	}
+  optional Timestamp_SyncStatus_Type mTimestamp_SyncStatus =9; //Timestamp_SyncStatus
+  optional uint32 mEventDataQualifier =10; //Event Data Qualifier (unused)
+  optional uint32 mExtendedQualifier = 11; //Extended Qualifier (unused)
+  optional uint32 mOrigin_InvalidFlags = 12; //Sensor Position Invalid flags (unused)
+  optional float Origin_Xpos = 13; //Sensor X Position with reference to rear axle,m
+  optional float Origin_Xstd = 14; //Sensor X Position STD (unused),m
+  optional float Origin_Ypos = 15; //Sensor Y Position with reference to rear axle,m
+  optional float Origin_Ystd = 16; //Sensor Y Position STD (unused)
+  optional float Origin_Zpos = 17; //Sensor Z Position with reference to rear axle,m
+  optional float Origin_Zstd =18; //Sensor Z Position STD (unused)
+  optional float Origin_Roll =19; //Sensor Roll Angle (unused),rad
+  optional float Origin_Rollstd = 20; //Sensor Roll Angle STD (unused),rad
+  optional float Origin_Pitch =21; //Sensor Pitch Angle with alignment correction,rad
+  optional float Origin_Pitchstd =22; //Sensor Pitch Angle STD,rad
+  optional float Origin_Yaw =23; //Sensor Yaw Angle with alignment correction,rad
+  optional float Origin_Yawstd = 24; //Sensor Yaw Angle STD,rad
+  optional uint32 mList_InvalidFlags =25; //Invalid flags (unused)
+  optional float mList_RadVelDomain_Min =26; //Ambiguity free Doppler velocity range Min,m/s
+  optional float mList_RadVelDomain_Max =27; //Ambiguity free Doppler velocity range Max,m/s
+  optional uint32 mList_NumOfDetections =28; //Number of Detections
+  optional float mAln_AzimuthCorrection =29; //Azimuth Alignment Correction
+  optional float mAln_ElevationCorrection =30; //Elevation Alignment Correction
+  enum Aln_Status_Type{
+  		ALIGNMENT_INIT = 0;
+  		ALIGNMENT_OK = 1;
+  		ALIGNMENT_NOTOK = 2;
+	}
+  optional Aln_Status_Type mAln_Status =31; //Status of alignment
+};