Selaa lähdekoodia

添加带界面测试的controller

fujiankuan 3 vuotta sitten
vanhempi
commit
86cc4736e9

+ 51 - 0
src/controller/controller_UI_test/boost.h

@@ -0,0 +1,51 @@
+#pragma once
+
+#ifndef _IV_BOOST_H_
+#define _IV_BOOST_H_
+
+#if defined __GNUC__
+#  pragma GCC system_header 
+#endif
+#ifndef __CUDACC__
+//https://bugreports.qt-project.org/browse/QTBUG-22829
+#ifndef Q_MOC_RUN
+#include <boost/version.hpp>
+#include <boost/numeric/conversion/cast.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/condition.hpp>
+#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/bind.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/function.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/inherit.hpp>
+#include <boost/mpl/inherit_linearly.hpp>
+#include <boost/mpl/joint_view.hpp>
+#include <boost/mpl/transform.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/algorithm/string.hpp>
+#ifndef Q_MOC_RUN
+#include <boost/date_time/posix_time/posix_time.hpp>
+#endif
+#if BOOST_VERSION >= 104700
+#include <boost/chrono.hpp>
+#endif
+#include <boost/tokenizer.hpp>
+#include <boost/foreach.hpp>
+#include <boost/shared_array.hpp>
+#include <boost/interprocess/sync/file_lock.hpp>
+#if BOOST_VERSION >= 104900
+#include <boost/interprocess/permissions.hpp>
+#endif
+#include <boost/iostreams/device/mapped_file.hpp>
+#define BOOST_PARAMETER_MAX_ARITY 7
+#include <boost/signals2.hpp>
+#include <boost/signals2/slot.hpp>
+#endif
+#endif
+#endif    // _IV_BOOST_H_

+ 51 - 0
src/controller/controller_UI_test/common/boost.h

@@ -0,0 +1,51 @@
+#pragma once
+
+#ifndef _IV_BOOST_H_
+#define _IV_BOOST_H_
+
+#if defined __GNUC__
+#  pragma GCC system_header 
+#endif
+#ifndef __CUDACC__
+//https://bugreports.qt-project.org/browse/QTBUG-22829
+#ifndef Q_MOC_RUN
+#include <boost/version.hpp>
+#include <boost/numeric/conversion/cast.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/condition.hpp>
+#include <boost/thread.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/bind.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/function.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/inherit.hpp>
+#include <boost/mpl/inherit_linearly.hpp>
+#include <boost/mpl/joint_view.hpp>
+#include <boost/mpl/transform.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/algorithm/string.hpp>
+#ifndef Q_MOC_RUN
+#include <boost/date_time/posix_time/posix_time.hpp>
+#endif
+#if BOOST_VERSION >= 104700
+#include <boost/chrono.hpp>
+#endif
+#include <boost/tokenizer.hpp>
+#include <boost/foreach.hpp>
+#include <boost/shared_array.hpp>
+#include <boost/interprocess/sync/file_lock.hpp>
+#if BOOST_VERSION >= 104900
+#include <boost/interprocess/permissions.hpp>
+#endif
+#include <boost/iostreams/device/mapped_file.hpp>
+#define BOOST_PARAMETER_MAX_ARITY 7
+#include <boost/signals2.hpp>
+#include <boost/signals2/slot.hpp>
+#endif
+#endif
+#endif    // _IV_BOOST_H_

+ 20 - 0
src/controller/controller_UI_test/common/car_status.cpp

@@ -0,0 +1,20 @@
+#include "common/car_status.h"
+
+#ifdef linux
+
+unsigned long GetTickCount()
+{
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC,&ts);
+ return (ts.tv_sec * 1000 + ts.tv_nsec/(1000*1000) );
+}
+#endif
+
+iv::CarStatus::CarStatus()
+{
+
+}
+
+iv::CarStatus::~CarStatus()
+{
+}

+ 28 - 0
src/controller/controller_UI_test/common/car_status.h

@@ -0,0 +1,28 @@
+#pragma once
+#ifndef _IV_COMMON_CAR_STATUS_
+#define _IV_COMMON_CAR_STATUS_
+
+#include <common/boost.h>
+#include <boost/serialization/singleton.hpp>
+#include <time.h>
+#include <QTime>
+#include <QVector>
+
+
+#ifdef linux
+unsigned long GetTickCount();
+#endif
+namespace iv {
+class CarStatus : public boost::noncopyable {
+public:
+    CarStatus();
+    ~CarStatus();
+
+    float wheelangle = 0;
+    float torque = 0;
+    float brake = 0;
+};
+typedef boost::serialization::singleton<iv::CarStatus> CarStatusSingleton;//非线程安全,注意多线程加锁,单例模式
+}
+#define ServiceCarStatus iv::CarStatusSingleton::get_mutable_instance()
+#endif // !_IV_COMMON_CAR_STATUS_

+ 10 - 0
src/controller/controller_UI_test/control/control.pri

@@ -0,0 +1,10 @@
+HEADERS += \
+    $$PWD/controller.h \
+    $$PWD/control_status.h \
+    $$PWD/vv7.h
+
+SOURCES += \
+    $$PWD/controller.cpp \
+    $$PWD/control_status.cpp
+
+DISTFILES +=

+ 488 - 0
src/controller/controller_UI_test/control/control_status.cpp

@@ -0,0 +1,488 @@
+#include <control/control_status.h>
+#include <QDebug>
+
+
+
+
+
+//#if 1
+
+
+void iv::control::ControlStatus::set_cmd_checksum(unsigned char cmd_id)
+{
+    unsigned int check_sum=0;
+    if(cmd_id==0x10)
+    {
+        for(int i=0;i<7;i++)
+        {
+            check_sum^=(ServiceControlStatus.command10.byte[i]);
+        }
+        ServiceControlStatus.command10.byte[7]=check_sum;
+    }else if(cmd_id==0x11)
+    {
+        for(int i=0;i<7;i++)
+        {
+            check_sum^=(ServiceControlStatus.command11.byte[i]);
+        }
+        ServiceControlStatus.command11.byte[7]=check_sum;
+    }else if(cmd_id==0x12)
+    {
+        for(int i=0;i<7;i++)
+        {
+            check_sum^=(ServiceControlStatus.command12.byte[i]);
+        }
+        ServiceControlStatus.command12.byte[7]=check_sum;
+    }
+}
+
+
+
+
+void iv::control::ControlStatus::set_wheel_angle(float angle)
+{
+
+    int ang =(angle+870)*10;
+    ServiceControlStatus.command12.bit.ang_H = (ang)  /256;
+    ServiceControlStatus.command12.bit.ang_L = (ang)  % 256;
+}
+
+
+
+void iv::control::ControlStatus::set_wheel_speed(float speed)
+{
+
+    int angSpeed =speed;
+    ServiceControlStatus.command12.bit.ang_speed = angSpeed;
+}
+
+void iv::control::ControlStatus::set_wheel_enable(bool enable)
+{
+
+    if(enable){
+        ServiceControlStatus.command12.bit.ang_enable = 1;
+    }else{
+        ServiceControlStatus.command12.bit.ang_enable = 0;
+    }
+}
+
+
+
+
+ void iv::control::ControlStatus::set_speed_limit(float speed)
+ {
+     ServiceControlStatus.command11.bit.speed_limit = (unsigned)speed;
+ }
+
+
+
+void iv::control::ControlStatus::set_aeb(float aeb)
+{
+    int aebBrake =(aeb+16)/0.000488;
+    ServiceControlStatus.command11.bit.aeb_H = (aebBrake)  /256;
+    ServiceControlStatus.command11.bit.aeb_L = (aebBrake)  % 256;
+}
+
+void iv::control::ControlStatus::set_torque(float troque)
+{
+    command11.bit.torque=(unsigned)(troque*2.5);
+}
+
+void iv::control::ControlStatus::set_brake(float brake)
+{
+    command11.bit.brake=(unsigned)brake;
+}
+
+
+
+void iv::control::ControlStatus::set_gear(int gear)
+{
+    command11.bit.gear = (unsigned)gear;
+}
+
+void iv::control::ControlStatus::set_handBrake(bool handbrake)
+{
+    if(handbrake){
+        command11.bit.park = 2;
+    }else{
+        command11.bit.park = 1;
+    }
+}
+
+void iv::control::ControlStatus::set_driveMode(char driveMode)
+{
+    command11.bit.driveMode = (unsigned)driveMode;
+}
+
+void iv::control::ControlStatus::set_gear_enable(bool enable){
+    if (enable == true)
+        command11.bit.gear_enable = 1;
+    else
+        command11.bit.gear_enable = 0;
+}
+
+void iv::control::ControlStatus::set_acc_enable(bool enable){
+    if (enable == true)
+        command11.bit.acc_enable = 1;
+    else
+        command11.bit.acc_enable = 0;
+}
+
+void iv::control::ControlStatus::set_aeb_enable(bool enable){
+    if (enable == true)
+        command11.bit.aeb_enable = 1;
+    else
+        command11.bit.aeb_enable = 0;
+}
+
+
+//void iv::control::ControlStatus::set_win_lf(char para)
+//{
+//    command10.bit.windowlf = (unsigned)para;
+//}
+
+//void iv::control::ControlStatus::set_win_rf(char para)
+//{
+//    command10.bit.windowrf = (unsigned)para;
+//}
+
+//void iv::control::ControlStatus::set_win_lr(char para)
+//{
+//    command10.bit.windowlr = (unsigned)para;
+//}
+
+//void iv::control::ControlStatus::set_win_rr(char para)
+//{
+//    command10.bit.windowrr = (unsigned)para;
+//}
+
+//空调控制
+void iv::control::ControlStatus::set_air_on(char para)
+{
+    command10.bit.air_on = (unsigned)para;
+}
+
+
+
+//void iv::control::ControlStatus::set_air_cricle(char para)
+//{
+//    command10.bit.air_cricle = (unsigned)para;
+//}
+
+
+//void iv::control::ControlStatus::set_air_auto(char para)
+//{
+//    command10.bit.air_auto = (unsigned)para;
+//}
+
+
+//void iv::control::ControlStatus::set_air_off(char para)
+//{
+//    command10.bit.air_off = (unsigned)para;
+//}
+
+
+//void iv::control::ControlStatus::set_air_temup(char para)
+//{
+//    command10.bit.tem_up = (unsigned)para;
+//}
+
+
+//void iv::control::ControlStatus::set_air_temdown(char para)
+//{
+//    command10.bit.tem_down = (unsigned)para;
+//}
+
+
+//void iv::control::ControlStatus::set_air_powerup(char para)
+//{
+//    command10.bit.power_up = (unsigned)para;
+//}
+
+
+//void iv::control::ControlStatus::set_air_powerdown(char para)
+//{
+//    command10.bit.power_down = (unsigned)para;
+//}
+
+
+void iv::control::ControlStatus::set_obligate(char para)
+{
+    command10.bit.ignition = (unsigned)para;
+}
+
+
+void iv::control::ControlStatus::set_door(char enable)
+{
+    command10.bit.door = (unsigned)enable;
+}
+
+
+void iv::control::ControlStatus::set_turnsignals_control(bool left, bool right)
+{
+    if ( (left == true) && (right == false) )
+    {
+        command10.bit.turn_light = 0x01;
+    }
+    else if ( (left == false) && (right == true) )
+    {
+        command10.bit.turn_light = 0x02;
+    }
+    else if ((left == false) && (right == false))
+    {
+        command10.bit.turn_light = 0x00;
+    }
+    else
+    {
+        command10.bit.turn_light = 0x03;
+    }
+}
+
+
+void iv::control::ControlStatus::set_small_light(char para)
+{
+    command10.bit.small_light = (unsigned)para;
+}
+
+
+void iv::control::ControlStatus::set_near_light(char para)
+{
+    command10.bit.near_light = (unsigned)para;
+}
+
+
+void iv::control::ControlStatus::set_horn(char para)
+{
+    command10.bit.horn = (unsigned)para;
+}
+
+
+void iv::control::ControlStatus::set_far_light(char para)
+{
+    command10.bit.far_light = (unsigned)para;
+}
+
+
+void iv::control::ControlStatus::set_frog_light(char para)
+{
+    command10.bit.fog_light = (unsigned)para;
+}
+
+
+void iv::control::ControlStatus::set_wiper(char para)
+{
+    command10.bit.wiper = (unsigned)para;
+}
+
+
+void iv::control::ControlStatus::set_brake_light(char para)
+{
+    command10.bit.brake_light = (unsigned)para;
+}
+
+
+void iv::control::ControlStatus::set_defrog(char para)
+{
+    command10.bit.defrog = (unsigned)para;
+}
+
+
+void iv::control::ControlStatus::set_reverse_light(char para)
+{
+    command10.bit.revers_light = (unsigned)para;
+}
+
+
+void set_air_temp(char para);
+void set_air_mode(char para);
+void set_air_enable(bool enable);
+void set_wind_level(char para);
+void set_roof_light(char para);
+void set_home_light(char para);
+void set_air_worktime(char para);
+void set_air_offtime(char para);
+
+void iv::control::ControlStatus::set_air_temp(char para)
+{
+    command10.bit.air_temp = (unsigned)para+40;
+}
+
+
+void iv::control::ControlStatus::set_air_mode(char para)
+{
+    command10.bit.air_mode = (unsigned)para;
+}
+
+void iv::control::ControlStatus::set_air_enable(bool enable)
+{
+    if(enable){
+        command10.bit.air_enable = 0x01;
+    }else{
+        command10.bit.air_enable = 0x00;
+    }
+}
+
+void iv::control::ControlStatus::set_wind_level(char para)
+{
+    command10.bit.air_wind_level = (unsigned)para;
+}
+
+void iv::control::ControlStatus::set_roof_light(char para)
+{
+    command10.bit.roof_light = (unsigned)para;
+}
+
+void iv::control::ControlStatus::set_home_light(char para)
+{
+    command10.bit.home_light = (unsigned)para;
+}
+
+void iv::control::ControlStatus::set_air_worktime(char para)
+{
+    command10.bit.air_work_time = (unsigned)para;
+}
+
+
+void iv::control::ControlStatus::set_air_offtime(char para)
+{
+    command10.bit.air_off_time = (unsigned)para;
+}
+
+
+//void iv::control::ControlStatus::set_speaker(bool enable){
+//    if (enable == true)
+//        command.bit.speaker = 1;
+//    else
+//        command.bit.speaker = 0;
+//}
+
+//void iv::control::ControlStatus::set_door(char enable){
+//    if (enable == true)
+//        command.bit.door = 1;
+//    else
+//        command.bit.door = 0;
+//}
+
+//void iv::control::ControlStatus::set_doorEnable(bool enable){
+//    if (enable == true){
+//        command.bit.doorEnable = 1;
+//        command.bit.door=1;
+//    }
+//    else{
+//        command.bit.doorEnable = 0;
+//        command.bit.door=0;
+//    }
+//}
+
+////void iv::control::ControlStatus::set_flicker(bool enable){
+////    if (enable == true)
+////        command.bit.flicker = 1;
+////    else
+////        command.bit.flicker = 0;
+////}
+//void iv::control::ControlStatus::set_light(bool enable){
+//    if (enable == true)
+//       command.bit.bright = 1;
+//    else
+//       command.bit.bright = 0;
+//}
+
+//void iv::control::ControlStatus::set_leftlight(bool enable){
+//    if (enable == true)
+//       command.bit.left_turn = 1;
+//    else
+//       command.bit.left_turn = 0;
+//}
+
+
+//void iv::control::ControlStatus::set_rightlight(bool enable){
+//    if (enable == true)
+//       command.bit.right_turn = 1;
+//    else
+//       command.bit.right_turn = 0;
+//}
+
+
+
+
+
+
+//void iv::control::ControlStatus::set_turnsignals_control(bool left, bool right){
+//    if (left == true)
+//    {
+//        command.bit.left_turn = 1;
+//        command.bit.right_turn = 0;
+//    }
+//    else if (right == true)
+//    {
+//        command.bit.left_turn = 0;
+//        command.bit.right_turn = 1;
+//    }
+//    else
+//    {
+//        command.bit.left_turn = 0;
+//        command.bit.right_turn = 0;
+//    }
+//}
+
+
+
+
+
+
+
+
+//#else
+
+//void iv::control::ControlStatus::set_accelerate(float percent)
+//{
+//    command.bit.acce = (unsigned)((percent + 7) * 20);
+//}
+//void iv::control::ControlStatus::set_wheel_angle(float angle)
+//{
+//    command.bit.ang_H = angle * 10 >> 8;
+
+//    command.bit.ang_L = angle * 10 % 256;
+//}
+//void iv::control::ControlStatus::set_engine(char enable)
+//{
+//    command.bit.engine = enable;
+//}
+//void iv::control::ControlStatus::set_door(char enable){
+//    command.bit.door = enable;
+//}
+//void iv::control::ControlStatus::set_speaker(bool enable){
+//    if (enable == true)
+//        command.bit.speaker = 1;
+//    else
+//        command.bit.speaker = 0;
+//}
+//void iv::control::ControlStatus::set_flicker(bool enable){
+//    if (enable == true)
+//        command.bit.flicker = 1;
+//    else
+//        command.bit.flicker = 0;
+//}
+//void iv::control::ControlStatus::set_light(bool enable){
+//    if (enable == true)
+//       command.bit.bright = 1;
+//    else
+//       command.bit.bright = 0;
+//}
+//void iv::control::ControlStatus::set_turnsignals_control(bool left, bool right){
+//    if (left == true)
+//    {
+//        command.bit.left_turn = 1;
+//        command.bit.right_turn = 0;
+//    }
+//    else if (right == true)
+//    {
+//        command.bit.left_turn = 0;
+//        command.bit.right_turn = 1;
+//    }
+//    else
+//    {
+//        command.bit.left_turn = 0;
+//        command.bit.right_turn = 0;
+//    }
+//}
+//#endif

+ 108 - 0
src/controller/controller_UI_test/control/control_status.h

@@ -0,0 +1,108 @@
+#pragma once
+//由于控制器指令共享同一个ID 0x20,建立此类维护控制指令的最新状态
+
+#include <boost.h>
+#include <cstdint>
+#include <boost/serialization/singleton.hpp>
+#include <control/vv7.h>
+
+namespace iv {
+namespace control {
+class ControlStatus : public boost::noncopyable
+{
+public:
+    /*****************
+             * ****测试标志位*****
+             * ***************/
+    int normal_speed  = 0;//常规速度
+    int swerve_speed  = 0;//转弯速度
+    int high_speed = 0;//快速
+    int mid_speed = 0;//中速
+    int low_speed = 0;//慢速
+    int change_line  = -1;//换道标志
+    int stop_obstacle = -1;//停障标志
+    int elude_obstacle = -1;//避障标志
+    int special_signle = -1;//特殊信号标志
+    int car_pullover = -1;//靠边停车标志位
+    float torque = 0.0;
+    float brake = 0.0;
+    float acc=0.0;
+
+    Command10 command10 ;
+    Command11 command11 ;
+    Command12 command12;
+    Command_Response command_reponse;
+
+    int command_ID10 = 0x10;
+    int command_ID11 = 0x11;
+    int command_ID12 = 0x12;
+
+
+    void set_wheel_angle(float angle);
+    void set_wheel_speed(float speed);
+    void set_wheel_enable(bool enable);
+
+
+
+
+
+    void set_speed_limit(float speed);
+    void set_torque(float percent);
+    void set_aeb(float aeb);
+    void set_brake(float brake);
+    void set_gear(int gear);
+    void set_handBrake(bool handBrake);
+    void set_driveMode(char mode);
+    void set_gear_enable(bool enable);
+    void set_aeb_enable(bool enable);
+    void set_acc_enable(bool enable);
+
+
+
+
+    void set_win_lf(char para);
+    void set_win_rf(char para);
+    void set_win_lr(char para);
+    void set_win_rr(char para);
+    void set_air_on(char para);
+    void set_air_cricle(char para);
+    void set_air_auto(char para);
+    void set_air_off(char para);
+    void set_air_temup(char para);
+    void set_air_temdown(char para);
+    void set_air_powerup(char para);
+    void set_air_powerdown(char para);
+    void set_obligate(char para);
+    void set_door(char enable);
+    void set_turnsignals_control(bool left, bool right);
+    void set_small_light(char para);
+    void set_near_light(char para);
+    void set_horn(char para);
+    void set_far_light(char para);
+    void set_frog_light(char para);
+    void set_wiper(char para);
+    void set_brake_light(char para);
+    void set_defrog(char para);
+    void set_reverse_light(char para);
+
+    void set_air_temp(char para);
+    void set_air_mode(char para);
+    void set_air_enable(bool enable);
+    void set_wind_level(char para);
+    void set_roof_light(char para);
+    void set_home_light(char para);
+    void set_air_worktime(char para);
+    void set_air_offtime(char para);
+
+    void set_cmd_checksum(unsigned char cmd_id);
+
+
+
+
+
+
+};
+typedef boost::serialization::singleton<iv::control::ControlStatus> ControlStatusSingleton;
+}
+}
+#define ServiceControlStatus iv::control::ControlStatusSingleton::get_mutable_instance()

+ 145 - 0
src/controller/controller_UI_test/control/controlcan.h

@@ -0,0 +1,145 @@
+#ifndef CONTROLCAN1_H
+#define CONTROLCAN1_H
+
+
+#ifdef linux
+//接口卡类型定义
+#define VCI_PCI5121		1
+#define VCI_PCI9810		2
+#define VCI_USBCAN1		3
+#define VCI_USBCAN2		4
+#define VCI_PCI9820		5
+#define VCI_CAN232		6
+#define VCI_PCI5110		7
+#define VCI_CANLite		8
+#define VCI_ISA9620		9
+#define VCI_ISA5420		10
+
+//CAN错误码
+#define	ERR_CAN_OVERFLOW			0x0001	//CAN控制器内部FIFO溢出
+#define	ERR_CAN_ERRALARM			0x0002	//CAN控制器错误报警
+#define	ERR_CAN_PASSIVE				0x0004	//CAN控制器消极错误
+#define	ERR_CAN_LOSE				0x0008	//CAN控制器仲裁丢失
+#define	ERR_CAN_BUSERR				0x0010	//CAN控制器总线错误
+
+//通用错误码
+#define	ERR_DEVICEOPENED			0x0100	//设备已经打开
+#define	ERR_DEVICEOPEN				0x0200	//打开设备错误
+#define	ERR_DEVICENOTOPEN			0x0400	//设备没有打开
+#define	ERR_BUFFEROVERFLOW			0x0800	//缓冲区溢出
+#define	ERR_DEVICENOTEXIST			0x1000	//此设备不存在
+#define	ERR_LOADKERNELDLL			0x2000	//装载动态库失败
+#define ERR_CMDFAILED				0x4000	//执行命令失败错误码
+#define	ERR_BUFFERCREATE			0x8000	//内存不足
+
+
+//函数调用返回状态值
+#define	STATUS_OK					1
+#define STATUS_ERR					0
+	
+#define USHORT unsigned short int
+#define BYTE unsigned char
+#define CHAR char
+#define UCHAR unsigned char
+#define UINT unsigned int
+#define DWORD unsigned int
+#define PVOID void*
+#define ULONG unsigned int
+#define INT int
+#define UINT32 UINT
+#define LPVOID void*
+#define BOOL BYTE
+#define TRUE 1
+#define FALSE 0
+
+
+#if 1
+
+typedef  struct  _VCI_BOARD_INFO{//1.ZLGCAN系列接口卡信息的数据类型。
+		USHORT	hw_Version;
+		USHORT	fw_Version;
+		USHORT	dr_Version;
+		USHORT	in_Version;
+		USHORT	irq_Num;
+		BYTE	can_Num;
+		CHAR	str_Serial_Num[20];
+		CHAR	str_hw_Type[40];
+		USHORT	Reserved[4];
+} VCI_BOARD_INFO,*PVCI_BOARD_INFO; 
+
+
+typedef  struct  _VCI_CAN_OBJ{//2.定义CAN信息帧的数据类型。
+	UINT	ID;
+	UINT	TimeStamp;
+	BYTE	TimeFlag;
+	BYTE	SendType;
+	BYTE	RemoteFlag;//是否是远程帧
+	BYTE	ExternFlag;//是否是扩展帧
+	BYTE	DataLen;
+	BYTE	Data[8];
+	BYTE	Reserved[3];
+}VCI_CAN_OBJ,*PVCI_CAN_OBJ;
+
+
+typedef struct _VCI_CAN_STATUS{//3.定义CAN控制器状态的数据类型。
+	UCHAR	ErrInterrupt;
+	UCHAR	regMode;
+	UCHAR	regStatus;
+	UCHAR	regALCapture;
+	UCHAR	regECCapture; 
+	UCHAR	regEWLimit;
+	UCHAR	regRECounter; 
+	UCHAR	regTECounter;
+	DWORD	Reserved;
+}VCI_CAN_STATUS,*PVCI_CAN_STATUS;
+
+
+typedef struct _ERR_INFO{//4.定义错误信息的数据类型。
+		UINT	ErrCode;
+		BYTE	Passive_ErrData[3];
+		BYTE	ArLost_ErrData;
+} VCI_ERR_INFO,*PVCI_ERR_INFO;
+
+
+typedef struct _INIT_CONFIG{//5.定义初始化CAN的数据类型
+	DWORD	AccCode;
+	DWORD	AccMask;
+	DWORD	Reserved;
+	UCHAR	Filter;
+	UCHAR	Timing0;	
+	UCHAR	Timing1;	
+	UCHAR	Mode;
+}VCI_INIT_CONFIG,*PVCI_INIT_CONFIG;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+DWORD VCI_OpenDevice(DWORD DeviceType,DWORD DeviceInd,DWORD Reserved);
+DWORD VCI_CloseDevice(DWORD DeviceType,DWORD DeviceInd);
+DWORD VCI_InitCAN(DWORD DeviceType, DWORD DeviceInd, DWORD CANInd, PVCI_INIT_CONFIG pInitConfig);
+
+DWORD VCI_ReadBoardInfo(DWORD DeviceType,DWORD DeviceInd,PVCI_BOARD_INFO pInfo);
+DWORD VCI_ReadErrInfo(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,PVCI_ERR_INFO pErrInfo);
+DWORD VCI_ReadCANStatus(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,PVCI_CAN_STATUS pCANStatus);
+
+DWORD VCI_GetReference(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,DWORD RefType,PVOID pData);
+DWORD VCI_SetReference(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,DWORD RefType,PVOID pData);
+
+ULONG VCI_GetReceiveNum(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd);
+DWORD VCI_ClearBuffer(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd);
+
+DWORD VCI_StartCAN(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd);
+DWORD VCI_ResetCAN(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd);
+
+ULONG VCI_Transmit(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,PVCI_CAN_OBJ pSend,UINT Len);
+ULONG VCI_Receive(DWORD DeviceType,DWORD DeviceInd,DWORD CANInd,PVCI_CAN_OBJ pReceive,UINT Len,INT WaitTime);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif
+
+#endif

+ 204 - 0
src/controller/controller_UI_test/control/controller.cpp

@@ -0,0 +1,204 @@
+#include <control/controller.h>
+
+iv::control::Controller::Controller() {
+
+}
+
+iv::control::Controller::~Controller() {
+
+}
+
+void iv::control::Controller::inialize() {
+
+}
+
+
+
+
+
+//校验和
+void iv::control::Controller::cmd_checksum(unsigned char cmd_id) {
+    ServiceControlStatus.set_cmd_checksum(cmd_id);
+}
+//方向盘控制
+void iv::control::Controller::control_wheel(float angle) {
+    ServiceControlStatus.set_wheel_angle(angle);
+}
+
+void iv::control::Controller:: control_angle_speed(float angSpeed){
+    ServiceControlStatus.set_wheel_speed(angSpeed);
+}
+
+void iv::control::Controller:: control_angle_enable(bool enable){
+    ServiceControlStatus.set_wheel_enable(enable);
+}
+//速度限制
+void iv::control::Controller:: control_speed_limit(float speedLimit){
+    ServiceControlStatus.set_speed_limit(speedLimit);
+}
+//油门控制
+void iv::control::Controller::control_torque(float percent){
+    ServiceControlStatus.set_torque(percent);
+}
+void iv::control::Controller::control_acc_en(bool enanble){
+    ServiceControlStatus.set_acc_enable(enanble);
+}
+
+
+void iv::control::Controller::control_aeb(float aeb){
+    ServiceControlStatus.set_aeb(aeb);
+}
+void iv::control::Controller::control_aeb_en(bool enable){
+    ServiceControlStatus.set_aeb_enable(enable);
+}
+//刹车控制
+void iv::control::Controller::control_brake(float brake){
+    ServiceControlStatus.set_brake(brake);
+}
+//档位控制
+void iv::control::Controller::control_gear(float gear){
+    ServiceControlStatus.set_gear(gear);
+}
+void iv::control::Controller::control_gear_en(bool enable){
+    ServiceControlStatus.set_gear_enable(enable);
+}
+//手刹
+void iv::control::Controller::control_handBrake(bool  enable){
+    ServiceControlStatus.set_handBrake(enable);
+}
+//驾驶模式
+void iv::control::Controller::control_mode(char mode){
+    ServiceControlStatus.set_driveMode(mode);
+}
+//车窗控制
+//void iv::control::Controller::control_win_lf(char para){
+//     ServiceControlStatus.set_win_lf(para);
+//}
+//void iv::control::Controller::control_win_rf(char para){
+//     ServiceControlStatus.set_win_rf(para);
+//}
+
+//void iv::control::Controller::control_win_lr(char para){
+//     ServiceControlStatus.set_win_lr(para);
+//}
+
+//void iv::control::Controller::control_win_rr(char para){
+//     ServiceControlStatus.set_win_rr(para);
+//}
+
+//空调控制
+void iv::control::Controller::control_air_on(bool enable){
+    if(enable){
+        ServiceControlStatus.set_air_on(1);
+    }else{
+        ServiceControlStatus.set_air_on(0);
+    }
+}
+//void iv::control::Controller::control_air_cricle(char para){
+//     ServiceControlStatus.set_air_cricle(para);
+//}
+//void iv::control::Controller::control_air_auto(char para){
+//     ServiceControlStatus.set_air_auto(para);
+//}
+//void iv::control::Controller::control_air_off(char para){
+//     ServiceControlStatus.set_air_off(para);
+//}
+//void iv::control::Controller::control_air_temup(char para){
+//     ServiceControlStatus.set_air_temup(para);
+//}
+//void iv::control::Controller::control_air_temdown(char para){
+//     ServiceControlStatus.set_air_temdown(para);
+//}
+//void iv::control::Controller::control_air_powerup(char para){
+//     ServiceControlStatus.set_air_powerup(para);
+//}
+//void iv::control::Controller::control_air_powerdown(char para){
+//     ServiceControlStatus.set_air_powerdown(para);
+//}
+//点火控制
+void iv::control::Controller::control_obligate(char para){
+    ServiceControlStatus.set_obligate(para);
+}
+//车门控制
+void iv::control::Controller::control_door(char enable){
+    ServiceControlStatus.set_door(enable);
+}
+//车灯控制
+void iv::control::Controller::control_turnsignals(bool left, bool right){
+    ServiceControlStatus.set_turnsignals_control(left,right);
+}
+void iv::control::Controller::control_small_light(char para){
+    ServiceControlStatus.set_small_light(para);
+}
+void iv::control::Controller::control_near_light(char para){
+    ServiceControlStatus.set_near_light(para);
+}
+
+void iv::control::Controller::control_far_light(char para){
+    ServiceControlStatus.set_far_light(para);
+}
+void iv::control::Controller::control_frog_light(char para){
+    ServiceControlStatus.set_frog_light(para);
+}
+void iv::control::Controller::control_brake_light(char para){
+    ServiceControlStatus.set_brake_light(para);
+}
+void iv::control::Controller::control_defrog(char para){
+    ServiceControlStatus.set_defrog(para);
+}
+void iv::control::Controller::control_reverse_light(char para){
+    ServiceControlStatus.set_reverse_light(para);
+}
+
+//喇叭控制
+void iv::control::Controller::control_horn(char para){
+    ServiceControlStatus.set_horn(para);
+}
+//雨刷控制
+void iv::control::Controller::control_wiper(char para){
+    ServiceControlStatus.set_wiper(para);
+}
+
+
+void iv::control::Controller::control_air_temp(char para){
+    ServiceControlStatus.set_air_temp(para);
+}
+
+void iv::control::Controller::control_air_mode(char para){
+    ServiceControlStatus.set_air_mode(para);
+}
+
+void iv::control::Controller::control_air_enable(bool enable){
+    ServiceControlStatus.set_air_enable(enable);
+}
+
+void iv::control::Controller::control_wind_level(char para){
+    ServiceControlStatus.set_wind_level(para);
+}
+
+void iv::control::Controller::control_roof_light(char para){
+    ServiceControlStatus.set_roof_light(para);
+}
+
+void iv::control::Controller::control_home_light(char para){
+    ServiceControlStatus.set_home_light(para);
+}
+
+void iv::control::Controller::control_air_worktime(char para){
+    ServiceControlStatus.set_air_worktime(para);
+}
+
+void iv::control::Controller::control_air_offtime(char para){
+    ServiceControlStatus.set_air_offtime(para);
+}
+
+
+
+
+
+//void iv::control::Controller::control_flicker(bool enable){
+//    ServiceControlStatus.set_flicker(enable);
+//}
+//void iv::control::Controller::control_braking(float percent){
+
+//}

+ 83 - 0
src/controller/controller_UI_test/control/controller.h

@@ -0,0 +1,83 @@
+#pragma once
+/*
+*控制器
+*/
+#ifndef _IV_CONTROL_CONTROLLER_
+#define _IV_CONTROL_CONTROLLER_
+
+#include <boost.h>
+//#include <common/car_status.h>
+#include <control/control_status.h>
+
+namespace iv {
+    namespace control {
+        class Controller
+        {
+        public:
+            Controller();
+            ~Controller();
+            void inialize();// 初始化
+
+
+            void control_wheel(float angle);		//方向盘控制
+            void control_angle_speed(float angSpeed);
+            void control_angle_enable(bool enable);
+
+            void control_speed_limit(float speedLimit);
+            void control_torque(float percent);	//油门开度控制
+            void control_aeb(float aeb);	//油门开度控制
+            void control_brake(float brake);
+            void control_gear(float gear);
+            void control_handBrake(bool  enable);
+            void control_mode(char mode);
+            void control_gear_en(bool enable);
+            void control_aeb_en(bool enable);
+            void control_acc_en(bool enanble);
+
+
+            void control_win_lf(char para);
+            void control_win_rf(char para);
+            void control_win_lr(char para);
+            void control_win_rr(char para);
+            void control_air_on(bool enable);
+            void control_air_cricle(char para);
+            void control_air_auto(char para);
+            void control_air_off(char para);
+            void control_air_temup(char para);
+            void control_air_temdown(char para);
+            void control_air_powerup(char para);
+            void control_air_powerdown(char para);
+            void control_obligate(char para);
+            void control_door(char enable);
+            void control_turnsignals(bool left, bool right);
+            void control_small_light(char para);
+            void control_near_light(char para);
+            void control_horn(char para);
+            void control_far_light(char para);
+            void control_frog_light(char para);
+            void control_wiper(char para);
+            void control_brake_light(char para);
+            void control_defrog(char para);
+            void control_reverse_light(char para);
+            void cmd_checksum(unsigned char cmd_id);
+
+
+
+            void control_air_temp(char para);
+            void control_air_mode(char para);
+            void control_air_enable(bool enable);
+            void control_wind_level(char para);
+            void control_roof_light(char para);
+            void control_home_light(char para);
+            void control_air_worktime(char para);
+            void control_air_offtime(char para);
+
+            ///* 获取当前车辆状态*/
+            //void getCurrentCarStatus(iv::CarStatus & car_status);
+
+        private:
+        };
+    }
+}
+
+#endif // !_IV_CONTROL_CONTROLLER_

+ 190 - 0
src/controller/controller_UI_test/control/vv7.h

@@ -0,0 +1,190 @@
+#pragma once
+
+struct Command_Bit10
+{
+
+
+
+    unsigned char air_temp ;
+
+
+    unsigned char air_mode : 3;
+    unsigned char air_enable : 1;
+    unsigned char air_wind_level : 3;
+    unsigned char air_reserved : 1;
+
+
+
+
+    unsigned char ignition : 2;
+    unsigned char door : 2;
+    unsigned char Reserved :2;
+    unsigned char air_on : 2;
+
+
+
+    unsigned char turn_light : 2;
+
+    unsigned char small_light : 1;
+
+    unsigned char near_light : 1;
+
+    unsigned char horn : 1;
+
+    unsigned char far_light : 1;
+
+    unsigned char fog_light : 1;
+
+    unsigned char wiper : 1;
+
+
+
+    unsigned char brake_light : 1;
+
+    unsigned char defrog : 1;
+
+    unsigned char revers_light : 1;
+    unsigned char roof_light : 1;
+    unsigned char home_light : 1;
+
+    unsigned char Reserved0 :3;
+
+
+
+
+    unsigned char air_work_time;
+
+    unsigned char  air_off_time;
+
+    unsigned char  checkSum;
+
+
+
+
+};
+
+
+union Command10
+{
+    Command_Bit10 bit;
+
+    unsigned char byte[8];
+};
+
+
+struct Command_Bit11
+{
+    unsigned char speed_limit;
+
+    unsigned char  aeb_H;
+
+    unsigned char  aeb_L;
+
+    unsigned char torque;
+
+    unsigned char brake;
+
+
+    unsigned char gear:3;
+    unsigned char Reserved :1;
+    unsigned char park :2;
+    unsigned char Reserved0 :2;
+
+    unsigned char Reserved1 :2;
+    unsigned char Reserved2 :2;
+    unsigned char driveMode :1;
+    unsigned char gear_enable :1;
+    unsigned char aeb_enable :1;
+    unsigned char acc_enable :1;
+
+    unsigned char checkSum;
+
+
+};
+
+
+
+
+union Command11
+{
+    Command_Bit11 bit;
+
+    unsigned char byte[8];
+};
+
+
+struct Command_Bit12
+{
+    unsigned char ang_speed;
+
+    unsigned char  ang_H;
+
+    unsigned char  ang_L;
+
+    unsigned char reserved0;
+
+    unsigned char reserved1;
+
+    unsigned char reserved2;
+
+
+    unsigned char Reserved : 6;
+
+    unsigned char ang_enable : 1;
+
+    unsigned char Reserved0 : 1;
+
+
+
+
+    unsigned char checkSum;
+
+
+};
+
+
+
+
+union Command12
+{
+    Command_Bit12 bit;
+
+    unsigned char byte[8];
+};
+
+
+
+
+
+
+
+
+
+struct Command_Response_Bit
+{
+    unsigned char head;
+
+
+    unsigned char grade : 2;
+    unsigned char driveMode : 2;
+    unsigned char epb : 1;
+    unsigned char epsMode : 2;
+    unsigned char  obligate: 1;
+
+
+};
+
+union Command_Response
+{
+    Command_Response_Bit bit;
+
+    unsigned char byte[2];
+};
+
+
+
+
+
+
+
+

+ 79 - 0
src/controller/controller_UI_test/controller_UI_test.pro

@@ -0,0 +1,79 @@
+QT += core gui network xml dbus
+
+CONFIG += c++11 console
+CONFIG -= app_bundle
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+TARGET = controller_UI_test
+TEMPLATE = app
+
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which as been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += $$PWD/main.cpp \
+    ../../include/msgtype/cameraobject.pb.cc \
+    ../../include/msgtype/cameraobjectarray.pb.cc \
+    ../../include/msgtype/decition.pb.cc \
+    ../../include/msgtype/brainstate.pb.cc \
+    ../../include/msgtype/canmsg.pb.cc \
+    ../../include/msgtype/canraw.pb.cc \
+    ../../include/msgtype/chassis.pb.cc \
+    mainwindow.cpp \
+    common/car_status.cpp
+
+include($$PWD/control/control.pri)
+
+!include(../../../include/common.pri ) {
+    error( "Couldn't find the common.pri file!" )
+}
+
+!include(../../../include/ivprotobuf.pri ) {
+    error( "Couldn't find the ivprotobuf.pri file!" )
+}
+
+!include(../../../include/ivboost.pri ) {
+    error( "Couldn't find the ivboost.pri file!" )
+}
+
+!include(../controllercommon/controllercommon.pri ) {
+    error( "Couldn't find the controllercommon.pri.pri file!" )
+}
+
+INCLUDEPATH += $$PWD/../controllercommon
+
+
+DEFINES += TORQUEBRAKETEST
+
+#unix:!macx: LIBS += -L/home/yuchuli/qt/lib -lncomgnss -ladcmemshare
+
+unix:!macx: INCLUDEPATH += $$PWD/.
+unix:!macx: DEPENDPATH += $$PWD/.
+
+HEADERS += \
+    ../../include/msgtype/cameraobject.pb.h \
+    ../../include/msgtype/cameraobjectarray.pb.h \
+    ../../include/msgtype/decition.pb.h \
+    ../../include/msgtype/canmsg.pb.h \
+    ../../include/msgtype/canraw.pb.h \
+    ../../include/msgtype/chassis.pb.h \
+    mainwindow.h \
+    control/boost.h \
+    control/car_status.h \
+    common/boost.h \
+    common/car_status.h
+
+FORMS += \
+    mainwindow.ui
+
+

+ 310 - 0
src/controller/controller_UI_test/main.cpp

@@ -0,0 +1,310 @@
+#include <QCoreApplication>
+#include "mainwindow.h"
+#include <QApplication>
+#include <QTime>
+
+#include <QMutex>
+
+#include "control/control_status.h"
+#include "control/controller.h"
+
+#include "xmlparam.h"
+#include "modulecomm.h"
+#include "ivbacktrace.h"
+#include "ivversion.h"
+
+#include "canmsg.pb.h"
+#include "decition.pb.h"
+#include "chassis.pb.h"
+
+#include "torquebrake.h"
+
+#include <thread>
+
+#include <common/car_status.h>
+
+void * gpacansend;
+void * gpadecition;
+void * gpachassis;
+
+std::string gstrmemdecition;
+std::string gstrmemcansend;
+std::string gstrmemchassis;
+bool gbSendRun = true;
+
+bool gbChassisEPS = false;
+
+iv::brain::decition gdecition_def;
+iv::brain::decition gdecition;
+
+QTime gTime;
+int gnLastSendTime = 0;
+int gnLastRecvDecTime = -1000;
+int gnDecitionNum = 0; //when is zero,send default;
+const int gnDecitionNumMax = 100;
+int gnIndex = 0;
+
+boost::shared_ptr<iv::control::Controller> gcontroller;	//实际车辆控制器
+
+
+static QMutex gMutex;
+
+
+void executeDecition(const iv::brain::decition decition)
+{
+
+//    std::cout<<"acc is "<<decition.torque()<<" ang is "<<decition.wheelangle()<<std::endl;
+
+    gcontroller->control_acc_en(true);
+    gcontroller->control_angle_enable(true);
+    gcontroller->control_gear_en(true);
+    gcontroller->control_speed_limit(30);
+
+//    gcontroller->control_wheel(decition.wheelangle());
+    gcontroller->control_wheel(ServiceCarStatus.wheelangle);
+//    gcontroller->control_angle_speed(decition.wheelspeed());
+    gcontroller->control_angle_speed(10);//陈工没有处理
+//    gcontroller->control_torque(decition.torque());
+    gcontroller->control_torque(ServiceCarStatus.torque);
+
+//    gcontroller->control_brake(decition.brake());
+    gcontroller->control_brake(ServiceCarStatus.brake);
+    gcontroller->control_gear(decition.gear());
+//    gcontroller->control_gear(4);
+
+    gcontroller->control_handBrake(decition.handbrake());
+    gcontroller->control_mode(decition.mode());
+    //   gcontroller->control_mode(1);
+    gcontroller->control_near_light(decition.dippedlight());
+
+
+    gcontroller->control_air_enable(decition.air_enable());
+    gcontroller->control_air_on(decition.air_on());
+    gcontroller->control_air_temp(decition.air_temp());
+    gcontroller->control_air_mode(decition.air_mode());
+    gcontroller->control_wind_level(decition.wind_level());
+    gcontroller->control_roof_light(decition.roof_light());
+    gcontroller->control_home_light(decition.home_light());
+    gcontroller->control_air_worktime(decition.air_worktime());
+    gcontroller->control_air_offtime(decition.air_offtime());
+    gcontroller->control_turnsignals(decition.leftlamp(),decition.rightlamp());
+    gcontroller->control_door(decition.door());
+
+#ifdef TORQUEBRAKETEST
+    if(gnothavetb < 10)
+    {
+        iv::controller::torquebrake xtb;
+        gMutextb.lock();
+        xtb.CopyFrom(gtb);
+        gMutextb.unlock();
+        if(xtb.enable())
+        {
+            gcontroller->control_torque(xtb.torque());
+            gcontroller->control_brake(xtb.brake());
+            qDebug("use tb value torque is %f brake is %f",xtb.torque(),xtb.brake());
+        }
+        else
+        {
+//            qDebug("torquebrake not enable.");
+        }
+        gnothavetb++;
+    }
+
+#endif
+
+    gcontroller->cmd_checksum(0x10);
+    gcontroller->cmd_checksum(0x11);
+    gcontroller->cmd_checksum(0x12);
+
+    //    qDebug("dangwei is %d mode is %d",decition.gear(),decition.mode());
+}
+
+void UpdateChassis(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
+{
+    iv::chassis xchassis;
+    static int ncount = 0;
+    if(!xchassis.ParseFromArray(strdata,nSize))
+    {
+        std::cout<<"iv::decition::BrainDecition::UpdateChassis ParseFrom Array Error."<<std::endl;
+        return;
+    }
+
+    if(xchassis.epsmode() == 0)
+    {
+        gbChassisEPS = true;
+    }
+
+
+}
+
+
+void ListenDeciton(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
+{
+    qint64 oldtime;
+    iv::brain::decition xdecition;
+
+    if(!xdecition.ParseFromArray(strdata,nSize))
+    {
+        std::cout<<"ListenDecition parse error."<<std::endl;
+        return;
+    }
+
+    if(xdecition.gear() != 4)
+    {
+//        qDebug("not D");
+    }
+    if((oldtime - QDateTime::currentMSecsSinceEpoch())<-100)qDebug("dection time is %ld diff is %ld ",QDateTime::currentMSecsSinceEpoch(),oldtime - QDateTime::currentMSecsSinceEpoch());
+    oldtime = QDateTime::currentMSecsSinceEpoch();
+    gMutex.lock();
+    gdecition.CopyFrom(xdecition);
+    gMutex.unlock();
+    gnDecitionNum = gnDecitionNumMax;
+    gbChassisEPS = false;
+
+}
+
+void ExecSend()
+{
+    iv::can::canmsg xmsg;
+    iv::can::canraw xraw;
+    unsigned char * strp = (unsigned char *)&(ServiceControlStatus.command10.byte[0]);
+    //    qDebug("%02x %02x %02x %02x %02x %02x %02x %02x",strp[0]
+    //            ,strp[1],strp[2],strp[3],strp[4],strp[5],strp[6],strp[7]);
+    xraw.set_id(ServiceControlStatus.command_ID10);
+    xraw.set_data(ServiceControlStatus.command10.byte,8);
+    xraw.set_bext(false);
+    xraw.set_bremote(false);
+    xraw.set_len(8);
+    iv::can::canraw * pxraw = xmsg.add_rawmsg();
+    pxraw->CopyFrom(xraw);
+    xmsg.set_channel(0);
+    xmsg.set_index(gnIndex);
+
+    xraw.set_id(ServiceControlStatus.command_ID11);
+    xraw.set_data(ServiceControlStatus.command11.byte,8);
+    int a = ServiceControlStatus.command11.byte[5]&0x0f;
+    if(a != 0x04)
+    {
+//        qDebug("not D.");
+    }
+    xraw.set_bext(false);
+    xraw.set_bremote(false);
+    xraw.set_len(8);
+    iv::can::canraw * pxraw1 = xmsg.add_rawmsg();
+    pxraw1->CopyFrom(xraw);
+    xmsg.set_channel(0);
+    xmsg.set_index(gnIndex);
+
+    xraw.set_id(ServiceControlStatus.command_ID12);
+    xraw.set_data(ServiceControlStatus.command12.byte,8);
+    xraw.set_bext(false);
+    xraw.set_bremote(false);
+    xraw.set_len(8);
+    iv::can::canraw * pxraw2 = xmsg.add_rawmsg();
+    pxraw2->CopyFrom(xraw);
+    xmsg.set_channel(0);
+    xmsg.set_index(gnIndex);
+
+    gnIndex++;
+    xmsg.set_mstime(QDateTime::currentMSecsSinceEpoch());
+    int ndatasize = xmsg.ByteSize();
+    char * strser = new char[ndatasize];
+    std::shared_ptr<char> pstrser;
+    pstrser.reset(strser);
+    if(xmsg.SerializeToArray(strser,ndatasize))
+    {
+        iv::modulecomm::ModuleSendMsg(gpacansend,strser,ndatasize);
+    }
+    else
+    {
+        std::cout<<"MainWindow::onTimer serialize error."<<std::endl;
+    }
+}
+
+void initial()
+{
+    //    ServiceControlStatus.command.byte[0] = 0;
+    //    ServiceControlStatus.command.byte[1] = 0;
+    //    ServiceControlStatus.command.byte[2] = 0;
+    //    ServiceControlStatus.command.byte[3] = 0;
+    //    ServiceControlStatus.command.byte[4] = 0;
+    //    ServiceControlStatus.command.byte[5] = 0;
+    //    ServiceControlStatus.command.byte[6] = 0;
+    //    ServiceControlStatus.command.byte[7] = 0;
+}
+
+void sendthread()
+{
+    initial();
+    iv::brain::decition xdecition;
+    while(gbSendRun)
+    {
+        if(gnDecitionNum <= 0)
+        {
+            xdecition.CopyFrom(gdecition_def);
+        }
+        else
+        {
+            gMutex.lock();
+            xdecition.CopyFrom(gdecition);
+            gMutex.unlock();
+            gnDecitionNum--;
+        }
+        executeDecition(xdecition);
+        if(gbChassisEPS == false) ExecSend();
+        std::this_thread::sleep_for(std::chrono::milliseconds(10));
+    }
+}
+
+int main(int argc, char *argv[])
+{
+//    RegisterIVBackTrace();
+    showversion("controller_UI_test");
+//    QCoreApplication a(argc, argv);
+    QApplication a(argc, argv);
+
+    QString strpath = QCoreApplication::applicationDirPath();
+
+    if(argc < 2)
+        strpath = strpath + "/controller_vv7.xml";
+    else
+        strpath = argv[1];
+    std::cout<<strpath.toStdString()<<std::endl;
+
+    gdecition_def.set_accelerator(-0.5);
+    //    gdecition_def.set_brake(1.0);
+    gdecition_def.set_brake(20);   //apollo_fu 20200417
+    gdecition_def.set_torque(0);
+    // gdecition_def.set_rightlamp(true);
+    //  gdecition_def.set_doublespark(true);
+    gdecition_def.set_wheelangle(0);
+    gdecition_def.set_mode(1);
+    gdecition_def.set_grade(1);
+    gdecition_def.set_gear(1);
+    gdecition_def.set_engine(0);
+    //    gdecition_def.set_gear(0);
+    gTime.start();
+
+    gcontroller = boost::shared_ptr<iv::control::Controller>(new iv::control::Controller());
+
+    iv::xmlparam::Xmlparam xp(strpath.toStdString());
+
+    gstrmemcansend = xp.GetParam("cansend","cansend0");
+    gstrmemdecition = xp.GetParam("dection","deciton");
+    gstrmemchassis = xp.GetParam("chassismsgname","chassis");
+
+    gpacansend = iv::modulecomm::RegisterSend(gstrmemcansend.data(),10000,1);
+    gpadecition = iv::modulecomm::RegisterRecv(gstrmemdecition.data(),ListenDeciton);
+    gpachassis = iv::modulecomm::RegisterRecv(gstrmemchassis.data(),UpdateChassis);
+
+#ifdef TORQUEBRAKETEST
+    EnableTorqueBrakeTest();
+#endif
+
+    std::thread xthread(sendthread);
+
+    MainWindow w;
+    w.show();
+
+    return a.exec();
+}

+ 33 - 0
src/controller/controller_UI_test/mainwindow.cpp

@@ -0,0 +1,33 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+    ui->lineEdit->setValidator(new QIntValidator(ui->lineEdit));
+    ui->lineEdit_2->setValidator(new QIntValidator(ui->lineEdit_2));
+    ui->lineEdit_3->setValidator(new QIntValidator(ui->lineEdit_3));
+
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}
+
+void MainWindow::on_pushButton_clicked()
+{
+    ServiceCarStatus.wheelangle = ui->lineEdit->text().toInt();
+}
+
+void MainWindow::on_pushButton_2_clicked()
+{
+    ServiceCarStatus.torque = ui->lineEdit_2->text().toInt();
+}
+
+void MainWindow::on_pushButton_3_clicked()
+{
+    ServiceCarStatus.brake = ui->lineEdit_3->text().toInt();
+}

+ 30 - 0
src/controller/controller_UI_test/mainwindow.h

@@ -0,0 +1,30 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include <common/car_status.h>
+
+namespace Ui {
+class MainWindow;
+}
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    explicit MainWindow(QWidget *parent = 0);
+    ~MainWindow();
+
+private slots:
+    void on_pushButton_clicked();
+
+    void on_pushButton_2_clicked();
+
+    void on_pushButton_3_clicked();
+
+private:
+    Ui::MainWindow *ui;
+};
+
+#endif // MAINWINDOW_H

+ 140 - 0
src/controller/controller_UI_test/mainwindow.ui

@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>600</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QPushButton" name="pushButton">
+    <property name="geometry">
+     <rect>
+      <x>250</x>
+      <y>70</y>
+      <width>89</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>OK</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label">
+    <property name="geometry">
+     <rect>
+      <x>40</x>
+      <y>70</y>
+      <width>67</width>
+      <height>17</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>目标角度</string>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="lineEdit">
+    <property name="geometry">
+     <rect>
+      <x>120</x>
+      <y>70</y>
+      <width>113</width>
+      <height>25</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_2">
+    <property name="geometry">
+     <rect>
+      <x>40</x>
+      <y>150</y>
+      <width>67</width>
+      <height>17</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>目标车速</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_2">
+    <property name="geometry">
+     <rect>
+      <x>250</x>
+      <y>140</y>
+      <width>89</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>OK</string>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="lineEdit_2">
+    <property name="geometry">
+     <rect>
+      <x>120</x>
+      <y>140</y>
+      <width>113</width>
+      <height>25</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="lineEdit_3">
+    <property name="geometry">
+     <rect>
+      <x>120</x>
+      <y>230</y>
+      <width>113</width>
+      <height>25</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pushButton_3">
+    <property name="geometry">
+     <rect>
+      <x>250</x>
+      <y>230</y>
+      <width>89</width>
+      <height>25</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>OK</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_3">
+    <property name="geometry">
+     <rect>
+      <x>40</x>
+      <y>230</y>
+      <width>67</width>
+      <height>17</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>目标制动</string>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>800</width>
+     <height>28</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>