diff --git a/servo/src/main/java/com/galaxis/rcs/plan/path2/PathUtils.java b/servo/src/main/java/com/galaxis/rcs/plan/path2/PathUtils.java index 834439d..cfffe83 100644 --- a/servo/src/main/java/com/galaxis/rcs/plan/path2/PathUtils.java +++ b/servo/src/main/java/com/galaxis/rcs/plan/path2/PathUtils.java @@ -5,6 +5,21 @@ import com.galaxis.rcs.common.enums.LCCDirection; import java.util.*; public class PathUtils { + + /** + * 从 LCCDirection 转换为 AMR 的方向单位 + * 当前方向 UInt8 0: X轴正向 1: Y轴正向 2: X轴负向 3: Y轴负向 15: 未知方向 + */ + public static short convertDirectionToPtrDiretion(LCCDirection value) { + return switch (value) { + case UP -> 3; + case DOWN -> 1; + case LEFT -> 2; + case RIGHT -> 0; + default -> throw new IllegalArgumentException("Unknown direction: " + value); + }; + } + /** * 计算移动方向 */