| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.manager.core.constant.MapDataConstant; |
| | | import com.zy.acs.manager.core.domain.VehicleFootprint; |
| | | import com.zy.acs.manager.manager.entity.AgvModel; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | return JSON.toJSONString(set); |
| | | } |
| | | |
| | | public static Double getVehicleWaveSafeDistance(Integer val, Double factor) { |
| | | if (Cools.isEmpty(val)) { |
| | | return 0.0D; |
| | | public static Double getVehicleWaveSafeDistance(Number mm) { |
| | | return getVehicleWaveSafeDistance(mm, null); |
| | | } |
| | | |
| | | public static Double getVehicleWaveSafeDistance(Number mm, Double factor) { |
| | | if (mm == null) { |
| | | throw new IllegalArgumentException("Invalid map length: " + mm); |
| | | } |
| | | factor = Optional.ofNullable(factor).orElse(1.0D); |
| | | double val = mm.doubleValue(); |
| | | if (val <= 0) { |
| | | throw new IllegalArgumentException("Invalid map length: " + mm); |
| | | } |
| | | factor = Optional.ofNullable(factor).orElse(MapDataConstant.MAX_DISTANCE_BETWEEN_ADJACENT_AGV_FACTOR); |
| | | return val * factor; |
| | | } |
| | | |
| | | public static VehicleFootprint buildFootprint(AgvModel agvModel) { |
| | | if (null == agvModel) { |
| | | throw new IllegalArgumentException("AgvModel is null"); |
| | | } |
| | | if (agvModel.getHeadOffset() == null || agvModel.getHeadOffset() <= 0) { |
| | | throw new IllegalArgumentException("Invalid head offset: " + agvModel.getHeadOffset()); |
| | | } |
| | | if (agvModel.getTailOffset() == null || agvModel.getTailOffset() <= 0) { |
| | | throw new IllegalArgumentException("Invalid tail offset: " + agvModel.getTailOffset()); |
| | | } |
| | | if (agvModel.getWidth() == null || agvModel.getWidth() <= 0) { |
| | | throw new IllegalArgumentException("Invalid width: " + agvModel.getWidth()); |
| | | } |
| | | |
| | | double head = agvModel.getHeadOffset(); |
| | | double tail = agvModel.getTailOffset(); |
| | | double halfWidth = (double) agvModel.getWidth() / 2; |
| | | |
| | | return new VehicleFootprint(head, tail, halfWidth); |
| | | } |
| | | |
| | | } |