[关闭]
@Pigmon 2018-06-20T14:01:02.000000Z 字数 1832 阅读 929

新版本遥控中心程序报文说明

慧拓


端口和IP定义

  1. const char* UI_IP = "127.0.0.1";
  2. const int UI_PORT = 10010; // 对应 UplinkDGram
  3. const char* PANOSIM_IP = "10.130.210.63";
  4. const int PANOSIM_PORT = 10012; // 对应 UplinkDGram
  5. const int STATE_PORT = 10013; // 按键事件触发报文的端口,对应 HomeDgram_Trigger
  6. const int LOCAL_PORT = 10015; // 模拟器输入实时状态的发送端口 HomeDgram_Ctrl

报文定义

  1. #pragma once
  2. // 车辆上行信息,接收到就发给UI和PanoSim
  3. struct UplinkDGram
  4. {
  5. short m_gram_header; // 报文头 0xAAA
  6. short m_gram_id; // 报文标识 0xAF1
  7. short m_vehicle_id; // 车辆ID 0x00A ~ 0x00C
  8. short m_vehicle_state; // 0:正常; 1:故障
  9. unsigned int m_longitude; // 经度
  10. unsigned int m_latitude; // 纬度
  11. unsigned short m_heading; // 航向
  12. short m_speed; // 速度
  13. int m_steering; // 方向盘转角
  14. short m_ctrl_sign; // 0:自动; 1:遥控
  15. short m_ctrl_info; // 控制信息 1:车辆主动请求接管; 2:车辆故障 ...
  16. short m_rpm; // RPM
  17. short m_unused0; //
  18. void Print()
  19. {
  20. printf("DGram CarID: %d\n", m_vehicle_id);
  21. printf("DGram m_speed: %d\n", m_speed);
  22. printf("DGram m_steering: %d\n", m_steering);
  23. }
  24. };
  25. struct DownlinkDGram
  26. {
  27. short m_gram_header; // 报文头 0xAAA
  28. short m_gram_id; // 报文标识 0xAF1
  29. short m_vehicle_id; // 车辆ID 0x00A ~ 0x00C
  30. short m_rc_speed; // 遥控速度
  31. short m_rc_acc_pedal;
  32. short m_rc_brake_pedal;
  33. short m_ctrl_sign; // 遥控状态, 1: 遥控; 0: 自动
  34. short m_unused;
  35. int m_rc_steer; // 遥控方向盘转角
  36. void Print()
  37. {
  38. printf("DGram CarID: %d\n", m_vehicle_id);
  39. printf("DGram Steering: %d\n", m_rc_steer);
  40. printf("DGram Acc: %d\n", m_rc_acc_pedal);
  41. printf("DGram Brk: %d\n", m_rc_brake_pedal);
  42. }
  43. };
  44. #pragma pack(push)
  45. #pragma pack(1)
  46. // 模拟器状态报文,一直发送
  47. typedef struct HomeDgram_Ctrl
  48. {
  49. short m_gram_header; // 报文头 0xA00
  50. short m_gram_id; // 报文标识 0xA01
  51. short m_vehicle_id; // 0 - 当前没有观察任何车辆;或 车辆ID
  52. int m_rc_steering; // 模拟方向盘转角
  53. short m_rc_speed; // 模拟器速度
  54. short m_rc_acc_pedal; // 模拟器油门踏板开度 (0-100)
  55. short m_rc_brk_pedal; // 模拟器刹车踏板开度 (0-100)
  56. short m_ping_time; // RTT
  57. HomeDgram_Ctrl()
  58. {
  59. m_gram_header = 0xA00;
  60. m_gram_id = 0xA01;
  61. m_ping_time = 5;
  62. }
  63. };
  64. // 控制更改报文,有按键消息再发送
  65. typedef struct HomeDgram_Trigger
  66. {
  67. short m_gram_header; // 报文头 0x010
  68. short m_gram_id; // 报文标识 0x011
  69. short m_ctrl_state; // 控制状态 0 - 啥也不做;1 - 遥控; 2 - 同步
  70. HomeDgram_Trigger()
  71. {
  72. m_gram_header = 0x010;
  73. m_gram_id = 0x011;
  74. }
  75. };
  76. #pragma pack(pop)
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注