123456789101112131415161718192021222324252627282930313233343536373839 |
- // import { YUpLStrategy } from "./strategy-manager/y-up-l-strategy.js";
- import { YUpRStrategy } from "./strategy-manager/y-up-r-strategy.js";
- const strategies = {
- // "y-up-l": YUpLStrategy,
- "y-up-r": YUpRStrategy,
- };
- export class UWB {
- constructor({ upAxis, LR, worldPose }) {
- this.setStrategy(upAxis + '-'+LR, worldPose);
- }
- setStrategy(strategyKey, worldPose) {
- if (!strategies[strategyKey]) {
- throw new Error(`${strategyKey} 策略不存在`);
- }
- this.currentStrategy = new strategies[strategyKey]();
- this.setLocalOriginPose(worldPose);
- }
- unifiedCoordinateSystem(model) {
- if (this.currentStrategy) {
- return this.currentStrategy.unifiedCoordinateSystem(model);
- }
- }
- setLocalOriginPose(worldPose) {
- if (this.currentStrategy) {
- this.currentStrategy.setLocalOriginPose(worldPose);
- }
- }
- convertLocalToWorld(localPosition) {
- if (this.currentStrategy) {
- return this.currentStrategy.convertLocalToWorld( localPosition);
- }
- }
- }
|