diff --git a/agv_app/static/js/setting.js b/agv_app/static/js/setting.js index e4e891f..d8d8bf2 100644 --- a/agv_app/static/js/setting.js +++ b/agv_app/static/js/setting.js @@ -128,10 +128,12 @@ createApp({ const res = await fetch(API + '/api/navigate/status') if (res.ok) { const data = await res.json() - this.nav2Available = data.nav2_available - if (data.current_pos) { - this.navCurrentPos = data.current_pos - console.log('[Setting] refresh nav:', data.nav2_available, 'current_pos:', data.current_pos ? data.current_pos.map(function(x){return x.toFixed(2)}) : null, 'mapLoaded:', this.mapLoaded, 'mapMeta:', this.mapMeta ? 'ok' : 'null') + this.nav2Available = data.nav2_available || false + // API returns "current_position", normalize to our field + const cp = data.current_position || data.current_pos || null + if (cp) { + this.navCurrentPos = cp + console.log('[Setting] nav2:', data.nav2_available, 'cp:', cp.map(function(x){return x.toFixed(2)}), 'mapLoaded:', this.mapLoaded, 'mapMeta:', this.mapMeta ? 'ok' : 'null') } } } catch (e) {}