comm.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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. // //增加0x28f
  157. // int32_t p_flameout =36; //P档熄火;
  158. // int32_t engine_start =37; //发动机启动
  159. // int32_t emergency_signal = 38; //紧停信号
  160. // int32_t preheating_monitoring=39; //预热监控
  161. // int32_t park_switch =40; //驻车开关
  162. // int32_t safety_bar_lock =41; //安全杆锁定
  163. // int32_t forward_gear =42; //前进档
  164. // int32_t backward_gear =43;//后退档
  165. // int32_t first_gear = 44; //行驶一档
  166. // int32_t sencond_gear = 45; //行驶2档
  167. // int32_t n_gear =46; //实际N 档
  168. // int32_t cabin_end =47; //驾驶室上升到位
  169. // int32_t cab_end =48; //驾驶室下降到位
  170. // int32_t reserve =49; //保留
  171. // int32_t for_left_outrigger =50; //前左支腿选择
  172. // int32_t for_right_outrigger =51; //前右支腿选择
  173. // int32_t back_left_outrigger =52; //后左支腿选择
  174. // int32_t back_right_outrigger=53; //后右支腿选择
  175. // int32_t cab_start = 54; //驾驶室下降
  176. // int32_t canbin_start=55;//驾驶室上升
  177. // int32_t swinging_bridge_lock=56; //摆动桥锁定
  178. // int32_t cab_emery =57; //驾驶室应急下降
  179. // int32_t safety_bypass = 58; //安全旁通
  180. // int32_t clear_alarm = 59; //清除蜂鸣器报警
  181. // int32_t front_wheel_steering = 60; //前轮转向
  182. // int32_t back_wheel_steering = 61; //后轮转向
  183. // int32_t same_steering = 62; //前后轮同向转向
  184. // int32_t reverse_steering= 63; //前后轮反向转向
  185. // int32_t sound_signal_alarm = 64; //故障声光报警
  186. // int32_t rod_intake_limit_valve =65; //斗杆内收限制阀
  187. // int32_t rod_outtake_limit_valve = 66; //斗杆外摆限制阀
  188. // int32_t boom_lift_limit_valve = 67; //动臂提升限制阀
  189. // int32_t boom_out_limit_valve = 68; //动臂下降限制阀
  190. // int32_t cab_emery_value = 69; //驾驶室应急下降阀
  191. // int32_t charging_valve= 70; //充液阀
  192. // int32_t parking_valve = 71; //驻车阀
  193. // int32_t parking_back_signal = 72; //驻车反馈灯
  194. // int32_t brake_signal = 73; //刹车灯
  195. // int32_t power_delay = 74; //断电延时
  196. // int32_t flash_signal= 75; //闪光信号
  197. // int32_t left_for_outrigger_value = 76; //左前支腿伸缩电磁阀
  198. // int32_t right_for_outrigger_value = 77; //右前支腿伸缩电磁阀
  199. // int32_t left_back_outrigger_value = 78; //左后支腿伸缩电磁阀
  200. // int32_t right_back_outrigger_value = 79; //右后支腿伸缩电磁阀
  201. // int32_t for_steering_value = 80; //前轮转向电磁阀
  202. // int32_t same_steering_value = 81; //四轮同向转向电磁阀
  203. // int32_t rever_steering_value = 82; //四轮反向转向电磁阀
  204. // int32_t first_gear_solenoid_valve = 83; //一档电磁阀
  205. // int32_t sen_gear_solenoid_valve = 84; //二档电磁阀
  206. // int32_t grab_rotary_switch_valve = 85; //抓具旋转切换电磁阀
  207. //int32_t Boom_lift_pilot_pressure = 15;//动臂提升先导压力传感器故障
  208. //int32_t Boom_drop_pilot_pressure = 16;//动臂下降先导压力传感器故障
  209. //int32_t Stick_lift_pilot_pressure = 17;//斗杆提升先导压力传感器故障
  210. //int32_t Stick_Drop_Pilot_Pressure = 18;//斗杆下降先导压力传感器故障
  211. //int32_t left_turn_Pressure = 19;//车体左回转先导压力传感器故障
  212. //int32_t right_turn_Pressure = 20;//车体右回转先导压力传感器故障
  213. //int32_t outstretched_Pressure = 21;//支腿伸出先导压力传感器故障
  214. //int32_t instretched_Pressure = 22;//支腿缩回先导压力传感器故障
  215. //int32_t grab_opens_the_pilot = 23;//抓斗开启先导压力传感器故障
  216. //int32_t grab_close_the_pilot = 24;//抓斗闭合先导压力传感器故障
  217. //int32_t Main_pump_1_pilot_pressure = 25;//主泵1压力传感器故障
  218. //int32_t Main_pump_2_pilot_pressure = 26;//主泵2压力传感器故障
  219. //int32_t rod_cavity_pressure = 27;//动臂无杆腔压力传感器故障
  220. //int32_t stick_cavity_pressure = 28;//斗杆无杆腔压力传感器故障
  221. //int32_t Parking_pressure = 29;//驻车压力传感器故障
  222. //int32_t Failure_of_the_accumulator_pressure = 30;//蓄能器压力传感器故障
  223. //int32_t Gas_pedal_failure = 31;//油门踏板故障
  224. //int32_t Faulty_throttle_knob = 32;//油门旋钮故障
  225. //int32_t Leg_handle_failure = 33;//支腿手柄故障
  226. //int32_t The_gripper_knob_faulty = 34;//抓具旋钮故障
  227. //int32_t Hydraulic_oil_temperature_sensor_failure = 35;//液压油温传感器故障
  228. //int32_t Faulty_fuel_level_sensor = 36;//燃油油位传感器故障
  229. //int32_t Boom_inclination_sensor_failure = 37;//动臂倾角传感器故障
  230. //int32_t Stick_inclination_sensor_communication = 38;//斗杆倾角传感器通讯故障
  231. //int32_t Expansion_module_communication_failure = 39;//扩展模块通讯故障
  232. //int32_t working_distance_exceeded = 40;//工作距离超限
  233. //int32_t hydraulic_oil_temperature_low = 41;//燃油油位低
  234. //int32_t Low_battery_voltage = 42;//电池电压低
  235. //int32_t High_battery_voltage = 43;//电池电压高
  236. //int32_t accumulator_pressure_abnormal = 44;//蓄能器压力异常
  237. //int32_t hydraulic_oil_temperature_high = 45;//液压油温高
  238. //int32_t Low_oil_pressure = 46;//机油压力低
  239. //int32_t Low_coolant_level = 47;//冷却液液位低
  240. //int32_t High_coolant_level = 48;//冷却液温度高
  241. //int32_t system_overloaded = 49;//系统超载
  242. //int32_t Safety_bypass_pressed = 50;//安全旁通按下
  243. //int32_t Engine_SPN_failure = 51;//发动机SPN故障
  244. //int32_t engine_warming_up = 52;//发动机预热中
  245. //int32_t engine_warming_up_timeout = 53;//发动机预热超时
  246. //int32_t Emergency_stop_press = 54;//紧急停止按下
  247. };
  248. struct cannet_frame_receive
  249. {
  250. int32_t canid;
  251. int8_t dlc;
  252. int8_t data[8];
  253. };
  254. typedef struct {
  255. int16_t fire_status; //启动/熄火
  256. int16_t remote_forward; //远程控制前进
  257. int16_t remote_backward; //远程控制后退
  258. int16_t Brake; //刹车
  259. int16_t Park; //驻车
  260. int16_t Outrigger_status; //支腿
  261. int16_t Turn_angle; //转弯角度
  262. int16_t Left_turn; //左旋 左手柄 左信号
  263. int16_t Right_turn; //右旋 右手柄 右信号
  264. int16_t Raised; //小臂抬起 左手柄 向后
  265. int16_t Decrease; //小臂下降 左手柄 向前
  266. int16_t Stretch; //大臂伸起 右手柄 向后
  267. int16_t Bulls_decline ; //大臂下降 右手柄 向前
  268. int16_t Material ; //吸盘吸料
  269. int16_t Discharge ; //吸盘放料
  270. int16_t zhua; //抓斗抓料
  271. int16_t fang; //抓斗放料
  272. int16_t Shell_rotation_left ; //贝壳斗旋转 shun
  273. int16_t Shell_rotation_right ; //贝壳斗旋转 ni
  274. int16_t Cabin ; //驾驶室升
  275. int16_t Cab ; //驾驶室降
  276. int16_t Working_signal ; //作业灯开/关
  277. int16_t Turn_left_signal; //左转向 开/关
  278. int16_t Turn_right_signal ; //右转向 开/关
  279. int16_t Warning_Light ; //警示灯 开/关
  280. int16_t Trumpet; //喇叭
  281. int16_t Security_lock ; //安全锁 开/关
  282. int16_t Urget_stop ; //急停
  283. int16_t Vehicle_id; //车辆id
  284. } vehicle_status;