lidar_sim.cpp 822 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "api/video/video_frame.h"
  2. #include <stdint.h>
  3. #include "../common/comm.h"
  4. #include "Protocol.pb.h"
  5. #include "lidar_sim.h"
  6. #include "EgoClient.h"
  7. #include "./include/EgoInterface.h"
  8. CLidarSim::CLidarSim(CEgoClient* car) :_car(car)
  9. {
  10. }
  11. void CLidarSim::Start()
  12. {
  13. }
  14. void CLidarSim::Stop()
  15. {
  16. }
  17. void CLidarSim::OnPeerMessage(int16_t cmd, int16_t length, const void* data)
  18. {
  19. RemoNet::LidarPoint Req;
  20. Req.ParseFromArray(data, length);
  21. PointXYZI* Items = (PointXYZI*)alloca(sizeof(PointXYZI) * Req.data_size());
  22. PointXYZI* ptr = Items;
  23. for (int32_t i = 0; i < Req.data_size(); i+=4)
  24. {
  25. ptr->x = Req.data(i);
  26. ptr->y = Req.data(i + 1);
  27. ptr->z = Req.data(i + 2);
  28. ptr->intensity = Req.data(i + 3);
  29. ++ptr;
  30. }
  31. // _car->OnLidarData(Req.is_left(), Req.is_dense(), Req.seq(), Items, Req.data_size());
  32. }