| | |
| | | import com.zy.acs.manager.manager.entity.AgvDetail; |
| | | import com.zy.acs.manager.manager.entity.AgvModel; |
| | | import com.zy.acs.manager.manager.entity.Code; |
| | | import com.zy.acs.manager.manager.enums.AgvModelType; |
| | | import com.zy.acs.manager.manager.service.AgvDetailService; |
| | | import com.zy.acs.manager.manager.service.AgvModelService; |
| | | import com.zy.acs.manager.manager.service.AgvService; |
| | | import com.zy.acs.manager.manager.service.CodeService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.DependsOn; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | import org.springframework.core.io.Resource; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @DependsOn("mapDataDispatcher") |
| | | public class AvoidWaveCalculator { |
| | | |
| | | private static final ReentrantLock lock = new ReentrantLock(Boolean.TRUE); |
| | |
| | | public void execute() { |
| | | this.singleThreadExecutor = Executors.newSingleThreadExecutor(); |
| | | this.singleThreadExecutor.execute(() -> { |
| | | |
| | | try { Thread.sleep(200); } catch (InterruptedException ignore) {} |
| | | try { Thread.sleep(500); } catch (InterruptedException ignore) {} |
| | | |
| | | this.calcDynamicNodeWhenBoot(); |
| | | |
| | | // while (!Thread.currentThread().isInterrupted()) { |
| | | // |
| | | // this.calcWaveScope(); |
| | | // |
| | | // try { Thread.sleep(500); } catch (InterruptedException ignore) {} |
| | | // } |
| | | |
| | | }); |
| | | } |
| | | |
| | | |
| | | public boolean calcWaveScope() { |
| | | public boolean calcWaveScope(AgvModel agvModel) { |
| | | Integer lev = MapDataDispatcher.MAP_DEFAULT_LEV; |
| | | boolean lockAcquired = false; |
| | | |
| | |
| | | } |
| | | |
| | | // return this.calcWaveScopeByPython(lev); |
| | | return this.calcWaveScopeByJava(lev); |
| | | return this.calcWaveScopeByJava(lev, agvModel); |
| | | |
| | | } catch (Exception e) { |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private boolean calcWaveScopeByPython(Integer lev) throws Exception { |
| | | private boolean calcWaveScopeByPython(Integer lev, AgvModel agvModel) throws Exception { |
| | | if (null == agvModel.getDiameter() || agvModel.getDiameter() <= 0) { |
| | | log.warn("There is no diameter or diameter value was wrong..."); |
| | | } |
| | | |
| | | // python |
| | | AgvModel agvModel = agvModelService.selectByType(AgvModelType.CTU_BOX_TRANSPORT_AGV.toString()); // can be optimized |
| | | Double avoidDistance = MapDataUtils.getVehicleWaveSafeDistance(agvModel.getDiameter(), MapDataConstant.MAX_DISTANCE_BETWEEN_ADJACENT_AGV_FACTOR); |
| | | |
| | | if (null == pythonFile) { |
| | |
| | | return true; |
| | | } |
| | | |
| | | private boolean calcWaveScopeByJava(Integer lev) throws Exception { |
| | | private boolean calcWaveScopeByJava(Integer lev, AgvModel agvModel) throws Exception { |
| | | if (null == agvModel.getDiameter() || agvModel.getDiameter() <= 0) { |
| | | log.warn("There is no diameter or diameter value was wrong..."); |
| | | } |
| | | |
| | | AgvModel agvModel = agvModelService.selectByType(AgvModelType.CTU_BOX_TRANSPORT_AGV.toString()); // can be optimized |
| | | Double avoidDistance = MapDataUtils.getVehicleWaveSafeDistance(agvModel.getDiameter(), MapDataConstant.MAX_DISTANCE_BETWEEN_ADJACENT_AGV_FACTOR); |
| | | |
| | | // java |