car_status.h 6.5 KB

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