car_status.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. #pragma once
  2. #ifndef _IV_COMMON_CAR_STATUS_
  3. #define _IV_COMMON_CAR_STATUS_
  4. #include <common/boost.h>
  5. #include <boost/serialization/singleton.hpp>
  6. #include <gps_type.h>
  7. #include <obstacle_type.h>
  8. #include <time.h>
  9. #include <common/mobileye.h>
  10. #include <QTime>
  11. ///kkcai, 2020-01-03
  12. #include <QMutex>
  13. ///////////////////////////////////////
  14. #include "platform/platform.h"
  15. #include "ultrasonic_type.h"
  16. //#include "common/decitionview.pb.h"
  17. #include "common/sysparam_type.h"
  18. #include "common/roadmode_type.h"
  19. #define RADAR_OBJ_NUM 64
  20. #ifdef linux
  21. unsigned long GetTickCount();
  22. #endif
  23. namespace iv {
  24. class CarStatus : public boost::noncopyable {
  25. public:
  26. CarStatus();
  27. ~CarStatus();
  28. float speed; //车速
  29. double mfCalAcc = 0;
  30. std::int16_t wheel_angle; //方向盘转角
  31. std::uint8_t braking_pressure; //刹车压力
  32. float torque_st=0;
  33. bool mbRunPause = false;
  34. bool mbBrainCtring = false;
  35. bool status[6] = { true, false, false, false, true, false }; //bool arrive = false; // x4:是否到达站点(0:未到 1:到达)
  36. //bool people = false; // x3:车上是否有人(0:无人 1:有人)
  37. //bool stop = false; // x2:是否停车(0:否 1:是)
  38. //bool call = false; // x1:是否叫车(0:否 1:是)
  39. //bool available = true; // 是否可被叫车
  40. //bool fire = false;
  41. // int carState = 0; // 0:停车 1:正常循迹 2:前往站点
  42. int carState = 0; // 0:停车 1:正常循迹 2:前往站点
  43. int emergencyStop=0;
  44. int station_control_door=0;//0: door close 1:door open
  45. bool station_control_door_option=false;
  46. int istostation = 0;
  47. //int ctostation = 0;
  48. int currentstation = 0;
  49. //int nextstation = 0;
  50. int clientto = 0;
  51. double amilng = 0.0;
  52. double amilat = 0.0;
  53. bool busmode = false;
  54. bool netconnect = false;
  55. bool doorsta=false;
  56. unsigned char speedlimte;
  57. int grade=0;
  58. int driverMode=0;
  59. int epb=0;
  60. int epsMode=1;
  61. float engine_speed=0;
  62. bool receiveEps=false;
  63. bool speed_control=true;
  64. bool group_control =false;
  65. int group_server_status=0;
  66. int group_state = 0;
  67. float group_x_local = 0.0;
  68. float group_y_local = 0.0;
  69. float group_velx_local = 0.0;
  70. float group_vely_local = 0.0;
  71. float group_comm_speed = 0.0;
  72. int group_pathpoint=0;
  73. float group_offsetx=0.0;
  74. float group_frontDistance=0.0;
  75. float mfttc = 0;
  76. std::vector <iv::platform::station> car_stations;
  77. AWS_display aws_display;
  78. lane Lane;
  79. obstacle_status obstacleStatus;
  80. obstacle_data_a obstacleStatusA[15];
  81. obstacle_data_b obstacleStatusB[15];
  82. obstacle_data_c obstacleStatusC[15];
  83. aftermarket_lane aftermarketLane;
  84. lka_left_lane_a LKAleftLaneA;
  85. lka_left_lane_b LKAleftLaneB;
  86. lka_right_lane_a LKArightLaneA;
  87. lka_right_lane_b LKArightLaneB;
  88. next_lane_a nextLaneA_left[4], nextLaneA_right[4];
  89. next_lane_b nextLaneB_left[4], nextLaneB_right[4];
  90. ref_points refPoints;
  91. num_of_next_lane_mark_reported numOfNextLaneMarkReported;
  92. double mfAcc = 0;
  93. double mfVehAcc=0;
  94. double mfWheel = 0;
  95. double mfBrake = 0;
  96. double steerAngle=0;
  97. QTime mRunTime;
  98. int mRadarS = -1;
  99. int mLidarS = -1;
  100. int mRTKStatus = 0;
  101. int mLidarPer = -1;
  102. double mLidarObs;
  103. double mRadarObs;
  104. double mObs;
  105. GPS_INS aim_gps_ins;
  106. bool bocheMode=false;
  107. int bocheEnable=0;
  108. double mfParkLat;
  109. double mfParkLng;
  110. double mfParkHeading;
  111. int mnParkType;
  112. double mLidarRotation;
  113. double mLidarRangeUnit;
  114. iv::GPSData location; //当前车辆位置
  115. boost::array<iv::ObstacleBasic, 64> obs_radar;//毫米波雷达的障碍物数据
  116. boost::array<iv::ObstacleBasic, 64> obs_rear_radar;//houxiang毫米波雷达的障碍物数据
  117. iv::ultrasonic_obs multrasonic_obs;
  118. std::vector<iv::TracePoint> obsTraceLeft,obsTraceRight;
  119. double mfGPSAcc = 0;
  120. // iv::brain::decitionview mdecitionview;
  121. iv::sysparam msysparam;
  122. iv::roadmode_vel mroadmode_vel;
  123. int vehGroupId;
  124. double mfEPSOff = 0.0;
  125. float socfDis=15; //停障触发距离
  126. float aocfDis=25; //避障触发距离
  127. float aocfTimes=5; //避障触发次数
  128. float aobzDis=5; //避障保障距离
  129. /// traffice light : 0x90
  130. int iTrafficeLightID = 0; //红绿灯ID
  131. int iTrafficeLightColor = 2; //0x0: 红色
  132. //0x1: 黄色
  133. //0x2: 绿色
  134. int iTrafficeLightTime = 0; //红绿灯剩余时间
  135. double iTrafficeLightLat = 0;
  136. double iTrafficeLightLon = 0;
  137. bool daocheMode=false;
  138. //////////////////////////////////////////////////////
  139. ///kkcai, 2020-01-03
  140. QMutex mMutexMap;
  141. /////////////////////////////////////
  142. //mobileEye chuku
  143. float vehSpeed_st=0;
  144. bool useMobileEye = false;
  145. bool m_bOutGarage=false;//车道线识别出库标志
  146. float outGarageLong=10;
  147. float waitGpsTimeWidth=5000;
  148. int mnBocheComplete = 0; //When boche comple set a value.
  149. uint32_t ultraDistance[13];
  150. bool useObsPredict = false;
  151. bool useLidarPerPredict = false;
  152. bool avoidObs = false;
  153. bool inRoadAvoid = false;
  154. //hapo station 2021/02/05
  155. iv::StationCmd stationCmd;
  156. };
  157. typedef boost::serialization::singleton<iv::CarStatus> CarStatusSingleton;//非线程安全,注意多线程加锁,单例模式
  158. }
  159. #define ServiceCarStatus iv::CarStatusSingleton::get_mutable_instance()
  160. #endif // !_IV_COMMON_CAR_STATUS_