lidar_sim.cpp 787 B

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