1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- #ifndef TIME_MANAGER_H
- #define TIME_MANAGER_H
- #include "radarobjectarray.pb.h"
- //#include "cameraobjectarray.pb.h"
- #include "objectarray.pb.h"
- #include "obstacles.pb.h"
- #include "worker.h"
- #include <memory>
- #include <chrono>
- #include <mutex>
- #include <algorithm>
- namespace iv {
- class TimeManager: public Worker
- {
- public:
- typedef iv::radar::radarobjectarray RadarDataType;
- typedef iv::lidar::objectarray LidarDataType;
- // typedef iv::vision::cameraobjectarray CameraDataType;
- typedef iv::vision::ObstacleInfo VisionDataType;
- typedef std::chrono::system_clock::time_point TimeType;
- // typedef std::function<void(RadarDataType&, LidarDataType&,CameraDataType&)> DataCallback;
- // typedef std::function<void(RadarDataType&,CameraDataType&)> RVCallback;
- typedef std::function<void(RadarDataType&, LidarDataType&,VisionDataType&)> DataCallback;
- typedef std::function<void(RadarDataType&,VisionDataType&)> RVCallback;
- TimeManager(const float hz);
- void SetDataCallback(DataCallback rlvcallback);
- void SetRVCallback(RVCallback rvcallback);
- void DoWork();
- void CacheRadarData(const iv::radar::radarobjectarray& radar_object_array);
- void CacheLidarData(const iv::lidar::objectarray& lidar_object_array);
- // void CacheCameraData(const iv::vision::cameraobjectarray& camera_object_array);
- void CacheCameraData(const iv::vision::ObstacleInfo& vision_object_array);
- void GetDataRLV(void);
- void GetDataRV(void);
- private:
- std::mutex mutex_data_;
- private:
- ///cache data
- std::vector<iv::lidar::objectarray> lidar_cache_;
- std::vector<iv::radar::radarobjectarray> radar_cache_;
- std::vector<iv::vision::ObstacleInfo> vision_cache_;
- private:
- iv::lidar::objectarray lidar_objects_;
- iv::radar::radarobjectarray radar_objects_;
- iv::vision::ObstacleInfo vision_objects_;
- static const int lidarCacheSize = 10;
- static const int radarCacheSzie = 30;
- static const int cameraCacheSzie = 20;
- private:
- DataCallback data_call_back_;
- RVCallback rv_call_back_;
- };
- }
- #endif // TIME_MANAGER_H
|