radar_sim.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <stdint.h>
  2. #include "Protocol.pb.h"
  3. #include "../common/comm.h"
  4. #include "./include/EgoInterface.h"
  5. #include "EgoClient.h"
  6. #include "radar_sim.h"
  7. CRadarSim::CRadarSim(CEgoClient* radar) :_radar(radar)
  8. {
  9. }
  10. void CRadarSim::Start()
  11. {
  12. }
  13. void CRadarSim::Stop()
  14. {
  15. }
  16. void CRadarSim::OnPeerMessage(int16_t cmd, int16_t length, const void* data)
  17. {
  18. RemoNet::CCSensor Req;
  19. Req.ParseFromArray(data, length);
  20. //金川使用角度传感器提供的支腿高度
  21. // 大冶使用的是拉线传感器提供的支腿高度
  22. // 此处注释掉了使用角度传感器的方式
  23. //_radar->OnEncodeData(Req.left_encode(), Req.right_encode());
  24. RemoNet::CCRadarMessage ReqRadar;
  25. ReqRadar.ParseFromArray(data, length);
  26. _radar->OnRadarData(ReqRadar.radar0(), ReqRadar.radar1(), ReqRadar.radar2(), ReqRadar.radar3(), ReqRadar.radar4(), ReqRadar.radar5(), ReqRadar.radar6(), ReqRadar.radar7(), ReqRadar.radar8());
  27. /*
  28. int32_t range[9] = { 0 };
  29. int32_t count = Req.node_size();
  30. for (int32_t i = 0; i < count; i++)
  31. {
  32. //range[i] = Req.range(i);
  33. auto& n = Req.node(i);
  34. range[n.id()] = n.range();
  35. }
  36. //_radar->OnRadarData(range[0], range[1], range[2], range[3], range[4], range[5],range[6],range[7],range[8]);
  37. */
  38. }