radar_sim.cpp 795 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <stdint.h>
  2. #include "api/video/video_frame.h"
  3. #include "Protocol.pb.h"
  4. #include "../common/comm.h"
  5. #include "./include/EgoInterface.h"
  6. #include "EgoClient.h"
  7. #include "radar_sim.h"
  8. CRadarSim::CRadarSim(CEgoClient* radar) :_radar(radar)
  9. {
  10. }
  11. void CRadarSim::Start()
  12. {
  13. }
  14. void CRadarSim::Stop()
  15. {
  16. }
  17. void CRadarSim::OnPeerMessage(int16_t cmd, int16_t length, const void* data)
  18. {
  19. RemoNet::CCSensor Req;
  20. Req.ParseFromArray(data, length);
  21. int32_t range[7] = { 0 };
  22. int32_t count = Req.node_size();
  23. for (int32_t i = 0; i < count; i++)
  24. {
  25. //range[i] = Req.range(i);
  26. auto& n = Req.node(i);
  27. range[n.id()] = n.range();
  28. }
  29. _radar->OnRadarData(range[0], range[1], range[2], range[3], range[4], range[5],range[6]);
  30. _radar->OnEncodeData(Req.left_encode(), Req.right_encode());
  31. }