|  | @@ -1,9 +1,8 @@
 | 
	
		
			
				|  |  |  #include "can_bus.h"
 | 
	
		
			
				|  |  |  #include <thread>
 | 
	
		
			
				|  |  |  #include "message_queue.h"
 | 
	
		
			
				|  |  | -#include <math.h>
 | 
	
		
			
				|  |  | -#include <chrono>
 | 
	
		
			
				|  |  | -#include <algorithm>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  #define	GET_BIT(x, bit)	((x & (1 << bit)) >> bit)
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -226,89 +225,114 @@ void CCanBusSensor::order(cannet_frame* frame){
 | 
	
		
			
				|  |  |          Sendframe[0].can_id = 0x421;
 | 
	
		
			
				|  |  |          Sendframe[0].can_dlc = carframe.dlc;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        // memcpy(Sendframe[0].data,order_on,carframe.dlc);
 | 
	
		
			
				|  |  | -        std::copy(order_on,order_on+8,Sendframe[0].data);
 | 
	
		
			
				|  |  | +        memcpy(Sendframe[0].data,order_on,carframe.dlc);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +bool CCanBusSensor::car_stop(cannet_frame* frame){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        cannet_frame& carframe = frame[0];                
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        switch (carframe.data[2])
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            case 0x00:
 | 
	
		
			
				|  |  | +                *id_111 = *car_stop;
 | 
	
		
			
				|  |  | +                stop_flag = true;
 | 
	
		
			
				|  |  | +                // std::cout<<"car stop!"<<std::endl;
 | 
	
		
			
				|  |  | +            break;
 | 
	
		
			
				|  |  | +   
 | 
	
		
			
				|  |  | +            default:
 | 
	
		
			
				|  |  | +                stop_flag = false;
 | 
	
		
			
				|  |  | +                // std::cout<<"car ends stop..."<<std::endl;
 | 
	
		
			
				|  |  | +            break;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        // memset(Sendframe[0].data, 0, sizeof(Sendframe[0].data));
 | 
	
		
			
				|  |  | +    return stop_flag;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  void CCanBusSensor::toggleLamp(cannet_frame* frame){
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          cannet_frame& carframe = frame[0];             
 | 
	
		
			
				|  |  | -        Sendframe[1].can_id = 0x121;
 | 
	
		
			
				|  |  | -        Sendframe[1].can_dlc = carframe.dlc;
 | 
	
		
			
				|  |  | +        Sendframe[2].can_id = 0x121;
 | 
	
		
			
				|  |  | +        Sendframe[2].can_dlc = carframe.dlc;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          switch (carframe.data[0])
 | 
	
		
			
				|  |  |                  {
 | 
	
		
			
				|  |  |                      case 0x00:
 | 
	
		
			
				|  |  | -                        // memcpy(Sendframe[0].data,headlamp_off,carframe.dlc); //前后车灯关
 | 
	
		
			
				|  |  | -                        std::copy(headlamp_off,headlamp_off+8,Sendframe[1].data);
 | 
	
		
			
				|  |  | -                        std::cout<<"前车灯关,后车灯关 "<<std::endl;
 | 
	
		
			
				|  |  | +                        memcpy(Sendframe[2].data,headlamp_off,carframe.dlc); //前后车灯关
 | 
	
		
			
				|  |  | +                        // std::cout<<"前车灯关,后车灯关 "<<std::endl;
 | 
	
		
			
				|  |  |                      break;
 | 
	
		
			
				|  |  |                  
 | 
	
		
			
				|  |  |                      case 0x10:
 | 
	
		
			
				|  |  | -                        // memcpy(Sendframe[0].data,headlamp_on,carframe.dlc); //前车灯开
 | 
	
		
			
				|  |  | -                        std::copy(headlamp_on,headlamp_on+8,Sendframe[1].data);
 | 
	
		
			
				|  |  | -                        std::cout<<"前车灯开,后车灯关 "<<std::endl;
 | 
	
		
			
				|  |  | +                        memcpy(Sendframe[2].data,headlamp_on,carframe.dlc); //前车灯开
 | 
	
		
			
				|  |  | +                        // std::cout<<"前车灯开,后车灯关 "<<std::endl;
 | 
	
		
			
				|  |  |                      break;
 | 
	
		
			
				|  |  |                      
 | 
	
		
			
				|  |  |                      case 0x08:
 | 
	
		
			
				|  |  | -                        // memcpy(Sendframe[0].data,taillamp_on,carframe.dlc); //后车灯开
 | 
	
		
			
				|  |  | -                        std::copy(taillamp_on,taillamp_on+8,Sendframe[1].data);
 | 
	
		
			
				|  |  | -                        std::cout<<"前车灯关,后车灯开 "<<std::endl;
 | 
	
		
			
				|  |  | +                        memcpy(Sendframe[2].data,taillamp_on,carframe.dlc); //后车灯开
 | 
	
		
			
				|  |  | +                        // std::cout<<"前车灯关,后车灯开 "<<std::endl;
 | 
	
		
			
				|  |  |                      break;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -void CCanBusSensor::car_stop(cannet_frame* frame){
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        cannet_frame& carframe = frame[0];                
 | 
	
		
			
				|  |  | -        bool stop_flag = false;
 | 
	
		
			
				|  |  | +int CCanBusSensor::gearselection(cannet_frame* frame){
 | 
	
		
			
				|  |  | +    
 | 
	
		
			
				|  |  | +    cannet_frame& carframe = frame[0];
 | 
	
		
			
				|  |  | +    switch (carframe.data[5])
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        case 0x10:
 | 
	
		
			
				|  |  | +            return 1;
 | 
	
		
			
				|  |  | +        break;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        switch (carframe.data[2])
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            case 0x00:
 | 
	
		
			
				|  |  | -                Sendframe[2].can_id = 0x111;
 | 
	
		
			
				|  |  | -                Sendframe[2].can_dlc = carframe.dlc;
 | 
	
		
			
				|  |  | -                stop_flag = true;
 | 
	
		
			
				|  |  | -                while(stop_flag){
 | 
	
		
			
				|  |  | -                    memcpy(Sendframe[2].data,stop_on,carframe.dlc); //急停
 | 
	
		
			
				|  |  | -                    std::cout<<"car stop!"<<std::endl;
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            break;
 | 
	
		
			
				|  |  | -   
 | 
	
		
			
				|  |  | -            case 0xFF:
 | 
	
		
			
				|  |  | -                stop_flag = false;
 | 
	
		
			
				|  |  | -                std::cout<<"car end stop..."<<std::endl;
 | 
	
		
			
				|  |  | -            break;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +        case 0x00:
 | 
	
		
			
				|  |  | +            return 2;
 | 
	
		
			
				|  |  | +        break;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        case 0x40:
 | 
	
		
			
				|  |  | +            return 3;
 | 
	
		
			
				|  |  | +        break;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +void CCanBusSensor::gear_act(int gear){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    switch (gear)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        case 1:
 | 
	
		
			
				|  |  | +            id_633[0] = 
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  void CCanBusSensor::move_run(cannet_frame* frame){
 | 
	
		
			
				|  |  |      
 | 
	
		
			
				|  |  |          cannet_frame& carframe = frame[0];     
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  | -        // Sendframe[3].can_dlc = carframe.dlc;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        if (static_cast<unsigned char>(carframe.data[4]) > 0x02 && 
 | 
	
		
			
				|  |  | -    static_cast<unsigned char>(carframe.data[4]) <= 0x7F)
 | 
	
		
			
				|  |  | -        // if(carframe.data[4]>0x02 && carframe.data[4]<=0x7F)
 | 
	
		
			
				|  |  | +        switch (gearselection)
 | 
	
		
			
				|  |  | +        if(carframe.data[4]>0x02 && carframe.data[4]<=0x7F)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            Sendframe[3].can_id = 0x111;
 | 
	
		
			
				|  |  | -            std::copy(move_forward,move_forward+8,Sendframe[3].data); //油门前进
 | 
	
		
			
				|  |  | +           
 | 
	
		
			
				|  |  | +            // std::copy(move_forward,move_forward+8,Sendframe[6].data); //油门前进
 | 
	
		
			
				|  |  | +            // memcpy(Sendframe[3].data,move_forward,carframe.dlc);
 | 
	
		
			
				|  |  | +            id_111[0] = 0x00;
 | 
	
		
			
				|  |  | +            id_111[1] = 0x96;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              run_flag = true;
 | 
	
		
			
				|  |  |              std::cout<<"油门前进"<<std::endl;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        else 
 | 
	
		
			
				|  |  | -        // if(carframe.data[5]>0x02 && carframe.data[5]<=0x7F)
 | 
	
		
			
				|  |  | -        if (static_cast<unsigned char>(carframe.data[5]) > 0x02 && 
 | 
	
		
			
				|  |  | -    static_cast<unsigned char>(carframe.data[5]) <= 0x7F)
 | 
	
		
			
				|  |  | +        else  if(carframe.data[5]>0x02 && carframe.data[5]<=0x7F)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            Sendframe[4].can_id = 0x111;
 | 
	
		
			
				|  |  | -            std::copy(move_backward,move_backward+8,Sendframe[4].data); //刹车后退
 | 
	
		
			
				|  |  | +            // std::copy(move_backward,move_backward+8,Sendframe[2].data); //刹车后退
 | 
	
		
			
				|  |  | +            // std::copy(stop_on,stop_on+8,Sendframe[2].data); //刹车停止
 | 
	
		
			
				|  |  | +            // memcpy(Sendframe[3].data,stop_on,carframe.dlc);
 | 
	
		
			
				|  |  | +            id_111[0] = 0x00;
 | 
	
		
			
				|  |  | +            id_111[1] = 0x00;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              run_flag = true;
 | 
	
		
			
				|  |  |              std::cout<<"刹车后退"<<std::endl;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        // else  memcpy(Sendframe[2].data,stop_on,carframe.dlc);
 | 
	
		
			
				|  |  | +        else  { id_111[0] = 0x00;   id_111[1] = 0x00; }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -316,13 +340,34 @@ void CCanBusSensor::move_rot(cannet_frame* frame){
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          cannet_frame& carframe = frame[0];     
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        Sendframe[5].can_id = 0x111;
 | 
	
		
			
				|  |  | -        Sendframe[5].can_dlc = carframe.dlc;
 | 
	
		
			
				|  |  | +        switch(carframe.data[0])
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            case 0x01:
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  | +                id_111[2] = 0x00;
 | 
	
		
			
				|  |  | +                id_111[3] = 0x00;
 | 
	
		
			
				|  |  | +               
 | 
	
		
			
				|  |  | +                // cout<<"No rotation"<<endl;
 | 
	
		
			
				|  |  | +            break;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            case 0x04:
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                id_111[2] = 0x00;
 | 
	
		
			
				|  |  | +                id_111[3] = 0xc8;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                rot_flag = true;
 | 
	
		
			
				|  |  | +                // cout<<"turn left"<<endl;
 | 
	
		
			
				|  |  | +            break;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            case 0x10:
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                id_111[2] = 0xFF;
 | 
	
		
			
				|  |  | +                id_111[3] = 0x38;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                rot_flag = true;
 | 
	
		
			
				|  |  | +                // cout<<"turn right"<<endl;
 | 
	
		
			
				|  |  | +            break;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if(carframe.data[0] != 0x01){
 | 
	
		
			
				|  |  | -            memcpy(Sendframe[5].data,move_rotation,carframe.dlc); //转弯
 | 
	
		
			
				|  |  | -            rot_flag = true;
 | 
	
		
			
				|  |  | -            cout<<"转弯"<<endl;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  }
 | 
	
	
		
			
				|  | @@ -330,115 +375,64 @@ void CCanBusSensor::move_rot(cannet_frame* frame){
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /*------------------小车控制止-------------------*/
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +/* ****Sendframe[3]和Sendframe[4]不能用***** */
 | 
	
		
			
				|  |  | +/* ****不需要order_on,就能直接用指令控制***** */
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  void CCanBusSensor::OnMessage(cannet_frame* frames, int32_t count)  //下发控制指令
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    for (int32_t i = 0; i < count; i++) //count=4
 | 
	
		
			
				|  |  | +    for (int32_t i = count; i > 0; i--) //count=4
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          cannet_frame& frame = frames[i];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          int32_t canid = frame.canid;
 | 
	
		
			
				|  |  |          
 | 
	
		
			
				|  |  |          //std::cout << std::hex << canid << std::endl;
 | 
	
		
			
				|  |  | -                
 | 
	
		
			
				|  |  | +        CCanBusSensor::order(&frame);
 | 
	
		
			
				|  |  |          switch (canid)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              case 0x181:
 | 
	
		
			
				|  |  | -                // memcpy(Sendframe[0].data, frame.data, frame.dlc);
 | 
	
		
			
				|  |  | -                // Hand_Throttle = make_int16(frame.data[1],frame.data[0]);
 | 
	
		
			
				|  |  | -                // Foot_Throttle = make_int16(frame.data[3],frame.data[2]);
 | 
	
		
			
				|  |  | -                // Brake = make_int16(frame.data[5],frame.data[4]);
 | 
	
		
			
				|  |  | -                // cout<<"receive 181: "<<Hand_Throttle<<" "<<Foot_Throttle<<" "<<Brake<<endl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +                // Sendframe[1].can_id = 0x121;
 | 
	
		
			
				|  |  | +                // Sendframe[1].can_dlc = frame.dlc;
 | 
	
		
			
				|  |  | +                // cout<<"receive 181: "<<endl;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                // memcpy(Sendframe[1].data,headlamp_on,frame.dlc); //前后车灯关
 | 
	
		
			
				|  |  | +                // cout<<"前后车灯关"<<endl;
 | 
	
		
			
				|  |  | +                // memcpy(Sendframe[2].data,move_forward,frame.dlc); //前进
 | 
	
		
			
				|  |  |                 
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  |                  CCanBusSensor::toggleLamp(&frame);
 | 
	
		
			
				|  |  | -                CCanBusSensor::order(&frame);      // 启用order会导致几秒的延迟响应
 | 
	
		
			
				|  |  | -                // CCanBusSensor::move_run(&frame);     //move_run和car
 | 
	
		
			
				|  |  | -                CCanBusSensor::car_stop(&frame);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +                if(!CCanBusSensor::car_stop(&frame))
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    // cout<<"car ends stopping!"<<endl;    
 | 
	
		
			
				|  |  | +                    CCanBusSensor::move_run(&frame);     //move_run和car
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  |              break;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              case 0x0CFDD633:  // receive from frame[3]
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                CCanBusSensor::order(&frame);  
 | 
	
		
			
				|  |  | -                CCanBusSensor::move_rot(&frame);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            break;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            case 0x182:
 | 
	
		
			
				|  |  | -                Sendframe[1].can_id = 0x182;
 | 
	
		
			
				|  |  | -                Sendframe[1].can_dlc = frame.dlc;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                memcpy(Sendframe[1].data, frame.data, frame.dlc);
 | 
	
		
			
				|  |  | -                //std::cout << "182" << std::endl;
 | 
	
		
			
				|  |  | -            break;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            case 0x183:
 | 
	
		
			
				|  |  | -                Sendframe[2].can_id = 0x183;
 | 
	
		
			
				|  |  | -                Sendframe[2].can_dlc = frame.dlc;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                Direction = make_int16(frame.data[3],frame.data[2]);
 | 
	
		
			
				|  |  | -                _message->SendVehicleStatus(Direction,Hand_Throttle,Foot_Throttle,Brake);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                memcpy(Sendframe[2].data, frame.data, frame.dlc);
 | 
	
		
			
				|  |  | -                //std::cout << "revice 183" << std::endl;
 | 
	
		
			
				|  |  | -            break;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            case 0x184:
 | 
	
		
			
				|  |  |              
 | 
	
		
			
				|  |  | -                Sendframe[3].can_id = 0x184;
 | 
	
		
			
				|  |  | -                Sendframe[3].can_dlc = frame.dlc;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                //模式
 | 
	
		
			
				|  |  | -                
 | 
	
		
			
				|  |  | -                model = (frame.data[3] & 0x04) == 0x04 ? 1 : 0;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                //切换前后摄像头
 | 
	
		
			
				|  |  | -                _front_view = (frame.data[4] & 0x04) == 0x04 ?  false: true;
 | 
	
		
			
				|  |  | -                _message->SwitchCamera(_front_view);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                //b_ready = (_msg[3].DATA[4] & 0x10) == 0x10 ? 1 : 0;
 | 
	
		
			
				|  |  | -                if((frame.data[4] & 0x10) == 0x10 ? 1 : 0)//已就绪 抓钢机就绪状态,待无人车入场
 | 
	
		
			
				|  |  | +                if(!CCanBusSensor::car_stop(&frame))
 | 
	
		
			
				|  |  |                  {
 | 
	
		
			
				|  |  | -                  _message->SendZGJStatus(1);
 | 
	
		
			
				|  |  | -                  std::cout << "SendZGJStatus" << std::endl;
 | 
	
		
			
				|  |  | -                  //_msg[3].DATA[4] &= 0xEF;
 | 
	
		
			
				|  |  | +                    // cout<<"car ends stopping!"<<endl;  
 | 
	
		
			
				|  |  | +                    int gear = CCanBusSensor::gearselection(&frame);
 | 
	
		
			
				|  |  | +                    CCanBusSensor::gear_act(gear);
 | 
	
		
			
				|  |  | +                    CCanBusSensor::move_rot(&frame);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                //b_over = (_msg[3].DATA[4] & 0x20) == 0x20 ? 1 : 0;
 | 
	
		
			
				|  |  | -                if((frame.data[4] & 0x20) == 0x20 ? 1 : 0)//已完成 抓钢机抓钢结束,待无人车离场
 | 
	
		
			
				|  |  | -                {
 | 
	
		
			
				|  |  | -                  _message->SendZGJStatus(2);
 | 
	
		
			
				|  |  | -                  //_msg[3].DATA[4] &= 0xD7;
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | +            break;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                if(!_message->btimeStopedCar)
 | 
	
		
			
				|  |  | -                {
 | 
	
		
			
				|  |  | -                    memcpy(Sendframe[3].data, frame.data, frame.dlc);  
 | 
	
		
			
				|  |  | -                } 
 | 
	
		
			
				|  |  | -                else
 | 
	
		
			
				|  |  | -                {
 | 
	
		
			
				|  |  | -                    long long tick=std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
 | 
	
		
			
				|  |  | -                    /*
 | 
	
		
			
				|  |  | -                    if(tick-_message->_curStopTick > 500) 
 | 
	
		
			
				|  |  | -                    {
 | 
	
		
			
				|  |  | -                        Emergency();
 | 
	
		
			
				|  |  | -                        _message->btimeStopedCar = false;
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                    */
 | 
	
		
			
				|  |  | -                    if(tick-_message->_curStopTick < 500) 
 | 
	
		
			
				|  |  | -                        Emergency();
 | 
	
		
			
				|  |  | -                    else
 | 
	
		
			
				|  |  | -                        _message->btimeStopedCar = false;
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                //_message->_dst  = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
 | 
	
		
			
				|  |  | -                //    printf("data delay:%ld\r\n",_message->_dst - _message->_source);
 | 
	
		
			
				|  |  | -                //std::cout << "revice 184" << std::endl;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            default:
 | 
	
		
			
				|  |  |              break;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      } 
 | 
	
		
			
				|  |  | +    Sendframe[3].can_id = 0x111;
 | 
	
		
			
				|  |  | +    Sendframe[3].can_dlc = frame.dlc;
 | 
	
		
			
				|  |  | +    memcpy(Sendframe[3].data,id_111,frame.dlc);
 | 
	
		
			
				|  |  | +    cout<<"id_111: "<<static_cast<int>(id_111[0])<<static_cast<int>(id_111[1])<<static_cast<int>(id_111[2])<<static_cast<int>(id_111[3])<<endl;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  void CCanBusSensor::SendStatusToMSG()
 |