Browse Source

add cameradecision for use camera make decision.

yuchuli 1 month ago
parent
commit
981ce533e5

+ 91 - 0
src/python/cameradecision/PyModuleCommModule.py

@@ -0,0 +1,91 @@
+
+import threading  
+import time  
+
+import modulecommpython
+import numpy as np  
+
+
+modulelock = threading.Lock()  
+nThread = 0
+  
+class PyModuleComm:  
+    def __init__(self,strname):  
+        # 初始化代码...  
+        print("name: ",strname)
+        self.strmemname = strname
+        self.mbRegister = False
+        global nThread
+        nThread = nThread+1
+        self.mnMode = 0
+        print("nThread = ",nThread)
+        self.obj = modulecommpython.get_ca_object()
+        pass  
+
+    def RegisterRecv(self,call):
+        if self.mbRegister:
+            print(" Have register, can't register other.")
+            return
+        print("Register: ",self.strmemname)
+        self.mpcall = call
+        self.mbRegister = True
+        self.mbRun = True
+        self.mpthread = threading.Thread(target=self.threadrecvdata, args=(self.strmemname,))  
+        self.mpthread.start()
+        print("complete create thread.")
+        self.mnMode = 1
+        self.obj.RegisterRecv(self.strmemname)
+
+    def RegiseterSend(self,nSize,nPacCount):
+        if self.mbRegister:
+            print(" Have register, can't register other.")
+            return
+        print("Register: ",self.strmemname)
+        self.mnsize = nSize
+        self.mnPacCount = nPacCount
+        self.mbRegister = True
+        self.mnMode = 2
+        self.obj.RegisterSend(self.strmemname,nSize,nPacCount)
+    
+    def SendData(self,arr,nsendsize):      
+    #    nrealsize = np.zeros(1, dtype=np.int32)  
+        nrtn = self.obj.SendData(arr,nsendsize)
+  
+    def threadrecvdata(self, arg):  
+        # 这个函数将被线程执行  
+ #       print(f"线程开始执行,参数是 {arg}")  
+        nBuffSize = int(1000)
+        arr = np.zeros(nBuffSize,dtype=np.int8)
+        recvtime = np.zeros(1,dtype=np.int64)
+        nrealsize = np.zeros(1,dtype=np.int32)
+        while 1:
+            nrtn = self.obj.RecvData(arr,nBuffSize,nrealsize,recvtime)
+            if nrtn > 0:
+                self.mpcall(arr,nrtn,recvtime)
+            else:
+                pass
+            if nrtn < 0:
+                nBuffSize = int(nrealsize[0] * 2)
+                arr = np.zeros(nBuffSize,dtype=np.int8)
+            else:
+                time.sleep(0.001)
+            
+        print("threadrecvdata complete.")
+
+    def stop_thread(self):
+        self.mbRun = False
+        self.mpthread.join()
+  
+    def start_thread(self, arg):  
+        # 创建线程对象,target参数指向要在线程中运行的函数  
+        self.mbRun = True
+        self.mpthread = threading.Thread(target=self.my_function, args=(arg,))  
+          
+        # 启动线程  
+        self.mpthread.start()  
+          
+        # 可以在这里添加其他代码,主线程会继续执行  
+        print("主线程继续执行...")  
+  
+        # 如果需要等待线程结束,可以调用 join() 方法  
+        # thread.join()  

+ 161 - 0
src/python/cameradecision/cameradecision.py

@@ -0,0 +1,161 @@
+
+
+import proto.decition_pb2 as decition_pb2
+
+import proto.cameraobjectarray_pb2 as cameraobjectarray_pb2
+
+import math
+from typing import List  
+
+from datetime import datetime, timedelta  
+import time  
+
+class Point2D:
+    def __init__(self, x, y,hdg):
+        self.mx = x
+        self.my = y
+        self.mhdg = hdg
+        while self.mhdg < 0:
+            self.mhdg = self.mhdg + 2.0* math.pi
+        while self.mhdg >= 2.0*math.pi:
+            self.mhdg = self.mhdg - 2.0* math.pi
+        
+
+    def __str__(self):  
+        return f"Point2D({self.mx}, {self.my})"  
+
+class CameraDecision:  
+    def __init__(self):  
+        # 初始化代码...  
+        self.mendacc = -0.7  #抵达终点时的减速度为-0.7
+        self.mmaxwheel = 430 #最大方向盘角度
+        self.mdefaultacc = 1.0  #加速时的acc
+        self.mspeed = 10.0  #运行速度10km/h
+        self.mstopdistoobs = 6.0 #在距离障碍物多远停住
+        self.mstopdisacc = -1.0  #有障碍物时的减速度
+        self.mvehwidth = 2.3  #从车宽
+        pass
+
+    def CalcDecision(xobjarray : cameraobjectarray_pb2.cameraobjectarray):
+
+        nobjsize = len(xobjarray.obj)
+        for pobj in xobjarray.obj:
+            print(f"type: {pobj.type} x : {pobj.x} y: {pobj.y}");   #获取摄像头感知结果的方法,其它数据可以查看proto文件用pobj.{名称}获取
+
+        acc = 0.0   #加速度数值,m/s2
+        wheel = 0.0   #方向盘转角,>0 左转  <0 右转 -430----430
+        speed = 0.0  #车速
+        leftLamp = False
+        rightLamp = False
+
+        ### 在此编写代码给出决策数值
+        ### 在此编写代码给出决策数值
+        ### 在此编写代码给出决策数值
+
+
+
+        xdecisiion = decition_pb2.decition()
+        xdecisiion.wheelAngle = wheel
+        xdecisiion.accelerator = acc
+        xdecisiion.brake = 0
+        xdecisiion.speed = speed
+        xdecisiion.leftLamp = leftLamp
+        xdecisiion.rightLamp = rightLamp
+        if acc < 0:
+            xdecisiion.brake = acc
+            xdecisiion.torque = 0
+        else:
+            xdecisiion.brake = 0
+            fVehWeight = 1800
+ #           fg = 9.8
+            fRollForce = 50
+            fRatio = 2.5
+            fNeed = fRollForce + fVehWeight*acc
+            xdecisiion.torque = fNeed/fRatio
+
+        return xdecisiion
+
+        
+
+
+
+    def is_point_in_rotated_rectangle(self,x, y, x1, y1, yaw, l, w):  
+        # 将长方形的左下角坐标转换到原点  
+        x_rel = x - x1  
+        y_rel = y - y1  
+  
+        # 计算旋转矩阵(逆时针旋转)  
+        # | cos(yaw)  -sin(yaw) |  
+        # | sin(yaw)   cos(yaw) |  
+        cos_yaw = math.cos(yaw)  
+        sin_yaw = math.sin(yaw)  
+      
+        # 应用旋转矩阵到相对坐标  
+        x_rotated = x_rel * cos_yaw + y_rel * sin_yaw  
+        y_rotated = -x_rel * sin_yaw + y_rel * cos_yaw  
+  
+        # 判断点是否在旋转后的长方形内  
+        # 长方形的边界在旋转后的坐标系中是 [-l/2, l/2] x [-w/2, w/2]  
+        if -l/2 <= x_rotated <= l/2 and -w/2 <= y_rotated <= w/2:  
+            return True  
+        else:  
+            return False  
+  
+
+    def GaussProj(self,lon,lat):
+        iPI = 0.0174532925199433
+        ZoneWide = 6
+        a = 6378245.0
+        f = 1.0 / 298.3
+        ProjNo = int(lon / ZoneWide)
+        longitude0 = ProjNo * ZoneWide + ZoneWide / 2
+        longitude0 = longitude0 * iPI
+        latitude0 = 0
+        longitude1 = lon * iPI #经度转换为弧度
+        latitude1 = lat * iPI #//纬度转换为弧度
+        e2 = 2 * f - f * f
+        ee = e2 * (1.0 - e2)
+        NN = a / math.sqrt(1.0 - e2 * math.sin(latitude1)*math.sin(latitude1))
+        T = math.tan(latitude1)*math.tan(latitude1)
+        C = ee * math.cos(latitude1)*math.cos(latitude1)
+        A = (longitude1 - longitude0)*math.cos(latitude1)
+        M = a * ((1 - e2 / 4 - 3 * e2*e2 / 64 - 5 * e2*e2*e2 / 256)*latitude1 - (3 * e2 / 8 + 3 * e2*e2 / 32 + 45 * e2*e2*e2 / 1024)*math.sin(2 * latitude1)+ (15 * e2*e2 / 256 + 45 * e2*e2*e2 / 1024)*math.sin(4 * latitude1) - (35 * e2*e2*e2 / 3072)*math.sin(6 * latitude1))
+        xval = NN * (A + (1 - T + C)*A*A*A / 6 + (5 - 18 * T + T * T + 72 * C - 58 * ee)*A*A*A*A*A / 120)
+        yval = M + NN * math.tan(latitude1)*(A*A / 2 + (5 - T + 9 * C + 4 * C*C)*A*A*A*A / 24 + (61 - 58 * T + T * T + 600 * C - 330 * ee)*A*A*A*A*A*A / 720)
+        X0 = 1000000 * (ProjNo + 1) + 500000
+        Y0 = 0
+        xval = xval + X0; yval = yval + Y0;
+        X = xval
+        Y = yval
+        return X,Y
+    
+    def GaussProjInvCal(self,X,Y):
+        iPI = 0.0174532925199433   #3.1415926535898/180.0;
+        a = 6378245.0
+        f = 1.0 / 298.3 # //54年北京坐标系参数
+                #////a=6378140.0; f=1/298.257; //80年西安坐标系参数
+        ZoneWide = 6  # ////6度带宽
+        ProjNo = int(X / 1000000)  # //查找带号
+        longitude0 = (ProjNo - 1) * ZoneWide + ZoneWide / 2
+        longitude0 = longitude0 * iPI  # //中央经线
+        X0 = ProjNo * 1000000 + 500000  
+        Y0 = 0
+        xval = X - X0; yval = Y - Y0 #//带内大地坐标
+        e2 = 2 * f - f * f 
+        e1 = (1.0 - math.sqrt(1 - e2)) / (1.0 + math.sqrt(1 - e2))
+        ee = e2 / (1 - e2)
+        M = yval
+        u = M / (a*(1 - e2 / 4 - 3 * e2*e2 / 64 - 5 * e2*e2*e2 / 256))
+        fai = u + (3 * e1 / 2 - 27 * e1*e1*e1 / 32)*math.sin(2 * u) + (21 * e1*e1 / 16 - 55 * e1*e1*e1*e1 / 32)*math.sin(4 * u)+ (151 * e1*e1*e1 / 96)*math.sin(6 * u) + (1097 * e1*e1*e1*e1 / 512)*math.sin(8 * u)
+        C = ee * math.cos(fai)*math.cos(fai)
+        T = math.tan(fai)*math.tan(fai)
+        NN = a / math.sqrt(1.0 - e2 * math.sin(fai)*math.sin(fai))
+        R = a * (1 - e2) / math.sqrt((1 - e2 * math.sin(fai)*math.sin(fai))*(1 - e2 * math.sin(fai)*math.sin(fai))*(1 - e2 * math.sin(fai)*math.sin(fai)))
+        D = xval / NN
+        #//计算经度(Longitude) 纬度(Latitude)
+        longitude1 = longitude0 + (D - (1 + 2 * T + C)*D*D*D / 6 + (5 - 2 * C + 28 * T - 3 * C*C + 8 * ee + 24 * T*T)*D*D*D*D*D / 120) / math.cos(fai)
+        latitude1 = fai - (NN*math.tan(fai) / R)*(D*D / 2 - (5 + 3 * T + 10 * C - 4 * C*C - 9 * ee)*D*D*D*D / 24 + (61 + 90 * T + 298 * C + 45 * T*T - 256 * ee - 3 * C*C)*D*D*D*D*D*D / 720)
+        #//转换为度 DD
+        longitude = longitude1 / iPI
+        latitude = latitude1 / iPI
+        return longitude,latitude

+ 80 - 0
src/python/cameradecision/cameradecisonmain.py

@@ -0,0 +1,80 @@
+import modulecommpython
+import numpy as np  
+import time
+import sys  
+
+
+
+import proto.decition_pb2 as decition_pb2
+import proto.cameraobjectarray_pb2 as cameraobjectarray_pb2
+
+from PyModuleCommModule import PyModuleComm
+from cameradecision import CameraDecision
+
+
+
+
+time_objectarray = 0
+msg_cameraobjectarray = cameraobjectarray_pb2.cameraobjectarray()
+
+gdecision = CameraDecision()
+
+
+
+def cameraobjectarray_callback(arr : np,nsize,time):
+    global msg_cameraobjectarray
+    global time_objectarray
+    sub_arr = arr[0:nsize]
+    databytes = sub_arr.tobytes() #sub_arr.tostring()
+    msg = cameraobjectarray_pb2.cameraobjectarray()
+    msg.ParseFromString(databytes)
+    msg_cameraobjectarray = msg
+    time_objectarray = time
+ #   length = len(msg_cameraobjectarray.obj)
+ #   print("obj size: ",length)
+    pass
+    
+def SendDefDecision(md : PyModuleComm):
+    pass
+
+def MakeDecision(md : PyModuleComm,  xobjarray: cameraobjectarray_pb2.cameraobjectarray):
+    global gdecision
+    if time_objectarray == 0 :
+        print(" no object")
+        return
+#    print("map1 point lenth: ",length)
+    xdecision = gdecision.CalcDecision(xobjarray)
+    serialized_str = xdecision.SerializeToString()  
+    serialized_array = np.frombuffer(serialized_str, dtype=np.uint8)  
+    length = len(serialized_array)
+    md.SendData(serialized_array,length)
+    pass
+
+    
+
+def main():  
+
+    # 初始化一个变量  
+    count = 0
+    count = 3.5/1.5
+    count = int(count)
+    print("count = ",count)  
+
+
+
+    mobj = PyModuleComm("signarray")
+    mobj.RegisterRecv(cameraobjectarray_callback)
+
+    md = PyModuleComm("deciton")
+    md.RegiseterSend(100000,1)
+    # 使用while循环,只要count小于10,就继续循环  
+    while count < 10:
+        MakeDecision(md,msg_cameraobjectarray)
+        time.sleep(0.05)
+
+  
+    print("循环结束!")  
+  
+# 调用main函数  
+if __name__ == "__main__":  
+    main()

+ 0 - 0
src/python/cameradecision/proto/__init__.py


+ 28 - 0
src/python/cameradecision/proto/cameraobject.proto

@@ -0,0 +1,28 @@
+syntax = "proto2";
+
+package iv.vision;
+
+message cameraobject
+{
+  optional int32 id = 1;   
+  optional string type = 2;  
+  optional float con = 3;   
+  optional int32 objmovestate = 4;  
+  optional int32 objawaystate = 5;  
+  optional int32 objcutstate = 6;  
+  optional int32 trajectime = 7;   
+  optional int32 lineid = 8;        
+  optional float w = 9;            
+  optional float h = 10;           
+  optional float Azimuth = 11;     
+  optional float speedx = 12;       
+  optional float speedy = 13;      
+  optional float accelerationx = 14;  
+  optional float accelerationy = 15;  
+  optional float x = 16; 
+  optional float y = 17; 
+  optional float outpointx = 18;  
+  optional float outpointy = 19;   
+};
+
+

+ 25 - 0
src/python/cameradecision/proto/cameraobject_pb2.py

@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: cameraobject.proto
+"""Generated protocol buffer code."""
+from google.protobuf.internal import builder as _builder
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import symbol_database as _symbol_database
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+
+
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12\x63\x61meraobject.proto\x12\tiv.vision\"\xcb\x02\n\x0c\x63\x61meraobject\x12\n\n\x02id\x18\x01 \x01(\x05\x12\x0c\n\x04type\x18\x02 \x01(\t\x12\x0b\n\x03\x63on\x18\x03 \x01(\x02\x12\x14\n\x0cobjmovestate\x18\x04 \x01(\x05\x12\x14\n\x0cobjawaystate\x18\x05 \x01(\x05\x12\x13\n\x0bobjcutstate\x18\x06 \x01(\x05\x12\x12\n\ntrajectime\x18\x07 \x01(\x05\x12\x0e\n\x06lineid\x18\x08 \x01(\x05\x12\t\n\x01w\x18\t \x01(\x02\x12\t\n\x01h\x18\n \x01(\x02\x12\x0f\n\x07\x41zimuth\x18\x0b \x01(\x02\x12\x0e\n\x06speedx\x18\x0c \x01(\x02\x12\x0e\n\x06speedy\x18\r \x01(\x02\x12\x15\n\raccelerationx\x18\x0e \x01(\x02\x12\x15\n\raccelerationy\x18\x0f \x01(\x02\x12\t\n\x01x\x18\x10 \x01(\x02\x12\t\n\x01y\x18\x11 \x01(\x02\x12\x11\n\toutpointx\x18\x12 \x01(\x02\x12\x11\n\toutpointy\x18\x13 \x01(\x02')
+
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'cameraobject_pb2', globals())
+if _descriptor._USE_C_DESCRIPTORS == False:
+
+  DESCRIPTOR._options = None
+  _CAMERAOBJECT._serialized_start=34
+  _CAMERAOBJECT._serialized_end=365
+# @@protoc_insertion_point(module_scope)

+ 12 - 0
src/python/cameradecision/proto/cameraobjectarray.proto

@@ -0,0 +1,12 @@
+
+syntax = "proto2";
+
+package iv.vision;
+
+import "cameraobject.proto";
+
+message cameraobjectarray
+{
+  repeated cameraobject obj = 1;
+  optional int64 mstime = 2;
+};

+ 27 - 0
src/python/cameradecision/proto/cameraobjectarray_pb2.py

@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: cameraobjectarray.proto
+"""Generated protocol buffer code."""
+from google.protobuf.internal import builder as _builder
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import symbol_database as _symbol_database
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+from . import cameraobject_pb2 as cameraobject__pb2
+#import cameraobject_pb2 as cameraobject__pb2
+
+
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17\x63\x61meraobjectarray.proto\x12\tiv.vision\x1a\x12\x63\x61meraobject.proto\"I\n\x11\x63\x61meraobjectarray\x12$\n\x03obj\x18\x01 \x03(\x0b\x32\x17.iv.vision.cameraobject\x12\x0e\n\x06mstime\x18\x02 \x01(\x03')
+
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'cameraobjectarray_pb2', globals())
+if _descriptor._USE_C_DESCRIPTORS == False:
+
+  DESCRIPTOR._options = None
+  _CAMERAOBJECTARRAY._serialized_start=58
+  _CAMERAOBJECTARRAY._serialized_end=131
+# @@protoc_insertion_point(module_scope)

+ 33 - 0
src/python/cameradecision/proto/chassis.proto

@@ -0,0 +1,33 @@
+syntax = "proto2";
+
+package iv;
+
+message chassis
+{
+  optional int64 time = 1; //ms
+  optional int32 EPSMode = 2  [default = 0]; //0 idle 1 Manual 2 Auto
+  optional int32 EPBFault = 3 [default = 0];  //0 No 1 Have Fault
+  optional int32 DriveMode = 4;      //0 Manual 1 Auto
+  optional int32 Shift = 5;  //0 N  1 D   2 R  3 P  hapo:1p2r3n4d
+  optional int32 AEBAvailable = 6;
+  optional int32 CDDAvailable = 7;
+  optional int32 angle_feedback = 8;
+  optional float torque = 9;
+  optional float vel = 10;   //km/h
+  optional float accstep = 11;
+  optional float soc = 12;
+  optional float brake_feedback = 13;
+  optional int32 EPB_feedback = 14;
+  optional int32 EmergencyStop_feedback = 15;
+  optional int32 brakelight_feedback = 16;
+  optional float range_feedback = 17;
+  optional int32 drivectrltype_feedback = 18;
+  optional int32 brakectrltype_feedback = 19;
+  optional int32 epsctrltype_feedback = 20;
+  optional float frontleftwheel_feedback = 21;
+  optional float frontrightwheel_feedback = 22;
+  optional float rearleftwheel_feedback = 23;
+  optional float rearrightwheel_feedback = 24;
+  optional float engine_speed = 25;
+  
+};

+ 25 - 0
src/python/cameradecision/proto/chassis_pb2.py

@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: chassis.proto
+"""Generated protocol buffer code."""
+from google.protobuf.internal import builder as _builder
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import symbol_database as _symbol_database
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+
+
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rchassis.proto\x12\x02iv\"\xdc\x04\n\x07\x63hassis\x12\x0c\n\x04time\x18\x01 \x01(\x03\x12\x12\n\x07\x45PSMode\x18\x02 \x01(\x05:\x01\x30\x12\x13\n\x08\x45PBFault\x18\x03 \x01(\x05:\x01\x30\x12\x11\n\tDriveMode\x18\x04 \x01(\x05\x12\r\n\x05Shift\x18\x05 \x01(\x05\x12\x14\n\x0c\x41\x45\x42\x41vailable\x18\x06 \x01(\x05\x12\x14\n\x0c\x43\x44\x44\x41vailable\x18\x07 \x01(\x05\x12\x16\n\x0e\x61ngle_feedback\x18\x08 \x01(\x05\x12\x0e\n\x06torque\x18\t \x01(\x02\x12\x0b\n\x03vel\x18\n \x01(\x02\x12\x0f\n\x07\x61\x63\x63step\x18\x0b \x01(\x02\x12\x0b\n\x03soc\x18\x0c \x01(\x02\x12\x16\n\x0e\x62rake_feedback\x18\r \x01(\x02\x12\x14\n\x0c\x45PB_feedback\x18\x0e \x01(\x05\x12\x1e\n\x16\x45mergencyStop_feedback\x18\x0f \x01(\x05\x12\x1b\n\x13\x62rakelight_feedback\x18\x10 \x01(\x05\x12\x16\n\x0erange_feedback\x18\x11 \x01(\x02\x12\x1e\n\x16\x64rivectrltype_feedback\x18\x12 \x01(\x05\x12\x1e\n\x16\x62rakectrltype_feedback\x18\x13 \x01(\x05\x12\x1c\n\x14\x65psctrltype_feedback\x18\x14 \x01(\x05\x12\x1f\n\x17\x66rontleftwheel_feedback\x18\x15 \x01(\x02\x12 \n\x18\x66rontrightwheel_feedback\x18\x16 \x01(\x02\x12\x1e\n\x16rearleftwheel_feedback\x18\x17 \x01(\x02\x12\x1f\n\x17rearrightwheel_feedback\x18\x18 \x01(\x02\x12\x14\n\x0c\x65ngine_speed\x18\x19 \x01(\x02')
+
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'chassis_pb2', globals())
+if _descriptor._USE_C_DESCRIPTORS == False:
+
+  DESCRIPTOR._options = None
+  _CHASSIS._serialized_start=22
+  _CHASSIS._serialized_end=626
+# @@protoc_insertion_point(module_scope)

+ 60 - 0
src/python/cameradecision/proto/decition.proto

@@ -0,0 +1,60 @@
+syntax = "proto2";
+
+package iv.brain;
+
+message decition
+{
+    optional float speed = 1;                //车速
+    optional float wheelAngle = 2;           //横向转向角度
+    optional float wheelSpeed = 3;           //方向盘角速度
+    optional float lateralTorque = 4;        //横向扭矩
+    optional float brake = 5;                //刹车
+    optional float accelerator = 6;          //纵向加速度
+    optional float torque = 7;               //油门
+    optional bool  leftLamp = 8;             //左转向灯
+    optional bool  rightLamp = 9;            //右转向灯
+    optional bool  doubleSpark = 10;          //双闪
+    optional bool  headLight = 11;            //前灯
+    optional bool  highBeam = 12;             //远光灯
+    optional int32  dippedLight = 13;          //近光灯
+    optional bool  tailLight = 14;            //尾灯
+    optional bool  domeLight = 15;            //顶灯
+    optional bool  fogLamp = 16;              //雾灯
+    optional bool  backupLight = 17;          //倒车灯
+    optional bool  brakeLamp = 18;            //制动灯
+    optional int32   engine = 19;               //发动机点火
+    optional int32   mode = 20;                 //模式:自动or手动
+    optional int32  handBrake = 21;            //手刹
+    optional bool  speak = 22;                //喇叭
+    optional int32  door = 23;                 //车门
+    optional int32   gear = 24;                 //挡位
+    optional int32   wiper = 25;                //雨刷
+    optional int32   grade = 26;                 //GE3使用的一个指标
+    optional float   ttc = 27;                  //预测碰撞时间 
+    optional bool   air_enable = 28;                  //空调使能 
+    optional float   air_temp = 29;                  //空调温度 
+    optional float   air_mode = 30;                  //空调模式 
+    optional float   wind_level = 31;                  //空调风力 
+    optional int32   roof_light = 32;                  //顶灯 
+    optional int32   home_light = 33;                  //日光灯 
+    optional float   air_worktime = 34;                  //空调工作时间
+    optional float   air_offtime = 35;                  //空调关闭时间 
+    optional bool   air_on = 36;                  //空调使能 
+	// vv7-tdu
+	optional bool air_ac = 37;
+	optional bool air_circle = 38;
+	optional bool air_auto = 39;
+	optional bool air_off = 40;
+	optional uint32 window_fl = 41;
+	optional uint32 window_fr = 42;
+	optional uint32 window_rl = 43;
+	optional uint32 window_rr = 44;
+    //chang_an_shen_lan
+	optional uint32 angle_mode = 45;  //横向控制激活模式
+	optional uint32 angle_active = 46; //横向控制激活,和上一条同时满足才执行横向请求角度 
+	optional uint32 acc_active = 47; //ACC扭矩请求激活(为1激活,为0不激活),不激活后不执行扭矩请求
+	optional uint32 brake_active = 48; //ACC减速激活(为1制动激活,为0制动不激活)
+	optional uint32 brake_type = 49;//ADC请求类型(制动时为1,其余情况为0)
+	optional float niuju_y = 50; //纵向扭矩
+	optional uint32 auto_mode = 51; //3为自动控制模式
+};

File diff suppressed because it is too large
+ 15 - 0
src/python/cameradecision/proto/decition_pb2.py


+ 19 - 0
src/python/cameradecision/readme.md

@@ -0,0 +1,19 @@
+sudo apt install python3-numpy
+
+sudo apt install python3-protobuf
+
+
+到src/common/modulecomm目录下新建一个build文件夹
+cd build
+cmake ..
+make
+将生成的modulecommpython.so文件拷贝到本文件夹
+
+
+
+如果需要修改_pb2.py,进入proto文件夹。
+执行:
+protoc *.proto -I=./ --python_out=./
+
+cameraobjectarray_pb2.py里修改cameraobject__pb2的导入方式,加from . 
+from . import cameraobject_pb2 as cameraobject__pb2

Some files were not shown because too many files changed in this diff