12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- #ifndef MEASURETASK_H
- #define MEASURETASK_H
- #include "common.h"
- #include "TaskQueue/BaseTask.h"
- #include "laser/Laser.h"
- #include "modbus/PLCMonitor.h"
- #ifndef PI
- #define PI 3.14159265
- #endif
- enum ERROR_CODE
- {
- eSucc=0
- ,eArea //车位区域错误
- ,eLidar //雷达点云不重合
- ,eCloud //点云为空
- ,eNoCar //未检测到车
- ,eMulCar //多辆车
- ,eDistance //车间距过小
- ,eLimitL=101
- ,eLimitT
- ,eLimitR
- ,eLimitB
- };
- typedef struct stCarPosition
- {
- float x;
- float y;
- float a;
- float l;
- float w;
- float h;
- ERROR_CODE error_code;
- cv::RotatedRect rrect;
- int pos_id; //车位ID
- stCarPosition()
- {
- error_code = eSucc;
- pos_id = -1;
- }
- }CarPosition;
- std::string Error_string(ERROR_CODE code);
- bool RegionInRegion(std::vector<cv::Point2f>& mini_poly, std::vector<cv::Point2f>& large_poly);
- double distance_polys(std::vector<cv::Point2f> poly1, std::vector<cv::Point2f> poly2);
- typedef void(*ResultCallback)(QtMessageData msg, void*);
- class MeasureTask : public tq::BaseTask
- {
- public:
- MeasureTask(std::vector<CLaser*> lasers,int position_id,
- modbus::CPLCMonitor* pcl, Automatic::stCalibParam param);
- virtual void Main();
- virtual void Cancel();
- void SetResultCallback(void* ptr,ResultCallback func = NULL);
- protected:
- static void PushPoint(CPoint3D point, void* pointer);
- bool IsLaserReady();
- ERROR_CODE SelectResult(int plate_index, std::vector<CarPosition> results, CarPosition& result);
- //žùŸÝ³µÁŸÎ»Ö÷ÖÅ䳵λID, ²»ÔÚ³µÎ»µÄ³µÁŸÐÅϢɟ³ý
- ERROR_CODE Dispatch_posID(std::vector<CarPosition>& results);
- protected:
- std::vector<CLaser*> m_lasers;
- modbus::CPLCMonitor* m_plc;
- int m_position_id; //³µÎ»id
- Automatic::stCalibParam m_calib_param; //ÓÐÐ§ÇøÓò
- PointCloudT m_cloud;
- mutable std::mutex m_mutex;
- static std::mutex* g_mutex;
- bool m_exit;
- ResultCallback m_post_result_func;
- void* m_ptr;
- };
- #endif // MEASURETASK_H
|