12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //
- // Created by zx on 2020/1/16.
- //
- #include "Terminal_region_limit.h"
- Terminal_region_limit::Terminal_region_limit(Railing* left_railing,Railing* right_railing)
- {
- mp_left_railing=left_railing;
- mp_right_railing=right_railing;
- }
- Error_manager Terminal_region_limit::verify(cv::RotatedRect rect)
- {
- if(mp_right_railing==NULL || mp_left_railing==NULL)
- {
- return Error_manager(PARAMETER_ERROR,NORMAL,"terminal left or right railing is null");
- }
- Error_manager code;
- bool tb_left_error=false;
- bool tb_right_error=false;
- code=mp_left_railing->verify(rect);
- if(code!=SUCCESS)
- {
- //左边栏杆碰撞
- tb_left_error=true;
- }
- code=mp_right_railing->verify(rect);
- if(code!=SUCCESS)
- {
- //右边栏杆碰撞
- tb_right_error=true;
- }
- if(tb_left_error && tb_right_error)
- {
- return Error_manager(HARDWARE_LIMIT_TERMINAL_LR_ERROR,NORMAL,"terminal left and right railing error");
- }
- if(tb_left_error)
- {
- return Error_manager(HARDWARE_LIMIT_TERMINAL_LEFT_ERROR,NORMAL,"terminal left railing error");
- }
- if(tb_right_error)
- {
- return Error_manager(HARDWARE_LIMIT_TERMINAL_RIGHT_ERROR,NORMAL,"terminal right railing error");
- }
- return SUCCESS;
- }
|