comm.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. #pragma once
  2. #include <unordered_map>
  3. #include <vector>
  4. template<typename T>
  5. struct FVector3
  6. {
  7. T X;
  8. T Y;
  9. T Z;
  10. };
  11. enum RadarPosition :int32_t
  12. {
  13. RADAR_LEFT,
  14. RADAR_RIGHT,
  15. RADAR_REAR,
  16. RADAR_ALL
  17. };
  18. enum RenderPosition :int32_t
  19. {
  20. FRONT,
  21. BACK,
  22. LEFT,
  23. RIGHT,
  24. DASHBOARD,
  25. DASHBOARD_m,
  26. ALL
  27. };
  28. enum EgoType :int32_t
  29. {
  30. None,
  31. User,
  32. Car
  33. };
  34. enum ChannelType:int32_t
  35. {
  36. CHANNEL_CAR,
  37. CHANNEL_IMU,
  38. CHANNEL_RADAR,
  39. #ifdef LIDAR_SENSOR
  40. CHANNEL_LEFT_LIDAR,
  41. CHANNEL_RIGHT_LIDAR,
  42. #endif
  43. CHANNEL_ALL,
  44. };
  45. enum UserState
  46. {
  47. Offline=0,
  48. Idle = 1,
  49. Remote = 2,
  50. Automotive = 3,
  51. AskRemote = 4
  52. };
  53. struct UserCamera
  54. {
  55. int32_t uid;
  56. EgoType type;
  57. UserState state;
  58. std::string name;
  59. };
  60. struct OfferDesc
  61. {
  62. char type[16];
  63. char sdp[4096 * 3-16];
  64. };
  65. struct AnswerDesc
  66. {
  67. char type[16];
  68. char sdp[4096 * 3 - 16];
  69. };
  70. struct CandidateDesc
  71. {
  72. char candidate[4096];
  73. char sdp_mid[4096];
  74. int32_t sdp_mline_index;
  75. };
  76. #pragma pack(1)
  77. #define CAN_MSG_LEN 13
  78. struct cannet_frame
  79. {
  80. int8_t dlc;
  81. int32_t canid;
  82. int8_t data[8];
  83. };
  84. #pragma pack()
  85. enum RobotStatus
  86. {
  87. OK,
  88. Fail,
  89. };
  90. #pragma pack()
  91. struct RadarData
  92. {
  93. int32_t r0;
  94. int32_t r1;
  95. int32_t r2;
  96. int32_t r3;
  97. int32_t r4;
  98. int32_t r5;
  99. int32_t r6;
  100. int32_t r7;
  101. };
  102. struct FeedData
  103. {
  104. //int32_t work_pressure;
  105. //int32_t brake_pressure;
  106. //int32_t gearbox_oil_temp;
  107. //int32_t gearbox_oil_pressure;
  108. //int32_t engine_rpm;
  109. //int32_t engine_pressure;
  110. //int32_t speed;
  111. //// int32_t gear;
  112. //int32_t cold_water;
  113. //int32_t steer_angle;
  114. //int32_t left_lock_status;
  115. //int32_t right_lock_status;
  116. ///////////////////////////////////////////////////////状态参数
  117. int32_t Engine_speed = 1;//发动机转速
  118. int32_t Travel_speed = 2;//行驶速度
  119. int32_t Fuel_level = 3;//燃油油位
  120. int32_t Engine_temperature = 4;//发动机水温
  121. int32_t Hydraulic_oil_temperature = 5;//液压油油温
  122. int32_t Main_pump_1_pressure = 6;//主泵1压力
  123. int32_t Main_pump_2_pressure = 7;//主泵2压力
  124. int32_t Hand_gear = 8;//水箱水位
  125. int32_t Actual_gear = 9;//发动机机油压力
  126. _Float32 Gripper_height = 10;//抓具高度
  127. _Float32 amplitude = 11;//幅度
  128. int32_t Boom_angle = 12;//动臂角度
  129. int32_t Stick_angle = 13;//斗杆角度
  130. ///////////////////////////////////////////////////////报警信息
  131. int32_t Idle_protection = 14;//怠速保护
  132. int32_t Front_toggle = 15;//前轮对中
  133. int32_t Back_toggle = 16;//后轮对中
  134. int8_t Error_Buff[8];//报警信息
  135. int32_t interlock = 18;//启动联锁
  136. int32_t safety_switch = 19;//安全开关阀异常
  137. int32_t arm_lift_pilot = 20;//大臂提升先导比例阀异常
  138. int32_t arm_lowering_pilot = 21;//大臂下降先导比例阀异常
  139. int32_t lever_lifting_pilot = 22;//斗杆提升先导比例阀异常
  140. int32_t rod_lowering_pilot = 23;//斗杆下降先导比例阀异常
  141. int32_t left_rotary_pilot = 24;//左回转先导比例阀异常
  142. int32_t right_rotary_pilot = 25;//右回转先导比例阀异常
  143. int32_t grab_open_pilot = 26;//抓斗开启先导比例阀异常
  144. int32_t grab_close_pilot = 27;//抓斗闭合先导比例阀异常
  145. int32_t safety_valves = 28;//安全开关阀
  146. //增加 0x384
  147. int32_t function_code =29 ; //功能码
  148. int32_t main_add =30; //主地址
  149. int32_t sub_add =31; //次地址
  150. int32_t paramter=32 ; //参数值
  151. //增加0x28b
  152. int32_t engine_spn =33; //发动机实时故障SPN
  153. int32_t engine_fmi =34; //发动机实时故障FMI
  154. int32_t engine_num =35; //发动机故障次数
  155. int8_t all_Buff[8]; //0x28f
  156. };
  157. struct cannet_frame_receive
  158. {
  159. int32_t canid;
  160. int8_t dlc;
  161. int8_t data[8];
  162. };
  163. typedef struct {
  164. //车辆基本状态控制
  165. int16_t keyStatus; //钥匙状态
  166. int16_t parkControl; //驻车控制
  167. int16_t travelMode; //驾驶模式
  168. int16_t eStop; //急停开关
  169. int16_t directSwitch; //前后切换
  170. int16_t gearControl; //车辆档位控制
  171. int16_t hazardLight; //双闪灯
  172. int16_t travelLight; //行驶灯光
  173. int16_t vehicleHorn; //喇叭
  174. int16_t silencedAlarm; //消报警音按钮
  175. //车辆行驶控制
  176. // int16_t accPedal; //油门踏板/
  177. int16_t accPedalH; //手油门踏板
  178. int16_t accPedalF; //脚油门踏板
  179. int16_t brakePedal ; //刹车踏板
  180. int16_t steeringWheel; //方向盘转速
  181. int16_t turnSignal ; //转向灯
  182. int16_t turnMode; //转向模式
  183. //作业机构控制
  184. int16_t enableHydraulic; //液压使能开关
  185. int16_t workLight; //工作灯
  186. int16_t bypassSwitch; //旁通开关
  187. int16_t taskJoint_1; //第一个作业关节控制
  188. int16_t taskJoint_2; //第二个作业关节控制
  189. int16_t taskJoint_3; //第三个作业关节控制
  190. int16_t endJoint; //末端关节控制
  191. int16_t toolControl; //末端工具控制
  192. int16_t baseLegSwitch; //支腿选择开关
  193. int16_t baseLegControl; //支腿动作控制
  194. int16_t cabLift; //驾驶室升降机构
  195. int16_t esCabLift; //驾驶室应急下降开关
  196. int16_t suckerSelect; //吸盘选择开关
  197. int16_t coopSignal; //协同作业信号
  198. //舱端故障报警
  199. int16_t errBasOperation; //基本操作故障
  200. int16_t errAccPedal; //油门信号故障
  201. int16_t errBrakePedal; //刹车信号故障
  202. int16_t errSteeringWheel; //转向故障
  203. int16_t errHandle; //手柄信号故障
  204. int16_t errEndTool; //末端工具控制故障
  205. int16_t errOther; //其他故障
  206. } vehicle_control_cv;