2026-10-21 15:19:07 +09:00
<!doctype html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
< title > Lumi Control</ title >
< style >
: root {
--bg : #0a0e13 ; --panel : #111821 ; --panel2 : #17202b ; --line : #223042 ; --text : #e6edf3 ; --muted : #8695a7 ;
--accent : #38bdf8 ; --accent2 : #6366f1 ; --ok : #22c55e ; --warn : #f59e0b ; --bad : #ef4444 ; --r : 14 px ; --hdr : 58 px ;
}
* { box-sizing : border-box }
html , body { height : 100 % }
body { margin : 0 ; background : var ( -- bg ); color : var ( -- text ); font : 13.5 px / 1.4 system-ui , - apple-system , "Segoe UI" , Roboto , sans-serif ; overflow : hidden }
button , input , select , textarea { font : inherit ; color : inherit }
header { height : var ( -- hdr ); display : flex ; align-items : center ; gap : 10 px ; padding : 0 16 px ; border-bottom : 1 px solid var ( -- line ); background : #0c1218 }
. brand { display : flex ; align-items : center ; gap : 9 px ; font-weight : 700 ; font-size : 16 px ; white-space : nowrap }
. logo { width : 30 px ; height : 30 px ; border-radius : 9 px ; background : linear-gradient ( 135 deg , var ( -- accent ), var ( -- accent2 )); display : grid ; place-items : center }
. pills { display : flex ; gap : 7 px ; flex : 1 ; overflow : hidden ; min-width : 0 }
. pill { display : flex ; align-items : center ; gap : 6 px ; padding : 4 px 10 px ; border-radius : 999 px ; background : var ( -- panel ); border : 1 px solid var ( -- line ); color : var ( -- muted ); font-size : 12 px ; white-space : nowrap }
. pill b { color : var ( -- text ); font-weight : 600 }
. dot { width : 8 px ; height : 8 px ; border-radius : 50 % ; background : var ( -- muted ); flex : none }
. dot . ok { background : var ( -- ok ); box-shadow : 0 0 8 px var ( -- ok )}. dot . bad { background : var ( -- bad )}
. bat { width : 38 px ; height : 7 px ; border-radius : 4 px ; background : var ( -- line ); overflow : hidden }. bat i { display : block ; height : 100 % ; background : var ( -- ok )}
. hbtn { background : var ( -- panel2 ); border : 1 px solid var ( -- line ); border-radius : 10 px ; padding : 8 px 13 px ; cursor : pointer ; white-space : nowrap }
. hbtn : hover { border-color : var ( -- accent )}
. stop { background : var ( -- bad ); border : 0 ; color : #fff ; font-weight : 800 ; letter-spacing : .5 px ; padding : 9 px 18 px ; border-radius : 10 px ; cursor : pointer ; box-shadow : 0 0 0 3 px rgba ( 239 , 68 , 68 , .25 ); white-space : nowrap }
main { height : calc ( 100 % - var ( -- hdr )); display : grid ; grid-template-columns : minmax ( 0 , 1 fr ) 360 px ; gap : 12 px ; padding : 12 px }
. left { display : grid ; grid-template-rows : auto minmax ( 0 , 1 fr ); gap : 12 px ; min-height : 0 }
. cams { display : grid ; grid-template-columns : 1 fr 1 fr ; gap : 12 px }
. card { background : var ( -- panel ); border : 1 px solid var ( -- line ); border-radius : var ( -- r ); overflow : hidden ; min-height : 0 }
. ch { display : flex ; align-items : center ; gap : 8 px ; padding : 8 px 12 px ; border-bottom : 1 px solid var ( -- line )}
. ch h2 { margin : 0 ; font-size : 13.5 px ; font-weight : 650 }
. ch . sp { flex : 1 }
. tag { font-size : 11.5 px ; padding : 2 px 8 px ; border-radius : 999 px ; background : var ( -- panel2 ); border : 1 px solid var ( -- line ); color : var ( -- muted )}
. tag . live { color : var ( -- ok ); border-color : rgba ( 34 , 197 , 94 , .45 )}
. icon { background : transparent ; border : 1 px solid var ( -- line ); border-radius : 7 px ; padding : 2 px 8 px ; cursor : pointer ; color : var ( -- muted ); text-decoration : none ; font-size : 12 px }
. icon : hover { color : var ( -- text ); border-color : var ( -- accent )}
. frame { position : relative ; background : #04060a ; aspect-ratio : 16 / 9 ; max-height : calc (( 100 vh - var ( -- hdr )) * .42 )}
. frame img , . frame canvas { width : 100 % ; height : 100 % ; object-fit : contain ; display : block }
. frame . empty { position : absolute ; inset : 0 ; display : grid ; place-items : center ; color : var ( -- muted ); text-shadow : 0 1 px 3 px #000 }
. frame . empty [ hidden ] { display : none }
. frame . count { position : absolute ; top : 8 px ; left : 8 px ; background : rgba ( 0 , 0 , 0 , .62 ); padding : 3 px 9 px ; border-radius : 999 px ; font-size : 12 px }
. people { display : flex ; gap : 6 px ; padding : 7 px 12 px ; overflow : hidden ; white-space : nowrap ; height : 36 px ; align-items : center }
. chip { background : var ( -- panel2 ); border : 1 px solid var ( -- line ); border-radius : 7 px ; padding : 2 px 8 px ; font-size : 12 px }
. chip . near { border-color : rgba ( 239 , 68 , 68 , .6 ); color : #fca5a5 }
. muted { color : var ( -- muted )}
. mapcard { display : flex ; flex-direction : column }
. mapwrap { position : relative ; flex : 1 ; min-height : 0 ; background : #0d131a }
# map { position : absolute ; inset : 0 ; width : 100 % ; height : 100 % ; cursor : grab ; touch-action : none }
. legend { position : absolute ; left : 10 px ; bottom : 10 px ; background : rgba ( 10 , 14 , 19 , .85 ); border : 1 px solid var ( -- line ); border-radius : 9 px ; padding : 6 px 10 px ; font-size : 11.5 px ; color : var ( -- muted ); display : flex ; gap : 12 px }
. legend i { display : inline-block ; width : 9 px ; height : 9 px ; border-radius : 50 % ; margin-right : 5 px ; vertical-align : -1 px }
. right { display : flex ; flex-direction : column ; gap : 12 px ; min-height : 0 ; overflow : auto ; padding-right : 2 px ; scrollbar-width : thin }
. box { padding : 12 px 14 px }
. box h3 { margin : 0 0 10 px ; font-size : 11.5 px ; text-transform : uppercase ; letter-spacing : .9 px ; color : var ( -- muted ); display : flex ; justify-content : space-between ; align-items : center ; font-weight : 650 }
. row { display : flex ; gap : 7 px ; align-items : center ; margin-bottom : 8 px }
. row : last-child { margin-bottom : 0 }
. btn { background : var ( -- panel2 ); border : 1 px solid var ( -- line ); border-radius : 9 px ; padding : 7 px 11 px ; cursor : pointer ; transition : border-color .15 s , background .15 s ; user-select : none ; -webkit- user-select : none ; touch-action : none }
. btn : hover { border-color : var ( -- accent )}. btn : disabled { opacity : .45 ; cursor : not-allowed }
. btn . on { background : rgba ( 56 , 189 , 248 , .18 ); border-color : var ( -- accent )}
. btn . primary { background : var ( -- accent ); border-color : var ( -- accent ); color : #04111b ; font-weight : 650 }
. btn . danger { border-color : rgba ( 239 , 68 , 68 , .5 ); color : #fca5a5 }
. grow { flex : 1 }
input [ type = range ] { flex : 1 ; accent-color : var ( -- accent ); min-width : 0 }
. val { min-width : 44 px ; text-align : right ; font-variant-numeric : tabular-nums }
input [ type = text ], select , input [ type = number ] { background : var ( -- bg ); border : 1 px solid var ( -- line ); border-radius : 9 px ; padding : 7 px 9 px ; outline : none ; min-width : 0 }
input : focus , select : focus { border-color : var ( -- accent )}
. answer { background : var ( -- bg ); border : 1 px solid var ( -- line ); border-radius : 9 px ; padding : 8 px 10 px ; font-size : 12.5 px ; white-space : pre-wrap ; display : none ; max-height : 120 px ; overflow : auto }
. lbl { color : var ( -- muted ); font-size : 12 px ; min-width : 46 px }
. toggle { display : flex ; align-items : center ; gap : 6 px ; cursor : pointer ; color : var ( -- muted ); font-size : 12.5 px ; white-space : nowrap }
. toggle input { accent-color : var ( -- accent ); width : 15 px ; height : 15 px }
. pads { display : grid ; grid-template-columns : 1 fr 1 fr ; gap : 14 px }
. padlbl { display : flex ; justify-content : space-between ; font-size : 12 px ; color : var ( -- muted ); margin-bottom : 6 px }
. pad { display : grid ; grid-template-columns : repeat ( 3 , 1 fr ); gap : 5 px }
. pad . btn { height : 38 px ; padding : 0 ; font-size : 15 px ; display : grid ; place-items : center }
. pad . c { font-size : 13 px }
. field { display : flex ; gap : 6 px ; margin-bottom : 8 px }
. field input { flex : 1 ; min-width : 0 }
. field . btn { width : 52 px ; padding : 0 ; display : grid ; place-items : center ; font-size : 12.5 px }
. right . note { margin-top : 2 px }
. right > . card { flex : none }
. right . box { padding : 11 px 13 px }
. right . box h3 { margin-bottom : 8 px }
. pad . btn { height : 34 px }
. dd { position : relative ; flex : 1 ; min-width : 0 }
. dd-btn { width : 100 % ; display : flex ; align-items : center ; gap : 8 px ; background : var ( -- bg ); border : 1 px solid var ( -- line ); border-radius : 9 px ; padding : 8 px 11 px ; cursor : pointer ; text-align : left }
. dd-btn : hover , . dd . open . dd-btn { border-color : var ( -- accent )}
. dd-val { flex : 1 ; white-space : nowrap ; overflow : hidden ; text-overflow : ellipsis }
. dd-val . ph { color : var ( -- muted )}
. chev { color : var ( -- muted ); transition : transform .15 s ; font-size : 11 px }. dd . open . chev { transform : rotate ( 180 deg )}
. dd-menu { display : none ; position : fixed ; z-index : 80 ; background : #141c26 ; border : 1 px solid #2b3a4e ; border-radius : 12 px ; padding : 6 px ; max-height : 340 px ; overflow : auto ; box-shadow : 0 18 px 40 px rgba ( 0 , 0 , 0 , .6 ); scrollbar-width : thin ; scrollbar-color : #2b3a4e transparent }
. dd-menu :: -webkit-scrollbar { width : 6 px }. dd-menu :: -webkit-scrollbar-thumb { background : #2b3a4e ; border-radius : 3 px }. dd-menu :: -webkit-scrollbar-track { background : transparent }
. dd-menu . open { display : block ; animation : in .12 s }
. dd-item { display : flex ; align-items : center ; gap : 10 px ; padding : 9 px 11 px ; border-radius : 8 px ; cursor : pointer ; font-size : 14 px }
. dd-item : hover { background : rgba ( 56 , 189 , 248 , .12 )}
. dd-item . sel { background : rgba ( 56 , 189 , 248 , .2 ); color : #fff }
. dd-item . ic { width : 8 px ; height : 8 px ; border-radius : 50 % ; background : #f59e0b ; flex : none }
. dd-item . dock . ic { background : var ( -- ok )}
. dd-item . ck { margin-left : auto ; color : var ( -- accent ); visibility : hidden }. dd-item . sel . ck { visibility : visible }
. dd-head { display : flex ; justify-content : space-between ; align-items : center ; padding : 6 px 10 px 8 px ; font-size : 11.5 px ; color : var ( -- muted )}
. dd-head a { color : var ( -- accent ); text-decoration : none }
. dd-item . no { margin-left : auto ; min-width : 20 px ; height : 20 px ; border-radius : 10 px ; background : var ( -- accent ); color : #04111b ; font-size : 11.5 px ; font-weight : 700 ; display : none ; place-items : center }
. dd-item . sel . no { display : grid }
. dd-sep { height : 1 px ; background : var ( -- line ); margin : 4 px 2 px }
. opts { display : flex ; gap : 12 px ; flex-wrap : wrap ; margin-bottom : 8 px }. opts . toggle { font-size : 12 px }
. mode { display : flex ; align-items : center ; gap : 12 px ; padding : 9 px 11 px ; border : 1 px solid var ( -- line ); border-radius : 10 px ; background : var ( -- panel2 ); margin-bottom : 7 px ; cursor : pointer ; transition : border-color .15 s , background .15 s }
. mode : hover { border-color : #34465c }
. mode . on { border-color : rgba ( 34 , 197 , 94 , .55 ); background : rgba ( 34 , 197 , 94 , .08 )}
. mode . txt { flex : 1 ; min-width : 0 }. mode b { display : block ; font-size : 13.5 px ; font-weight : 650 }
. mode small { display : block ; color : var ( -- muted ); font-size : 11.5 px ; line-height : 1.3 ; margin-top : 1 px }
. switch { width : 38 px ; height : 22 px ; border-radius : 11 px ; background : #2a3646 ; position : relative ; flex : none ; transition : background .15 s }
. switch :: after { content : "" ; position : absolute ; top : 3 px ; left : 3 px ; width : 16 px ; height : 16 px ; border-radius : 50 % ; background : #cbd5e1 ; transition : left .15 s }
. mode . on . switch { background : var ( -- ok )}. mode . on . switch :: after { left : 19 px ; background : #fff }
. mode . busy { opacity : .6 ; pointer-events : none }
. statgrid { display : grid ; grid-template-columns : auto 1 fr ; gap : 6 px 14 px ; font-size : 13 px ; margin-bottom : 12 px }
. statgrid span { color : var ( -- muted )}
. errs { background : rgba ( 239 , 68 , 68 , .07 ); border : 1 px solid rgba ( 239 , 68 , 68 , .35 ); border-radius : 9 px ; padding : 8 px 10 px ; font : 12 px / 1.5 ui-monospace , Menlo , monospace ; color : #fca5a5 ; white-space : pre-wrap ; max-height : 140 px ; overflow : auto ; margin-bottom : 12 px }
. log . e { color : #fca5a5 }. log . w { color : #fcd34d }. log . g { color : #86efac }
. calib { display : flex ; align-items : center ; gap : 12 px ; margin : 10 px 0 }
. calib . big { font-size : 26 px ; font-weight : 700 ; font-variant-numeric : tabular-nums }
/* settings drawer */
. shade { position : fixed ; inset : 0 ; background : rgba ( 0 , 0 , 0 , .5 ); z-index : 40 ; display : none }
. drawer { position : fixed ; top : 0 ; right : 0 ; bottom : 0 ; width : min ( 560 px , 100 vw ); background : var ( -- panel ); border-left : 1 px solid var ( -- line ); z-index : 41 ; transform : translateX ( 100 % ); transition : transform .22 s ease ; display : flex ; flex-direction : column }
. drawer . open { transform : none }. shade . open { display : block }
/* notifications: errors land here instead of piling up on the screen */
. hbtn . alert { border-color : var ( -- bad )}
. badge { display : inline-block ; min-width : 18 px ; padding : 0 5 px ; margin-left : 4 px ; border-radius : 999 px ; background : var ( -- bad ); color : #fff ; font-size : 11 px ; font-weight : 700 ; line-height : 18 px ; text-align : center }
. badge : empty { display : none }
. notes { list-style : none ; margin : 0 ; padding : 12 px 16 px ; overflow : auto ; flex : 1 ; display : flex ; flex-direction : column ; gap : 8 px }
. notes li { background : var ( -- panel2 ); border : 1 px solid var ( -- line ); border-left : 4 px solid var ( -- bad ); border-radius : 10 px ; padding : 8 px 12 px ; word-break : break-word }
. notes . when { display : block ; font-size : 11.5 px ; color : var ( -- muted ); margin-bottom : 2 px }
. dh { display : flex ; align-items : center ; gap : 10 px ; padding : 14 px 16 px ; border-bottom : 1 px solid var ( -- line )}
. dh h2 { margin : 0 ; font-size : 16 px ; flex : 1 }
. tabs { display : flex ; gap : 4 px ; padding : 10 px 12 px 0 ; border-bottom : 1 px solid var ( -- line ); overflow-x : auto }
. tab { background : none ; border : 0 ; border-bottom : 2 px solid transparent ; padding : 8 px 11 px ; cursor : pointer ; color : var ( -- muted ); white-space : nowrap }
. tab . on { color : var ( -- text ); border-bottom-color : var ( -- accent )}
. pane { display : none ; padding : 16 px ; overflow : auto ; flex : 1 }. pane . on { display : block }
. sec { margin-bottom : 18 px }. sec h4 { margin : 0 0 10 px ; font-size : 12 px ; text-transform : uppercase ; letter-spacing : .8 px ; color : var ( -- muted )}
input [ type = color ] { width : 30 px ; height : 28 px ; border : 1 px solid var ( -- line ); border-radius : 8 px ; background : none ; padding : 2 px ; cursor : pointer }
. jrow { display : grid ; grid-template-columns : 34 px 1 fr 44 px 44 px ; gap : 7 px ; align-items : center ; margin-bottom : 7 px }
. jrow . v { font-variant-numeric : tabular-nums ; background : var ( -- bg ); border : 1 px solid var ( -- line ); border-radius : 8 px ; padding : 6 px 9 px }
. maplist { display : flex ; flex-direction : column ; gap : 6 px }
. mapitem { display : flex ; align-items : center ; gap : 8 px ; background : var ( -- panel2 ); border : 1 px solid var ( -- line ); border-radius : 9 px ; padding : 7 px 10 px }
. mapitem . cur { border-color : var ( -- ok )}
. mapitem span { flex : 1 }
. log { background : #04060a ; border : 1 px solid var ( -- line ); border-radius : 9 px ; padding : 9 px 11 px ; height : calc ( 100 vh - 430 px ); min-height : 220 px ; overflow : auto ; font : 12 px / 1.5 ui-monospace , SFMono-Regular , Menlo , monospace ; color : #b7c3d0 ; white-space : pre-wrap }
. note { font-size : 12 px ; color : var ( -- muted ); margin-top : 6 px }
# toasts { position : fixed ; left : 50 % ; transform : translateX ( -50 % ); bottom : 16 px ; display : flex ; flex-direction : column ; gap : 8 px ; z-index : 60 ; max-width : min ( 460 px , calc ( 100 vw - 32 px ))}
. toast { background : var ( -- panel2 ); border : 1 px solid var ( -- line ); border-left : 4 px solid var ( -- accent ); border-radius : 10 px ; padding : 9 px 14 px ; box-shadow : 0 8 px 24 px rgba ( 0 , 0 , 0 , .45 ); animation : in .2 s }
. toast . err { border-left-color : var ( -- bad )}. toast . ok { border-left-color : var ( -- ok )}
@ keyframes in { from { transform : translateY ( 8 px ); opacity : 0 }}
/* command dialog */
. modal { position : fixed ; inset : 0 ; z-index : 45 ; background : rgba ( 0 , 0 , 0 , .55 ); display : none ; place-items : center ; padding : 16 px }
. modal . open { display : grid }
. dialog { background : var ( -- panel ); border : 1 px solid var ( -- line ); border-radius : var ( -- r ); width : min ( 580 px , 100 % ); max-height : calc ( 100 vh - 32 px ); display : flex ; flex-direction : column ; box-shadow : 0 18 px 50 px rgba ( 0 , 0 , 0 , .6 ); animation : in .15 s }
. dialog . pane { display : block }
. dialog . sec { margin-bottom : 14 px }
. seg { display : flex ; border : 1 px solid var ( -- line ); border-radius : 9 px ; overflow : hidden ; margin-bottom : 8 px }
. seg button { flex : 1 ; background : var ( -- panel2 ); border : 0 ; border-left : 1 px solid var ( -- line ); padding : 7 px 6 px ; cursor : pointer ; color : var ( -- muted ); white-space : nowrap }
. seg button : first-child { border-left : 0 }. seg button . on { background : rgba ( 56 , 189 , 248 , .18 ); color : var ( -- text )}
. pick { position : relative ; height : 240 px ; background : #0d131a ; border : 1 px solid var ( -- line ); border-radius : 9 px ; overflow : hidden }
. pick canvas { width : 100 % ; height : 100 % ; display : block ; cursor : crosshair ; touch-action : none }
. pick . zoom { position : absolute ; right : 8 px ; top : 8 px ; display : flex ; flex-direction : column ; gap : 4 px }
. pick . zoom button { width : 30 px ; height : 30 px ; border-radius : 8 px ; border : 1 px solid var ( -- line ); background : var ( -- panel2 ); color : var ( -- text ); cursor : pointer ; font-size : 16 px }
# tText { width : 100 % ; min-height : 64 px ; resize : vertical ; background : var ( -- bg ); color : var ( -- text ); border : 1 px solid var ( -- line ); border-radius : 9 px ; padding : 9 px 11 px ; font : inherit }
. sentence { background : var ( -- bg ); border : 1 px solid var ( -- line ); border-radius : 9 px ; padding : 9 px 11 px ; margin-bottom : 8 px ; min-height : 38 px }
. probs { color : #fca5a5 ; font-size : 12.5 px ; margin-bottom : 8 px }
. steps { margin : 0 0 8 px ; padding-left : 22 px }. steps li { padding : 2 px 0 }. steps li span { margin-right : 6 px }. steps li . icon { padding : 0 6 px ; font-size : 12 px }
. full { position : fixed !important ; inset : 0 ; z-index : 50 ; max-height : none !important ; aspect-ratio : auto !important ; background : #000 }
@ media ( max-width : 1100px ) {
body { overflow : auto } main { height : auto ; grid-template-columns : 1 fr }. left { grid-template-rows : auto 420 px }. right { overflow : visible }
. pills . pill : nth-child ( n + 4 ) { display : none }
}
@ media ( max-width : 640px ) {. cams { grid-template-columns : 1 fr } main { padding : 10 px 16 px } header { padding : 0 10 px }. brand span { display : none }}
</ style >
</ head >
< body >
< header >
< div class = "brand" >< div class = "logo" > 🤖</ div >< span > Lumi Control</ span ></ div >
< div class = "pills" >
< span class = "pill" >< span class = "dot" id = "conn" ></ span >< b id = "connTxt" > connecting…</ b ></ span >
< span class = "pill" >< span class = "bat" >< i id = "batBar" style = "width:0" ></ i ></ span >< b id = "bat" > – </ b >< span id = "chg" ></ span ></ span >
< span class = "pill" > Base < b id = "base" > – </ b ></ span >
< span class = "pill" > Arm < b id = "armSt" > – </ b ></ span >
< span class = "pill" >< span class = "dot" id = "asDot" ></ span > Assistant < b id = "asSt" > – </ b ></ span >
< span class = "pill" > Map < b id = "mapName" > – </ b ></ span >
</ div >
< button class = "hbtn" id = "openCmd" title = "Fetch an object: from where, to where" > ➜ Command</ button >
< button class = "hbtn" id = "openNotes" title = "Notifications" > 🔔< span class = "badge" id = "noteCount" ></ span ></ button >
< button class = "hbtn" id = "openSettings" > ⚙ Settings</ button >
< button class = "stop" id = "stopAll" title = "Stop driving, arm, body and the assistant" > ■ STOP</ button >
</ header >
< main >
< div class = "left" >
< div class = "cams" id = "cams" ></ div >
< div class = "card mapcard" >
< div class = "ch" >< h2 > Map</ h2 >< span class = "tag" id = "mapTag" > – </ span >< span class = "sp" ></ span >
< span class = "muted" style = "font-size:12px" > scroll = zoom · drag = move</ span >< label class = "toggle" title = "Click on the map to send the robot there" >< input type = "checkbox" id = "clickGo" > Click to drive</ label >
< button class = "icon" id = "mapFit" > Fit</ button ></ div >
< div class = "mapwrap" >< canvas id = "map" ></ canvas >
< div class = "legend" >< span >< i style = "background:var(--accent)" ></ i > Lumi</ span >< span >< i style = "background:#f59e0b" ></ i > Marker (arrow = facing)</ span >< span >< i style = "background:var(--ok)" ></ i > Dock</ span ></ div ></ div >
</ div >
</ div >
< div class = "right" >
< div class = "card box" >
< h3 > Move</ h3 >
< div class = "pads" >
< div >< div class = "padlbl" > Base < span class = "muted" id = "driveSpeedV" > 50 %</ span ></ div >
< div class = "pad" >
< span ></ span >< button class = "btn hold" data-axis = "base_drive" data-dir = "1" title = "Forward (W / ↑)" > ▲</ button >< span ></ span >
< button class = "btn hold" data-axis = "base_turn" data-dir = "1" title = "Turn left (A / ←)" > ↺</ button >
< button class = "btn danger c" id = "driveStop" title = "Stop the base" > ■</ button >
< button class = "btn hold" data-axis = "base_turn" data-dir = "-1" title = "Turn right (D / →)" > ↻</ button >
< span ></ span >< button class = "btn hold" data-axis = "base_drive" data-dir = "-1" title = "Back (S / ↓)" > ▼</ button >< span ></ span >
</ div ></ div >
< div >< div class = "padlbl" > Head < span class = "muted" id = "headSt" ></ span ></ div >
< div class = "pad" >
< span ></ span >< button class = "btn hold" data-axis = "head_pitch" data-dir = "1" title = "Look up" > ▲</ button >< span ></ span >
< button class = "btn hold" data-axis = "head_yaw" data-dir = "1" title = "Look left" > ◀</ button >
< button class = "btn c" id = "headCentre" title = "Look straight ahead" > ●</ button >
< button class = "btn hold" data-axis = "head_yaw" data-dir = "-1" title = "Look right" > ▶</ button >
< span ></ span >< button class = "btn hold" data-axis = "head_pitch" data-dir = "-1" title = "Look down" > ▼</ button >< span ></ span >
</ div ></ div >
</ div >
< div class = "row" style = "margin-top:9px" title = "Hold a button to move, release to stop · keys W A S D" >< span class = "lbl" > Speed</ span >< input type = "range" id = "driveSpeed" min = "10" max = "100" step = "10" value = "50" ></ div >
</ div >
< div class = "card box" >
< h3 > Go to</ h3 >
< div class = "row" >< div class = "dd" id = "destDD" ></ div >< button class = "btn primary" id = "goBtn" > Go ➜</ button ></ div >
< div class = "row" >< button class = "btn grow" id = "dockBtn" > ⌂ Dock</ button >< button class = "btn danger grow" id = "cancelBtn" > Cancel drive</ button ></ div >
</ div >
< div class = "card box" >
2026-10-21 18:52:34 +09:00
< h3 > Arm</ h3 >
2026-10-21 17:48:11 +09:00
< div class = "row" >< select id = "poseSel" class = "grow" ></ select >< select id = "poseSpeed" >< option value = "slow" > Slow</ option >< option value = "normal" > Normal</ option >< option value = "route" > Fast</ option ></ select >
2026-10-21 15:19:07 +09:00
< button class = "btn primary" id = "poseGo" > Move ➜</ button ></ div >
2026-10-21 18:52:34 +09:00
< div class = "row" >< button class = "btn grow" id = "waveBtn" > Wave</ button ></ div >
2026-10-21 15:19:07 +09:00
</ div >
< div class = "card box" >
< h3 > Quick actions</ h3 >
< div class = "field" >< input type = "text" id = "sayText" placeholder = "Say something (EN / 한국어)" >< button class = "btn" id = "sayBtn" title = "Say it aloud" > Say</ button ></ div >
< div class = "field" >< input type = "text" id = "askText" placeholder = "Ask Lumi a question" >< button class = "btn" id = "askBtn" title = "Ask Lumi" > Ask</ button ></ div >
< div class = "answer" id = "answer" ></ div >
< div class = "row" style = "margin-top:4px" >< span class = "lbl" > Volume</ span >< input type = "range" id = "vol" min = "0" max = "100" step = "5" >< span class = "val" id = "volV" > – </ span ></ div >
</ div >
< div class = "card box" >
< h3 > Assistant < span class = "tag" id = "asTag" > off</ span ></ h3 >
< div class = "mode" id = "modeGreeter" data-mode = "greeter" >< div class = "txt" >< b > Greeter</ b >
< small > Standing: greets people who come close, talks, answers "Hi Lumi"</ small ></ div >< div class = "switch" ></ div ></ div >
< div class = "mode" id = "modePatrol" data-mode = "patrol" >< div class = "txt" >< b > Patrol</ b >
< small > Driving: stops for people on the way, talks, then drives on</ small ></ div >< div class = "switch" ></ div ></ div >
< div class = "opts" style = "margin:8px 0 0" >< label class = "toggle" >< input type = "checkbox" id = "useArm" checked > Wave when asked</ label >
< label class = "toggle" >< input type = "checkbox" id = "useDrive" checked > Come when called</ label ></ div >
</ div >
</ div >
</ main >
< div class = "shade" id = "shade" ></ div >
< aside class = "drawer" id = "notesDrawer" >
< div class = "dh" >< h2 > Notifications</ h2 >< button class = "icon" id = "clearNotes" > Clear</ button >< button class = "icon" id = "closeNotes" > ✕</ button ></ div >
< ul class = "notes" id = "notes" ></ ul >
</ aside >
< aside class = "drawer" id = "drawer" >
< div class = "dh" >< h2 > Settings</ h2 >< button class = "icon" id = "closeSettings" > ✕</ button ></ div >
< div class = "tabs" id = "tabs" >
< button class = "tab on" data-tab = "body" > Body</ button >
< button class = "tab" data-tab = "arm" > Arm</ button >< button class = "tab" data-tab = "maps" > Maps</ button >
< button class = "tab" data-tab = "voice" > Voice</ button >< button class = "tab" data-tab = "logs" > Logs</ button >
</ div >
< div class = "pane on" id = "pane-body" >
< div class = "sec" >< h4 > Lift < span id = "liftV" class = "muted" ></ span ></ h4 >
< div class = "row" >< button class = "btn hold grow" data-axis = "lift" data-dir = "-1" > ▼ Down</ button >< button class = "btn hold grow" data-axis = "lift" data-dir = "1" > ▲ Up</ button ></ div ></ div >
< div class = "sec" >< h4 > Waist < span id = "waistV" class = "muted" ></ span ></ h4 >
< div class = "row" >< button class = "btn hold grow" data-axis = "waist" data-dir = "1" > ⟲ Left</ button >< button class = "btn hold grow" data-axis = "waist" data-dir = "-1" > Right ⟳</ button ></ div >
< div class = "note" > Hold to move, release to stop. Waist is limited to ±90°; watch the arm.</ div ></ div >
< div class = "sec" >< h4 > Speed</ h4 >< div class = "row" >< input type = "range" id = "bodySpeed" min = "10" max = "100" step = "10" value = "50" >< span class = "val" id = "bodySpeedV" > 50 %</ span ></ div ></ div >
</ div >
< div class = "pane" id = "pane-arm" >
< div class = "sec" >< h4 > State</ h4 >
< div class = "row" >< span class = "tag" id = "armPow" > power – </ span >< span class = "tag" id = "armEn" > enable – </ span >< span class = "tag" id = "armProg" > – </ span ></ div >
< div class = "row" >< button class = "btn grow" id = "armPowerOn" > Power on</ button >< button class = "btn grow" id = "armEnable" > Enable</ button >
< button class = "btn danger grow" id = "armDisable" > Disable</ button ></ div ></ div >
< div class = "sec" >< h4 > Joints (hold − / +)</ h4 >< div id = "joints" ></ div >
< div class = "row" >< span class = "lbl" > Speed</ span >< input type = "range" id = "armSpeed" min = "10" max = "100" step = "10" value = "40" >< span class = "val" id = "armSpeedV" > 40 %</ span ></ div >
< div class = "note" id = "tcp" ></ div ></ div >
< div class = "sec" >< h4 > Programs</ h4 >
2026-10-21 16:54:22 +09:00
< div class = "row" >< input type = "text" id = "prog" class = "grow" value = "arm_reach.jks" >< button class = "btn primary" id = "progRun" > Run</ button >< button class = "btn danger" id = "progStop" > Stop</ button ></ div ></ div >
2026-10-21 15:19:07 +09:00
< div class = "sec" >< h4 > Gripper</ h4 >
< div class = "row" >< span class = "tag" id = "gripSt" > – </ span >< span class = "tag" id = "gripEye" > sensor – </ span ></ div >
< div class = "row" >< button class = "btn grow" id = "gripOpen" > Open</ button >< button class = "btn grow" id = "gripClose" > Close</ button ></ div >
< div class = "note" > Keep hands away from the fingers.</ div ></ div >
</ div >
< div class = "pane" id = "pane-maps" >
< div class = "sec" >< h4 > Maps on the base</ h4 >< div class = "maplist" id = "maplist" ></ div >
< div class = "note" > Switching restarts the base service. Afterwards check the robot's place on the map (AGV panel :9001 → set position).</ div ></ div >
</ div >
< div class = "pane" id = "pane-voice" >
< div class = "sec" >< h4 > Who is speaking (voice direction)</ h4 >
< div class = "note" style = "margin-bottom:10px" > The six microphones in the head hear where a voice comes from. To match that with the
cameras, calibrate once: press Start, then stand < b > alone, 1– 1.5 m in front</ b > of the robot and talk for a few
seconds; step about 1 m to the left and talk again, then to the right. 6– 8 samples are enough.</ div >
< div class = "calib" >< div class = "big" id = "calN" > 0</ div >< div >< div id = "calState" class = "muted" > idle</ div >< div id = "calRes" class = "muted" ></ div ></ div ></ div >
< div class = "row" >< button class = "btn primary grow" id = "calStart" > Start calibration</ button >< button class = "btn grow" id = "calStop" > Stop</ button >
< button class = "btn danger" id = "calReset" > Reset</ button ></ div ></ div >
< div class = "sec" >< h4 > Patrol</ h4 >
< div class = "row" >< label class = "toggle" > Wait at each marker < input type = "number" id = "pause" value = "1" min = "0" max = "60" style = "width:64px" > s</ label ></ div ></ div >
</ div >
< div class = "pane" id = "pane-logs" >
< div class = "statgrid" id = "stat" ></ div >
< div id = "errBox" ></ div >
< div class = "row" style = "margin-bottom:6px" >< select id = "logSrc" class = "grow" >< option value = "robot" > Robot log: tasks, arm, base, errors</ option >
< option value = "assistant" > Assistant log: voice, people</ option ></ select >
< label class = "toggle" >< input type = "checkbox" id = "logAll" > camera lines</ label ></ div >
< div class = "log" id = "log" > …</ div >
</ div >
</ aside >
< div class = "modal" id = "cmdModal" >
< div class = "dialog" role = "dialog" aria-modal = "true" aria-labelledby = "cmdTitle" >
< div class = "dh" >< h2 id = "cmdTitle" > Command</ h2 >< button class = "icon" id = "closeCmd" > ✕</ button ></ div >
< div class = "pane" >
< div class = "sec" >
< textarea id = "tText" placeholder = "Write command" ></ textarea ></ div >
< div class = "sentence" id = "tSentence" > – </ div >
< ol class = "steps" id = "tSteps" style = "display:none" ></ ol >
< div class = "probs" id = "tProblems" ></ div >
< div id = "tWhere" >
< div class = "sec" id = "tSrcSec" >< h4 > From</ h4 >
< div class = "seg" id = "tSrcSeg" >< button data-v = "here" class = "on" > Here</ button >< button data-v = "marker" > Marker</ button >< button data-v = "point" > Point on map</ button ></ div >
< div class = "row" id = "tSrcMarkerRow" style = "display:none" >< select id = "tSrcMarker" class = "grow" ></ select ></ div >
< div id = "tSrcPickBox" style = "display:none" >< div class = "pick" id = "tSrcPick" >< canvas ></ canvas >< div class = "zoom" >< button data-z = "1.4" > +</ button >< button data-z = "0.714" > − </ button ></ div ></ div >< div class = "note" id = "tSrcPt" ></ div ></ div ></ div >
< div class = "sec" >< h4 > To</ h4 >
< div class = "seg" id = "tDstSeg" >< button data-v = "here" class = "on" > Here</ button >< button data-v = "marker" > Marker</ button >< button data-v = "point" > Point on map</ button ></ div >
< div class = "row" id = "tDstMarkerRow" style = "display:none" >< select id = "tDstMarker" class = "grow" ></ select ></ div >
< div id = "tDstPickBox" style = "display:none" >< div class = "pick" id = "tDstPick" >< canvas ></ canvas >< div class = "zoom" >< button data-z = "1.4" > +</ button >< button data-z = "0.714" > − </ button ></ div ></ div >< div class = "note" id = "tDstPt" ></ div ></ div ></ div >
</ div >
< div class = "row" >< button class = "btn primary grow" id = "tStart" > Start</ button >< button class = "btn grow" id = "tRelease" style = "display:none" > Release</ button >< button class = "btn grow" id = "tPause" style = "display:none" > Pause</ button >< button class = "btn danger grow" id = "tStop" > Stop</ button ></ div >
< div class = "sec" style = "margin:12px 0 0" >< div class = "row" style = "margin:0" >< h4 style = "margin:0" > Task</ h4 >< span class = "tag" id = "tSt" > – </ span ></ div >
< div class = "note" id = "tLog" style = "white-space:pre-wrap" ></ div ></ div >
</ div >
</ div >
</ div >
< div id = "toasts" ></ div >
< script >
const $ = id => document . getElementById ( id );
let status = null , mapInfo = null ;
2026-10-21 18:52:34 +09:00
const MAP_POLL_MS = 20000 ; // the marker list is read again this often
2026-10-21 15:19:07 +09:00
function toast ( msg , kind = "" ) {
if ( kind === "err" ) return note ( msg );
const t = document . createElement ( "div" ); t . className = "toast " + kind ; t . textContent = msg ;
$ ( "toasts" ). appendChild ( t ); setTimeout (() => t . remove (), kind === "err" ? 6000 : 2800 );
}
async function api ( path , body ) {
const r = await fetch ( path , { method : body === undefined ? "GET" : "POST" , headers : { "Content-Type" : "application/json" },
body : body === undefined ? undefined : JSON . stringify ( body )});
let d = null ; try { d = await r . json (); } catch ( e ) {}
if ( ! r . ok ) { let m = d && d . detail ; if ( Array . isArray ( m )) m = m . map ( x => x . msg ). join ( "; " ); throw new Error ( m || r . statusText ); }
return d ;
}
async function act ( btn , ok , fn ) {
const old = btn && btn . innerHTML ; if ( btn ) { btn . disabled = true ; btn . textContent = "…" ; }
try { const r = await fn (); if ( ok ) toast ( ok , "ok" ); return r ; } catch ( e ) { toast ( e . message , "err" ); }
finally { if ( btn ) { btn . disabled = false ; btn . innerHTML = old ; } refreshStatus (); }
}
const fmt = ( v , d = 0 ) => v === undefined || v === null ? "– " : ( + v ). toFixed ( d );
/* ---------- cameras ---------- */
for ( const [ name , title ] of [[ "head" , "Head camera" ], [ "torso" , "Torso camera" ]]) {
$ ( "cams" ). insertAdjacentHTML ( "beforeend" , `<div class="card">
<div class="ch"><h2> ${ title } </h2><span class="tag" id=" ${ name } Tag">– </span><span class="sp"></span>
<a class="icon" href="/camera/ ${ name } .jpg" target="_blank" title="Photo">⤓</a><button class="icon" data-full=" ${ name } " title="Full screen">⛶</button></div>
<div class="frame" id=" ${ name } Frame"><canvas id=" ${ name } Img"></canvas><div class="empty" id=" ${ name } Empty">Waiting for the camera…</div>
<span class="count" id=" ${ name } Count" hidden></span></div>
<div class="people" id=" ${ name } People"></div></div>` );
}
/* live video: ONE streamed connection carries both cameras' JPEGs (full rate) and their detections;
the boxes are drawn here on top of the video, so detection speed does not slow the video down */
const CAMS = [ "head" , "torso" ], dets = { head : null , torso : null }, lastFrame = { head : 0 , torso : 0 };
function hexToRgb ( h ) { const n = parseInt (( h || "#22c55e" ). slice ( 1 ), 16 ); return [ n >> 16 , ( n >> 8 ) & 255 , n & 255 ]; }
function drawFrame ( name , bmp ) {
const cv = $ ( name + "Img" ), g = cv . getContext ( "2d" );
if ( cv . width !== bmp . width ) { cv . width = bmp . width ; cv . height = bmp . height ; }
g . drawImage ( bmp , 0 , 0 ); bmp . close && bmp . close ();
lastFrame [ name ] = Date . now ();
const d = dets [ name ], set = viewSet || {};
if ( ! d || Date . now () - d . time > 1500 ) return ;
const sx = cv . width / d . w , sy = cv . height / d . h , base = set . box_color || "#22c55e" ;
g . font = `600 ${ Math . round ( cv . height / 24 ) } px system-ui` ; g . textBaseline = "bottom" ;
for ( const o of d . objects || []) { // cups, bottles... (torso camera, objects.py)
const [ x1 , y1 , x2 , y2 ] = o . box ;
g . strokeStyle = "#f59e0b" ; g . lineWidth = 2 * cv . width / 640 ;
g . strokeRect ( x1 * sx , y1 * sy , ( x2 - x1 ) * sx , ( y2 - y1 ) * sy );
if ( set . labels !== false ) {
const t = ` ${ o . colour || "" } ${ o . name } ` + ( o . width_mm != null ? ` ${ o . width_mm } mm` : "" );
const w = g . measureText ( t ). width + 14 , h = cv . height / 19 , y = Math . max ( h , y1 * sy );
g . fillStyle = "#f59e0b" ; g . fillRect ( x1 * sx , y - h , w , h );
g . fillStyle = "#111" ; g . fillText ( t , x1 * sx + 6 , y - h * 0.18 );
}
}
for ( const p of d . people ) {
const [ x1 , y1 , x2 , y2 ] = p . box , red = p . focus || p . near , col = red ? "#ef4444" : base ;
if ( set . boxes !== false ) {
g . strokeStyle = col ; g . lineWidth = ( set . thickness || 2 ) * cv . width / 640 + ( red ? 1 : 0 );
g . strokeRect ( x1 * sx , y1 * sy , ( x2 - x1 ) * sx , ( y2 - y1 ) * sy );
}
if ( set . labels !== false ) {
const t = ( p . focus ? "TALKING " : "" ) + ` ${ p . distance_m ?? "?" } m ${ p . angle_deg > 0 ? "+" : "" }${ Math . round ( p . angle_deg ) } °` ;
const w = g . measureText ( t ). width + 14 , h = cv . height / 19 , y = Math . max ( h , y1 * sy );
g . fillStyle = col ; g . fillRect ( x1 * sx , y - h , w , h );
g . fillStyle = "#111" ; g . fillText ( t , x1 * sx + 6 , y - h * 0.18 );
}
}
}
async function liveStream () {
try {
const r = await fetch ( "/camera/stream?max_fps=15" , { cache : "no-store" });
if ( ! r . ok || ! r . body ) throw new Error ( "no stream" );
const reader = r . body . getReader ();
let buf = new Uint8Array ( 0 );
for (;;) {
const { value , done } = await reader . read ();
if ( done ) break ;
const nb = new Uint8Array ( buf . length + value . length ); nb . set ( buf ); nb . set ( value , buf . length ); buf = nb ;
while ( buf . length >= 6 ) {
const len = ( buf [ 2 ] << 24 | buf [ 3 ] << 16 | buf [ 4 ] << 8 | buf [ 5 ]) >>> 0 ;
if ( buf . length < 6 + len ) break ;
const name = CAMS [ buf [ 0 ]], kind = buf [ 1 ], payload = buf . slice ( 6 , 6 + len );
buf = buf . slice ( 6 + len );
if ( kind === 1 ) { try { dets [ name ] = {... JSON . parse ( new TextDecoder (). decode ( payload )), time : Date . now ()}; } catch ( e ) {} }
else if ( ! document . hidden ) createImageBitmap ( new Blob ([ payload ], { type : "image/jpeg" })). then ( b => drawFrame ( name , b )). catch (() => {});
}
}
} catch ( e ) {}
CAMS . forEach ( n => { if ( Date . now () - lastFrame [ n ] > 3000 ) pollPicture ( n , true ); }); // fallback while reconnecting
setTimeout ( liveStream , 1500 );
}
function pollPicture ( name , once ) { // fallback: the annotated picture, when the stream is down
const img = new Image ();
img . onload = () => {
const cv = $ ( name + "Img" ), g = cv . getContext ( "2d" );
if ( cv . width !== img . width ) { cv . width = img . width ; cv . height = img . height ; }
g . drawImage ( img , 0 , 0 );
};
img . src = `/camera/ ${ name } /latest.jpg?t= ${ Date . now () } ` ;
}
liveStream ();
document . addEventListener ( "click" , e => {
const f = e . target . closest ( "[data-full]" );
if ( f ) { $ ( f . dataset . full + "Frame" ). classList . toggle ( "full" ); return ; }
const fr = e . target . closest ( ".frame.full" ); if ( fr ) fr . classList . remove ( "full" );
});
async function refreshCams () {
for ( const name of [ "head" , "torso" ]) {
try {
const j = await api ( `/camera/ ${ name } /info` ), live = j . age_s !== null && j . age_s < 2 ;
const tag = $ ( name + "Tag" );
tag . className = "tag " + ( live ? "live" : "" );
tag . textContent = live ? "● live" : ( j . error || "offline" );
tag . title = live ? "picture from " + j . source : "" ;
const em = $ ( name + "Empty" );
em . hidden = live ; em . textContent = j . age_s === null ? "Waiting for the camera…" : "Camera paused – starting again…" ;
$ ( name + "Img" ). style . opacity = live ? 1 : . 35 ;
const cnt = $ ( name + "Count" ); cnt . hidden = ! live ;
cnt . textContent = ` ${ j . people . length } ${ j . people . length === 1 ? "person" : "people" } ` ;
$ ( name + "People" ). innerHTML = ! live ? "" : j . people . length ? j . people . map ( p =>
`<span class="chip ${ p . focus ? "near" : "" } "> ${ p . focus ? "🗣 " : "" }${ p . distance_m ?? "?" } m · ${ p . angle_deg > 0 ? "+" : "" }${ p . angle_deg } °</span>` ). join ( "" )
: `<span class="muted">nobody in view</span>` ;
} catch ( e ) {}
}
}
setInterval ( refreshCams , 1000 ); refreshCams ();
/* ---------- status ---------- */
async function refreshStatus () {
try {
status = await api ( "/status" );
$ ( "conn" ). className = "dot ok" ; $ ( "connTxt" ). textContent = "online" ;
const b = status . base || {};
if ( ! b . error ) {
$ ( "bat" ). textContent = fmt ( b . power_percent ) + "%" ; $ ( "batBar" ). style . width = ( b . power_percent || 0 ) + "%" ;
$ ( "batBar" ). style . background = b . power_percent < 20 ? "var(--bad)" : b . power_percent < 40 ? "var(--warn)" : "var(--ok)" ;
$ ( "chg" ). textContent = b . charge_state ? "⚡" : "" ;
$ ( "base" ). textContent = b . estop_state ? "E-STOP" : b . running_status === "idle" ? "idle" : ` ${ b . move_status } → ${ b . move_target } ` ;
} else $ ( "base" ). textContent = "offline" ;
const a = status . arm || {};
$ ( "armSt" ). textContent = a . error ? "offline" : ! a . power ? "power off" : ! a . enable ? "disabled" : a . program ;
const as = status . assistant || {};
$ ( "asDot" ). className = "dot " + ( as . running ? "ok" : "" ); $ ( "asSt" ). textContent = as . running ? "running" : "stopped" ;
const bd = status . body || {};
if ( ! bd . error ) {
$ ( "headSt" ). textContent = ` ${ fmt ( bd . head_yaw_deg ) } ° · ${ fmt ( bd . head_pitch_deg ) } °` ;
$ ( "liftV" ). textContent = `· ${ fmt ( bd . lift_mm ) } mm` ; $ ( "waistV" ). textContent = `· ${ fmt ( bd . waist_deg ) } °` ;
}
drawMap ();
} catch ( e ) { $ ( "conn" ). className = "dot bad" ; $ ( "connTxt" ). textContent = "offline" ; }
}
setInterval ( refreshStatus , 1000 ); refreshStatus ();
/* ---------- hold-to-move ---------- */
const speedOf = axis => axis . startsWith ( "base" ) ? + $ ( "driveSpeed" ). value / 100 :
axis . startsWith ( "j" ) ? + $ ( "armSpeed" ). value / 100 : + $ ( "bodySpeed" ). value / 100 ;
let holding = null ;
function holdStart ( btn ) {
holdStop ( true );
const axis = btn . dataset . axis , dir = + btn . dataset . dir ;
btn . classList . add ( "on" );
const send = () => api ( "/jog" , { axis , direction : dir , speed : speedOf ( axis )}). then ( r => { if ( r . error ) toast ( r . error , "err" ); })
. catch ( e => { toast ( e . message , "err" ); holdStop (); });
send (); holding = { btn , timer : setInterval ( send , 150 )};
}
function holdStop ( silent ) {
if ( ! holding ) return ;
clearInterval ( holding . timer ); holding . btn . classList . remove ( "on" ); holding = null ;
if ( ! silent ) api ( "/jog/stop" , {}). catch (() => {});
}
document . addEventListener ( "pointerdown" , e => { const b = e . target . closest ( ".hold" ); if ( b ) { e . preventDefault (); b . setPointerCapture ( e . pointerId ); holdStart ( b ); } });
[ "pointerup" , "pointercancel" ]. forEach ( ev => document . addEventListener ( ev , () => holdStop ()));
window . addEventListener ( "blur" , () => holdStop ());
const KEYS = { ArrowUp : [ "base_drive" , 1 ], KeyW : [ "base_drive" , 1 ], ArrowDown : [ "base_drive" , - 1 ], KeyS : [ "base_drive" , - 1 ],
ArrowLeft : [ "base_turn" , 1 ], KeyA : [ "base_turn" , 1 ], ArrowRight : [ "base_turn" , - 1 ], KeyD : [ "base_turn" , - 1 ]};
let keyHeld = null ;
document . addEventListener ( "keydown" , e => {
if ( e . key === "Escape" ) { document . querySelectorAll ( ".full" ). forEach ( x => x . classList . remove ( "full" )); closeSettings (); closeNotes (); closeCmd (); }
if ( $ ( "cmdModal" ). classList . contains ( "open" )) return ; // no driving by keys while the dialog is open
if ( e . target . matches ( "input,select,textarea" ) || ! KEYS [ e . code ] || e . repeat ) return ;
e . preventDefault (); keyHeld = e . code ;
holdStart ( document . querySelector ( `.hold[data-axis=" ${ KEYS [ e . code ][ 0 ] } "][data-dir=" ${ KEYS [ e . code ][ 1 ] } "]` ));
});
document . addEventListener ( "keyup" , e => { if ( e . code === keyHeld ) { keyHeld = null ; holdStop (); } });
$ ( "driveStop" ). onclick = () => { holdStop (); api ( "/jog/stop" , {}); api ( "/agv/cancel" , {}). catch (() => {}); };
$ ( "driveSpeed" ). oninput = e => $ ( "driveSpeedV" ). textContent = e . target . value + " %" ;
$ ( "bodySpeed" ). oninput = e => $ ( "bodySpeedV" ). textContent = e . target . value + " %" ;
$ ( "armSpeed" ). oninput = e => $ ( "armSpeedV" ). textContent = e . target . value + " %" ;
$ ( "headCentre" ). onclick = e => act ( e . target , null , () => api ( "/head/turn" , { yaw : 0 , pitch : 0 }));
/* ---------- map ---------- */
const cv = $ ( "map" ), ctx = cv . getContext ( "2d" );
let mapLayer = null , view = null , drag = null ; // view: {s: screen px per map px, x0, y0: map px at the canvas corner}
2026-10-21 18:52:34 +09:00
function paintMarkers () {
$ ( "mapName" ). textContent = mapInfo . map_name ; $ ( "mapTag" ). textContent = mapInfo . map_name ;
markerNames = mapInfo . markers . filter ( m => m . name !== mapInfo . main_dock ). map ( m => m . name ) // further docks too
. sort (( x , y ) => x . localeCompare ( y , undefined , { numeric : true }));
destDD . setItems ( markerNames );
renderMapList ();
}
2026-10-21 15:19:07 +09:00
async function loadMap () {
try {
mapInfo = await api ( "/map/info" );
2026-10-21 18:52:34 +09:00
paintMarkers ();
2026-10-21 15:19:07 +09:00
const img = new Image ();
img . onload = () => { mapLayer = recolor ( img ); view = null ; drawMap (); };
img . src = "/map/image?t=" + Date . now ();
} catch ( e ) { $ ( "mapTag" ). textContent = "map offline" ; }
}
function recolor ( img ) { // walls light, free space dark, unknown transparent
const c = document . createElement ( "canvas" ); c . width = img . width ; c . height = img . height ;
const g = c . getContext ( "2d" ); g . drawImage ( img , 0 , 0 );
const im = g . getImageData ( 0 , 0 , img . width , img . height ), d = im . data ;
for ( let i = 0 ; i < d . length ; i += 4 ) {
const v = d [ i ];
if ( v < 100 ) { d [ i ] = 203 ; d [ i + 1 ] = 213 ; d [ i + 2 ] = 225 ; d [ i + 3 ] = 255 ; }
else if ( v > 240 ) { d [ i ] = 30 ; d [ i + 1 ] = 42 ; d [ i + 2 ] = 56 ; d [ i + 3 ] = 255 ; }
else d [ i + 3 ] = 0 ;
}
g . putImageData ( im , 0 , 0 ); return c ;
}
const pxOf = ( x , y ) => [( x - mapInfo . origin_x ) / mapInfo . resolution , mapInfo . height - ( y - mapInfo . origin_y ) / mapInfo . resolution ];
function fitView ( c ) { // frame the markers and the robot with 2.5 m around them
const r = c . getBoundingClientRect (), pts = mapInfo . markers . map ( m => pxOf ( m . x , m . y ));
const p = status && status . base && status . base . current_pose ; if ( p ) pts . push ( pxOf ( p . x , p . y ));
const m = 2.5 / mapInfo . resolution ;
const xs = pts . map ( q => q [ 0 ]), ys = pts . map ( q => q [ 1 ]);
const x0 = Math . min (... xs ) - m , x1 = Math . max (... xs ) + m , y0 = Math . min (... ys ) - m , y1 = Math . max (... ys ) + m ;
const s = Math . min ( r . width / ( x1 - x0 ), r . height / ( y1 - y0 ));
return { s , x0 : ( x0 + x1 ) / 2 - r . width / 2 / s , y0 : ( y0 + y1 ) / 2 - r . height / 2 / s };
}
function drawMap () {
const r = cv . getBoundingClientRect (), dpr = window . devicePixelRatio || 1 ;
if ( ! r . width || ! mapLayer || ! mapInfo ) return ;
if ( cv . width !== Math . round ( r . width * dpr ) || cv . height !== Math . round ( r . height * dpr )) {
cv . width = Math . round ( r . width * dpr ); cv . height = Math . round ( r . height * dpr );
}
if ( ! view ) view = fitView ( cv );
ctx . setTransform ( dpr , 0 , 0 , dpr , 0 , 0 ); ctx . clearRect ( 0 , 0 , r . width , r . height );
ctx . imageSmoothingEnabled = view . s < 2 ;
ctx . drawImage ( mapLayer , - view . x0 * view . s , - view . y0 * view . s , mapLayer . width * view . s , mapLayer . height * view . s );
ctx . font = "600 11px system-ui" ; ctx . textBaseline = "middle" ;
for ( const m of mapInfo . markers ) {
const [ px , py ] = toScreen ( m . x , m . y ), dock = m . type === 11 , col = dock ? "#22c55e" : "#f59e0b" ;
const len = Math . max ( 11 , Math . min ( 22 , 0.35 / mapInfo . resolution * view . s )); // heading arrow: where the robot faces here
ctx . save (); ctx . translate ( px , py ); ctx . rotate ( - ( m . theta || 0 ));
ctx . strokeStyle = col ; ctx . fillStyle = col ; ctx . lineWidth = 2 ; ctx . lineCap = "round" ;
ctx . beginPath (); ctx . moveTo ( 0 , 0 ); ctx . lineTo ( len , 0 ); ctx . stroke ();
ctx . beginPath (); ctx . moveTo ( len + 4 , 0 ); ctx . lineTo ( len - 3 , 4 ); ctx . lineTo ( len - 3 , - 4 ); ctx . closePath (); ctx . fill ();
ctx . restore ();
ctx . fillStyle = col ;
ctx . beginPath (); ctx . arc ( px , py , dock ? 6 : 4.5 , 0 , 7 ); ctx . fill ();
ctx . lineWidth = 1.5 ; ctx . strokeStyle = "rgba(10,14,19,.9)" ; ctx . stroke ();
ctx . lineWidth = 3 ; ctx . strokeStyle = "rgba(10,14,19,.9)" ; ctx . strokeText ( m . name , px + 8 , py );
ctx . fillStyle = "#e2e8f0" ; ctx . fillText ( m . name , px + 8 , py );
}
const p = status && status . base && status . base . current_pose ;
if ( p ) {
const [ px , py ] = toScreen ( p . x , p . y ), rad = Math . max ( 8 , 0.27 / mapInfo . resolution * view . s );
ctx . save (); ctx . translate ( px , py ); ctx . rotate ( - p . theta );
ctx . fillStyle = "rgba(56,189,248,.2)" ; ctx . strokeStyle = "#38bdf8" ; ctx . lineWidth = 1.5 ;
ctx . beginPath (); ctx . arc ( 0 , 0 , rad , 0 , 7 ); ctx . fill (); ctx . stroke ();
ctx . fillStyle = "#38bdf8" ; ctx . beginPath (); ctx . moveTo ( rad + 6 , 0 ); ctx . lineTo ( rad - 4 , 6 ); ctx . lineTo ( rad - 4 , - 6 ); ctx . closePath (); ctx . fill ();
ctx . restore ();
}
}
function toScreen ( x , y , v = view ) { const [ ix , iy ] = pxOf ( x , y ); return [( ix - v . x0 ) * v . s , ( iy - v . y0 ) * v . s ]; }
function toMap ( px , py , v = view ) {
const ix = px / v . s + v . x0 , iy = py / v . s + v . y0 ;
return [ ix * mapInfo . resolution + mapInfo . origin_x , ( mapInfo . height - iy ) * mapInfo . resolution + mapInfo . origin_y ];
}
cv . addEventListener ( "wheel" , e => {
if ( ! view ) return ; e . preventDefault ();
const r = cv . getBoundingClientRect (), px = e . clientX - r . left , py = e . clientY - r . top ;
const k = Math . exp ( - e . deltaY * 0.0015 ), ix = px / view . s + view . x0 , iy = py / view . s + view . y0 ;
view . s = Math . max ( 0.2 , Math . min ( 20 , view . s * k )); view . x0 = ix - px / view . s ; view . y0 = iy - py / view . s ; drawMap ();
}, { passive : false });
cv . addEventListener ( "pointerdown" , e => { drag = { x : e . clientX , y : e . clientY , moved : false }; cv . setPointerCapture ( e . pointerId ); });
cv . addEventListener ( "pointermove" , e => {
if ( ! drag || ! view ) return ;
const dx = e . clientX - drag . x , dy = e . clientY - drag . y ;
if ( ! drag . moved && Math . hypot ( dx , dy ) < 4 ) return ;
drag . moved = true ; view . x0 -= dx / view . s ; view . y0 -= dy / view . s ; drag . x = e . clientX ; drag . y = e . clientY ; drawMap ();
});
cv . addEventListener ( "pointerup" , e => {
const d = drag ; drag = null ;
if ( ! d || d . moved || ! view ) return ;
const r = cv . getBoundingClientRect (), px = e . clientX - r . left , py = e . clientY - r . top ;
const hit = mapInfo . markers . find ( m => { const [ mx , my ] = toScreen ( m . x , m . y ); return Math . hypot ( mx - px , my - py ) < 10 ; });
if ( hit ) { const to = hit . name === mapInfo . main_dock ? "home" : hit . name ;
selectDest ( to ); if ( confirm ( `Drive to marker " ${ hit . name } "?` )) act ( null , "Driving to " + hit . name , () => api ( "/agv/go" , { marker : to })); return ; }
if ( ! $ ( "clickGo" ). checked ) return ;
const [ x , y ] = toMap ( px , py ), th = (( status && status . base . current_pose ) || {}). theta || 0 ;
if ( confirm ( `Drive to x ${ x . toFixed ( 2 ) } , y ${ y . toFixed ( 2 ) } ?` )) act ( null , "Driving to the point" , () => api ( "/agv/go_point" , { x , y , theta : th }));
});
window . addEventListener ( "resize" , drawMap );
$ ( "mapFit" ). onclick = () => { view = null ; drawMap (); };
function renderMapList () {
$ ( "maplist" ). innerHTML = mapInfo . maps . map ( m => m . floors . map ( f => {
const cur = m . name === mapInfo . map_name && f === mapInfo . floor ;
return `<div class="mapitem ${ cur ? "cur" : "" } "><span> ${ m . name } <span class="muted">· floor ${ f } </span></span>
${ cur ? '<span class="tag live">current</span>' : `<button class="btn" data-map=" ${ m . name } " data-floor=" ${ f } ">Use</button>` } </div>` ;
}). join ( "" )). join ( "" );
}
$ ( "maplist" ). onclick = e => {
const b = e . target . closest ( "[data-map]" ); if ( ! b ) return ;
if ( ! confirm ( `Switch the base to map " ${ b . dataset . map } "? The base service restarts.` )) return ;
act ( b , "Map switched, reloading…" , () => api ( "/map/switch" , { map_name : b . dataset . map , floor : + b . dataset . floor }))
. then (() => setTimeout ( loadMap , 8000 ));
};
loadMap ();
2026-10-21 18:52:34 +09:00
const sameMap = ( a , b ) => [ "map_name" , "floor" , "width" , "height" , "resolution" , "origin_x" , "origin_y" ]. every ( k => a [ k ] === b [ k ]);
setInterval ( async () => { // markers added on the base, a map switched there: seen within MAP_POLL_MS
if ( ! mapInfo ) return loadMap ();
try {
const m = await api ( "/map/info" );
if ( ! sameMap ( m , mapInfo )) return loadMap ();
if ( JSON . stringify ( m ) === JSON . stringify ( mapInfo )) return ;
mapInfo = m ; paintMarkers (); drawMap ();
} catch ( e ) {}
}, MAP_POLL_MS );
2026-10-21 15:19:07 +09:00
/* ---------- actions ---------- */
function Dropdown ( el , placeholder ) { // styled multi-select: click stops in the order to visit them
el . innerHTML = `<button class="dd-btn" type="button"><span class="dd-val ph"> ${ placeholder } </span><span class="chev">▼</span></button>` ;
const btn = el . querySelector ( ".dd-btn" ), val = el . querySelector ( ".dd-val" );
const menu = document . createElement ( "div" ); menu . className = "dd-menu" ; document . body . appendChild ( menu );
const self = { values : [], items : []};
const label = n => n === "home" ? "Dock" : n ;
const row = ( v , text , cls ) => `<div class="dd-item ${ cls } " data-v=" ${ v } "><span class="ic"></span> ${ text } <span class="no"></span></div>` ;
self . setItems = names => {
self . items = names ;
menu . innerHTML = `<div class="dd-head"><span>Click the stops in order</span><a href="#" class="dd-clear">Clear</a></div>` +
row ( "home" , "Dock (charger)" , "dock" ) + `<div class="dd-sep"></div>` +
names . map ( n => row ( n , n , mapInfo && mapInfo . markers . some ( m => m . name === n && m . type === 11 ) ? "dock" : "" )). join ( "" );
self . paint ();
};
self . paint = () => {
const v = self . values ;
val . textContent = v . length ? v . map ( label ). join ( " → " ) : placeholder ; val . classList . toggle ( "ph" , ! v . length );
btn . title = v . length ? v . map ( label ). join ( " → " ) : "" ;
menu . querySelectorAll ( ".dd-item" ). forEach ( i => {
const k = v . indexOf ( i . dataset . v );
i . classList . toggle ( "sel" , k >= 0 ); i . querySelector ( ".no" ). textContent = k >= 0 ? k + 1 : "" ;
});
};
self . set = v => { self . values = v ? [ v ] : []; self . paint (); };
const close = () => { menu . classList . remove ( "open" ); el . classList . remove ( "open" ); };
const place = () => { // below the button, or above it when there is no room
const r = btn . getBoundingClientRect (), h = Math . min ( 380 , menu . scrollHeight + 2 ), w = Math . max ( r . width , 220 );
menu . style . width = w + "px" ; menu . style . left = Math . min ( r . left , innerWidth - w - 8 ) + "px" ;
menu . style . top = ( innerHeight - r . bottom > h + 12 ? r . bottom + 6 : Math . max ( 8 , r . top - h - 6 )) + "px" ;
};
btn . onclick = e => {
e . stopPropagation ();
const opening = ! menu . classList . contains ( "open" );
document . querySelectorAll ( ".dd-menu.open" ). forEach ( m => m . classList . remove ( "open" ));
if ( opening ) { menu . classList . add ( "open" ); el . classList . add ( "open" ); place (); } else close ();
};
menu . onclick = e => {
e . stopPropagation ();
if ( e . target . closest ( ".dd-clear" )) { e . preventDefault (); self . values = []; self . paint (); return ; }
const i = e . target . closest ( ".dd-item" ); if ( ! i ) return ;
const k = self . values . indexOf ( i . dataset . v );
if ( k >= 0 ) self . values . splice ( k , 1 ); else self . values . push ( i . dataset . v );
self . paint (); // stays open: pick the next stop
};
document . addEventListener ( "click" , e => { if ( ! el . contains ( e . target ) && ! menu . contains ( e . target )) close (); });
window . addEventListener ( "resize" , close );
document . addEventListener ( "scroll" , e => { if ( ! menu . contains ( e . target )) close (); }, true ); // scrolling the list itself keeps it open
menu . addEventListener ( "wheel" , e => e . stopPropagation (), { passive : true });
return self ;
}
let markerNames = [];
const destDD = Dropdown ( $ ( "destDD" ), "Choose one or more places…" );
function selectDest ( name ) { destDD . set ( name ); }
$ ( "goBtn" ). onclick = e => {
const stops = destDD . values , name = n => n === "home" ? "the dock" : n ;
if ( ! stops . length ) return toast ( "Choose a place first" , "err" );
if ( stops . length === 1 ) return act ( e . target , "Driving to " + name ( stops [ 0 ]), () => api ( "/agv/go" , { marker : stops [ 0 ]}));
act ( e . target , `Route: ${ stops . map ( name ). join ( " → " ) } ` , () => api ( "/agv/route" , { markers : stops , pause : + $ ( "pause" ). value || 0 }));
};
$ ( "dockBtn" ). onclick = e => act ( e . target , "Driving to the dock" , () => api ( "/agv/go" , { marker : "home" }));
$ ( "cancelBtn" ). onclick = e => act ( e . target , "Drive cancelled" , () => api ( "/agv/cancel" , {}));
$ ( "waveBtn" ). onclick = e => act ( e . target , "Waving" , () => api ( "/arm/wave" , {}));
2026-10-21 18:52:34 +09:00
const POSE_ORDER = [ "look" , "carry" , "give" , "ready" , "wave_out" , "wave_start" , "wave" ]; // the rest (taught later) follow by name
2026-10-21 15:19:07 +09:00
api ( "/arm/poses" ). then ( ps => {
const names = Object . keys ( ps ). sort (( a , b ) => (( POSE_ORDER . indexOf ( a ) + 1 ) || 99 ) - (( POSE_ORDER . indexOf ( b ) + 1 ) || 99 ) || a . localeCompare ( b ));
$ ( "poseSel" ). innerHTML = names . map ( n => `<option> ${ esc ( n ) } </option>` ). join ( "" );
}). catch (() => {});
try { $ ( "poseSpeed" ). value = localStorage . getItem ( "poseSpeed" ) || "slow" ; } catch ( e ) {}
$ ( "poseSpeed" ). onchange = () => { try { localStorage . setItem ( "poseSpeed" , $ ( "poseSpeed" ). value ); } catch ( e ) {} };
function movePose ( el , name ) {
const speed = $ ( "poseSpeed" ). value ;
if ( confirm ( `Move the arm to ${ name } ( ${ speed } )?` )) act ( el , `Arm at ${ name } ` , () => api ( "/arm/pose" , { name , speed }));
}
$ ( "poseGo" ). onclick = e => { if ( $ ( "poseSel" ). value ) movePose ( e . target , $ ( "poseSel" ). value ); };
$ ( "sayBtn" ). onclick = e => { const t = $ ( "sayText" ). value . trim (); if ( t ) act ( e . target , "Said" , () => api ( "/say" , { text : t })); };
$ ( "sayText" ). onkeydown = e => { if ( e . key === "Enter" ) $ ( "sayBtn" ). click (); };
$ ( "askBtn" ). onclick = async e => {
const q = $ ( "askText" ). value . trim (); if ( ! q ) return ;
const r = await act ( e . target , null , () => api ( "/ask" , { question : q , speak : true }));
if ( r ) { $ ( "answer" ). style . display = "block" ; $ ( "answer" ). textContent = ` ${ r . answer } ( ${ r . llm_seconds } s)` ; }
};
$ ( "askText" ). onkeydown = e => { if ( e . key === "Enter" ) $ ( "askBtn" ). click (); };
api ( "/volume" ). then ( v => { $ ( "vol" ). value = v . percent ; $ ( "volV" ). textContent = v . percent + " %" ; });
$ ( "vol" ). oninput = e => $ ( "volV" ). textContent = e . target . value + " %" ;
$ ( "vol" ). onchange = e => api ( "/volume" , { percent : + e . target . value }). then ( v => toast ( `Volume ${ v . percent } %` , "ok" )). catch ( x => toast ( x . message , "err" ));
/* assistant modes: greeter (standing) and patrol (driving) */
let modes = {};
function paintModes ( m ) {
modes = m ;
$ ( "modeGreeter" ). classList . toggle ( "on" , !! m . greeter ); $ ( "modePatrol" ). classList . toggle ( "on" , !! m . patrol );
$ ( "useArm" ). checked = m . wave !== false ; $ ( "useDrive" ). checked = m . drive !== false ;
const on = [ m . greeter && "greeter" , m . patrol && "patrol" ]. filter ( Boolean );
$ ( "asTag" ). textContent = on . length ? ( m . running ? "● " : "starting… " ) + on . join ( " + " ) : "off" ;
$ ( "asTag" ). className = "tag " + ( on . length && m . running ? "live" : "" );
}
async function setModes ( part , el ) {
if ( el ) el . classList . add ( "busy" );
try { paintModes ( await api ( "/assistant/modes" , part )); }
catch ( e ) { toast ( e . message , "err" ); }
finally { if ( el ) el . classList . remove ( "busy" ); }
}
document . querySelectorAll ( ".mode" ). forEach ( el => el . onclick = () => {
const k = el . dataset . mode , on = ! modes [ k ];
setModes ({[ k ] : on }, el ). then (() => toast ( ` ${ k [ 0 ]. toUpperCase () + k . slice ( 1 ) } ${ on ? "on" : "off" } ` , "ok" ));
});
$ ( "useArm" ). onchange = e => setModes ({ wave : e . target . checked });
$ ( "useDrive" ). onchange = e => setModes ({ drive : e . target . checked });
api ( "/assistant/modes" ). then ( paintModes );
setInterval (() => api ( "/assistant/modes" ). then ( paintModes ). catch (() => {}), 3000 );
$ ( "stopAll" ). onclick = e => { holdStop (); act ( e . target , "Everything stopped" , () => api ( "/stop" , {})); };
/* ---------- notifications ---------- */
const notes = []; // newest last: {msg, n, time}
let unread = 0 ;
function note ( msg ) {
const last = notes [ notes . length - 1 ];
if ( last && last . msg === msg ) { last . n ++ ; last . time = new Date (); } // the same error again: count it
else { notes . push ({ msg , n : 1 , time : new Date ()}); if ( notes . length > 100 ) notes . shift (); }
if ( ! $ ( "notesDrawer" ). classList . contains ( "open" )) unread ++ ;
paintNotes ();
}
function paintNotes () {
$ ( "noteCount" ). textContent = unread ? ( unread > 99 ? "99+" : unread ) : "" ;
$ ( "openNotes" ). classList . toggle ( "alert" , unread > 0 );
$ ( "notes" ). innerHTML = notes . slice (). reverse (). map ( x =>
`<li><span class="when"> ${ x . time . toLocaleTimeString () }${ x . n > 1 ? ` · × ${ x . n } ` : "" } </span> ${ esc ( String ( x . msg )) } </li>` ). join ( "" );
}
function openNotes () { unread = 0 ; paintNotes (); $ ( "notesDrawer" ). classList . add ( "open" ); $ ( "shade" ). classList . add ( "open" ); }
function closeNotes () { $ ( "notesDrawer" ). classList . remove ( "open" ); if ( ! $ ( "drawer" ). classList . contains ( "open" )) $ ( "shade" ). classList . remove ( "open" ); }
$ ( "openNotes" ). onclick = openNotes ; $ ( "closeNotes" ). onclick = closeNotes ;
$ ( "clearNotes" ). onclick = () => { notes . length = 0 ; unread = 0 ; paintNotes (); };
/* ---------- settings drawer ---------- */
function openSettings () { $ ( "drawer" ). classList . add ( "open" ); $ ( "shade" ). classList . add ( "open" ); }
function closeSettings () { $ ( "drawer" ). classList . remove ( "open" ); $ ( "shade" ). classList . remove ( "open" ); }
$ ( "openSettings" ). onclick = openSettings ; $ ( "closeSettings" ). onclick = closeSettings ;
$ ( "shade" ). onclick = () => { closeSettings (); closeNotes (); };
$ ( "tabs" ). onclick = e => {
const t = e . target . closest ( ".tab" ); if ( ! t ) return ;
document . querySelectorAll ( ".tab" ). forEach ( x => x . classList . toggle ( "on" , x === t ));
document . querySelectorAll ( ".pane" ). forEach ( x => x . classList . toggle ( "on" , x . id === "pane-" + t . dataset . tab ));
};
let viewSet = {};
api ( "/view/settings" ). then ( s => { viewSet = s ; });
$ ( "joints" ). innerHTML = [ 1 , 2 , 3 , 4 , 5 , 6 ]. map ( i => `<div class="jrow"><b>J ${ i } </b><span class="v" id="j ${ i } V">– </span>
<button class="btn hold" data-axis="j ${ i } " data-dir="-1">− </button><button class="btn hold" data-axis="j ${ i } " data-dir="1">+</button></div>` ). join ( "" );
async function refreshArm () {
if ( ! $ ( "drawer" ). classList . contains ( "open" ) || ! $ ( "pane-arm" ). classList . contains ( "on" )) return ;
try {
const a = await api ( "/arm/state" );
a . joints . forEach (( v , i ) => $ ( `j ${ i + 1 } V` ). textContent = v . toFixed ( 1 ) + "°" );
$ ( "tcp" ). textContent = `TCP x ${ a . tcp [ 0 ] } y ${ a . tcp [ 1 ] } z ${ a . tcp [ 2 ] } mm · rx ${ a . tcp [ 3 ] } ry ${ a . tcp [ 4 ] } rz ${ a . tcp [ 5 ] } °` ;
$ ( "armPow" ). textContent = "power " + ( a . power ? "on" : "off" ); $ ( "armPow" ). className = "tag " + ( a . power ? "live" : "" );
$ ( "armEn" ). textContent = a . enable ? "enabled" : "disabled" ; $ ( "armEn" ). className = "tag " + ( a . enable ? "live" : "" );
$ ( "armProg" ). textContent = ` ${ a . program } · ${ a . loaded || "– " } ` ;
const g = await api ( "/gripper/state" );
$ ( "gripSt" ). textContent = ( g . holding ? "holding" : g . closed ? "closed" : "open" ) + " · " + g . ai [ 0 ];
$ ( "gripSt" ). className = "tag " + ( g . holding ? "live" : "" );
$ ( "gripEye" ). textContent = "sensor " + ( g . object_in_front ? "object" : "clear" );
} catch ( e ) {}
}
setInterval ( refreshArm , 500 );
$ ( "armPowerOn" ). onclick = e => act ( e . target , "Arm power on" , () => api ( "/arm/power" , { on : true }));
$ ( "armEnable" ). onclick = e => act ( e . target , "Arm enabled" , () => api ( "/arm/enable" , { on : true }));
$ ( "armDisable" ). onclick = e => { if ( confirm ( "Disable the arm servos? The arm holds by its brakes." )) act ( e . target , "Arm disabled" , () => api ( "/arm/enable" , { on : false })); };
$ ( "progRun" ). onclick = e => act ( e . target , "Program started" , () => api ( "/arm/run" , { program : $ ( "prog" ). value . trim ()}));
$ ( "gripOpen" ). onclick = e => act ( e . target , "Gripper open" , () => api ( "/gripper/open" , {}));
$ ( "gripClose" ). onclick = e => { if ( confirm ( "Close the gripper? Hands away from the fingers." )) act ( e . target , "Gripper closed" , () => api ( "/gripper/close" , {})); };
$ ( "progStop" ). onclick = e => act ( e . target , "Program stopped" , () => api ( "/arm/stop" , {}));
const esc = t => t . replace ( /&/g , "&" ). replace ( /</g , "<" );
async function refreshLog () {
if ( ! $ ( "drawer" ). classList . contains ( "open" ) || ! $ ( "pane-logs" ). classList . contains ( "on" )) return ;
try {
const robot = $ ( "logSrc" ). value === "robot" ;
const st = await api ( "/assistant/status" ), lg = robot ? await api ( "/logs/robot?lines=300" ) : await api ( "/assistant/log?lines=300" );
const task = robot ? await api ( "/tasks/state" ) : null ;
const cams = st . cameras ? Object . entries ( st . cameras ). map (([ k , v ]) => ` ${ k } : ${ v } ` ). join ( ", " ) : "– " ;
const up = st . uptime_s != null ? ` ${ Math . floor ( st . uptime_s / 60 ) } min ${ st . uptime_s % 60 } s` : "– " ;
const state = ! st . running ? '<b style="color:var(--muted)">not running</b>' : st . stuck ? '<b style="color:var(--bad)">STUCK</b>'
: st . log_age_s > 90 ? '<b style="color:var(--warn)">quiet (no log for ' + Math . round ( st . log_age_s ) + ' s)</b>' : '<b style="color:var(--ok)">running</b>' ;
$ ( "stat" ). innerHTML = `<span>Assistant</span><div> ${ state }${ st . pids . length ? " · pid " + st . pids . join ( ", " ) : "" } </div>
<span>Modes</span><div>greeter ${ st . modes . greeter ? "on" : "off" } · patrol ${ st . modes . patrol ? "on" : "off" } · wave ${ st . modes . wave ? "on" : "off" } · come ${ st . modes . drive ? "on" : "off" } </div>
<span>Uptime</span><div> ${ up } </div><span>Cameras</span><div> ${ st . camera_service ? cams : '<b style="color:var(--bad)">camera service not running</b>' } </div>
${ task ? `<span>Task</span><div><b style="color:var(-- ${ task . status === "failed" ? "bad" : task . status === "running" ? "ok" : "muted" } )"> ${ esc ( task . status ) } </b> ${ task . step ? " · " + esc ( task . step ) : "" }${ task . holding ? " · holding" : "" } </div>` : "" }
<span>Last line</span><div style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis"> ${ esc (( robot ? lg . lines . slice ( - 1 )[ 0 ] : st . last_line ) || "– " ) } </div>` ;
const errs = robot ? lg . errors : st . errors ;
$ ( "errBox" ). innerHTML = errs . length ? `<div class="errs"> ${ esc ( errs . slice ( - 8 ). join ( "\n" )) } </div>` : "" ;
const all = $ ( "logAll" ). checked , el = $ ( "log" ), end = el . scrollTop + el . clientHeight >= el . scrollHeight - 20 ;
const lines = ( robot ? lg . lines : lg . lumi_log ). filter ( l => all || ! / see #| camera ok / . test ( l )). map ( l => {
const c = /\b(error|failed|stuck|refused|cannot|traceback)\b/i . test ( l ) ? "e" : /heard nothing|skipped|left - stop|could not|standing still|paused/ . test ( l ) ? "w"
: /GREET|WAKE|visitor|^\d\d:\d\d:\d\d lumi |calibrated|arrived/ . test ( l ) ? "g" : "" ;
return `<div class=" ${ c } "> ${ esc ( l ) } </div>` ;
});
el . innerHTML = ( lines . join ( "" ) || "(no log yet)" ) + ( ! robot && lg . console . length ? `<div class="e" style="margin-top:8px">--- console (errors, tracebacks) ---</div> ${ esc ( lg . console . join ( "\n" )) } ` : "" );
if ( end ) el . scrollTop = el . scrollHeight ;
} catch ( e ) {}
}
setInterval ( refreshLog , 2000 );
async function refreshCalib () {
if ( ! $ ( "drawer" ). classList . contains ( "open" ) || ! $ ( "pane-voice" ). classList . contains ( "on" )) return ;
try {
const d = await api ( "/doa/status" ), p = d . progress , c = d . calibration ;
$ ( "calN" ). textContent = p . samples || 0 ;
const left = p . until ? Math . max ( 0 , Math . round ( p . until - Date . now () / 1000 )) : 0 ;
$ ( "calState" ). textContent = p . state === "collecting" || p . state === "starting" ? `collecting samples · ${ left } s left` : ( p . state || "idle" );
$ ( "calRes" ). textContent = c . fitted ? `calibrated · median error ${ c . median_error_deg ?? "?" } ° ( ${ c . samples ?? "?" } samples, ${ c . time || "" } )` : "not calibrated yet" ;
} catch ( e ) {}
}
setInterval ( refreshCalib , 1000 );
$ ( "calStart" ). onclick = e => act ( e . target , "Calibration started – talk in front of the robot" , () => api ( "/doa/calibrate" , { on : true }));
$ ( "calStop" ). onclick = e => act ( e . target , "Calibration stopped" , () => api ( "/doa/calibrate" , { on : false }));
/* ---------- command dialog: fetch an object (docs/16 §5) ---------- */
function MapPicker ( box , onPick ) { // click = the point, drag from it = heading, drag elsewhere = pan, wheel / +− = zoom
const c = box . querySelector ( "canvas" ), g = c . getContext ( "2d" );
let v = null , drag = null ;
const self = { pt : null , reset : () => { v = null ; self . draw (); }, ensure : () => { if ( ! v ) self . draw (); }}; // ensure: the map came late
self . draw = () => {
const r = c . getBoundingClientRect (), dpr = window . devicePixelRatio || 1 ;
if ( ! r . width || ! mapLayer || ! mapInfo ) return ;
c . width = Math . round ( r . width * dpr ); c . height = Math . round ( r . height * dpr );
if ( ! v ) v = fitView ( c );
g . setTransform ( dpr , 0 , 0 , dpr , 0 , 0 ); g . clearRect ( 0 , 0 , r . width , r . height );
g . imageSmoothingEnabled = v . s < 3 ; // close up: sharp map cells
g . drawImage ( mapLayer , - v . x0 * v . s , - v . y0 * v . s , mapLayer . width * v . s , mapLayer . height * v . s );
g . font = "600 11px system-ui" ; g . textBaseline = "middle" ;
for ( const m of mapInfo . markers ) {
const [ px , py ] = toScreen ( m . x , m . y , v );
g . fillStyle = m . type === 11 ? "#22c55e" : "#f59e0b" ; g . beginPath (); g . arc ( px , py , 4 , 0 , 7 ); g . fill ();
g . fillStyle = "#e2e8f0" ; g . fillText ( m . name , px + 7 , py );
}
const rp = status && status . base && status . base . current_pose ;
if ( rp ) { const [ px , py ] = toScreen ( rp . x , rp . y , v ); g . fillStyle = "#38bdf8" ; g . beginPath (); g . arc ( px , py , 5 , 0 , 7 ); g . fill (); }
if ( ! self . pt ) return ;
const [ px , py ] = toScreen ( self . pt . x , self . pt . y , v );
g . save (); g . translate ( px , py ); g . rotate ( - self . pt . theta );
g . strokeStyle = g . fillStyle = "#38bdf8" ; g . lineWidth = 2.5 ; g . lineCap = "round" ;
g . beginPath (); g . arc ( 0 , 0 , 6 , 0 , 7 ); g . stroke ();
g . beginPath (); g . moveTo ( 6 , 0 ); g . lineTo ( 26 , 0 ); g . stroke ();
g . beginPath (); g . moveTo ( 31 , 0 ); g . lineTo ( 23 , 5 ); g . lineTo ( 23 , - 5 ); g . closePath (); g . fill ();
g . restore ();
};
const at = e => { const r = c . getBoundingClientRect (); return [ e . clientX - r . left , e . clientY - r . top ]; };
const zoom = ( f , sx , sy ) => { // keep the map point under (sx, sy) in place
self . ensure ();
if ( ! v ) return ;
const s = Math . max ( 0.2 , Math . min ( 40 , v . s * f )), ix = sx / v . s + v . x0 , iy = sy / v . s + v . y0 ;
v = {... v , s , x0 : ix - sx / s , y0 : iy - sy / s }; self . draw ();
};
c . addEventListener ( "wheel" , e => { e . preventDefault (); zoom ( e . deltaY < 0 ? 1.25 : 0.8 , ... at ( e )); }, { passive : false });
box . querySelectorAll ( ".zoom button" ). forEach ( b => b . onclick = () => { const r = c . getBoundingClientRect (); zoom ( + b . dataset . z , r . width / 2 , r . height / 2 ); });
c . addEventListener ( "pointerdown" , e => {
if ( ! v ) return ;
const [ sx , sy ] = at ( e ), near = self . pt && Math . hypot (... toScreen ( self . pt . x , self . pt . y , v ). map (( q , i ) => q - [ sx , sy ][ i ])) < 14 ;
drag = { mode : near ? "heading" : "maybe" , sx , sy , v0 : v };
c . setPointerCapture ( e . pointerId );
});
c . addEventListener ( "pointermove" , e => {
if ( ! drag ) return ;
const [ px , py ] = at ( e );
if ( drag . mode === "heading" ) {
const [ sx , sy ] = toScreen ( self . pt . x , self . pt . y , v );
if ( Math . hypot ( px - sx , py - sy ) > 8 ) { self . pt . theta = Math . atan2 ( - ( py - sy ), px - sx ); self . draw (); }
} else if ( drag . mode === "pan" || Math . hypot ( px - drag . sx , py - drag . sy ) > 6 ) {
drag . mode = "pan" ;
v = {... drag . v0 , x0 : drag . v0 . x0 - ( px - drag . sx ) / v . s , y0 : drag . v0 . y0 - ( py - drag . sy ) / v . s }; self . draw ();
}
});
const up = e => {
if ( ! drag ) return ;
if ( drag . mode === "maybe" ) { // a click without moving: the point
const [ x , y ] = toMap ( drag . sx , drag . sy , v ), cur = ( status && status . base && status . base . current_pose ) || {};
self . pt = { x , y , theta : self . pt ? self . pt . theta : cur . theta || 0 }; self . draw ();
}
const changed = drag . mode !== "pan" ; drag = null ;
if ( changed ) onPick ();
};
c . addEventListener ( "pointerup" , up ); c . addEventListener ( "pointercancel" , () => drag = null );
return self ;
}
const segVal = id => $ ( id ). querySelector ( "button.on" ). dataset . v ;
const srcPick = MapPicker ( $ ( "tSrcPick" ), cmdChanged ), dstPick = MapPicker ( $ ( "tDstPick" ), cmdChanged );
function paintWhere ( seg , row , box , pick , label ) {
const m = segVal ( seg );
$ ( row ). style . display = m === "marker" ? "" : "none" ;
const show = m === "point" , was = $ ( box ). style . display !== "none" ;
$ ( box ). style . display = show ? "" : "none" ;
if ( show ) was ? pick . draw () : pick . reset (); // reset: fit the map once the box has a size
const p = pick . pt ;
$ ( label ). textContent = p ? `x ${ p . x . toFixed ( 2 ) } · y ${ p . y . toFixed ( 2 ) } · ${ Math . round ( p . theta * 180 / Math . PI ) } °` : "" ;
}
function whereOf ( seg , sel , pick ) {
const m = segVal ( seg ), p = pick . pt ;
if ( m === "here" ) return "here" ;
if ( m === "marker" ) return { marker : $ ( sel ). value };
return p && { x : + p . x . toFixed ( 3 ), y : + p . y . toFixed ( 3 ), theta : + p . theta . toFixed ( 3 )};
}
2026-10-22 14:11:47 +09:00
let cmdSeq = 0 , cmdTimer = null , parsed = null , heldNow = false , cmdLLM = false ; // cmdLLM: Enter pressed // heldNow: Lumi holds the object, From unused
2026-10-21 15:19:07 +09:00
function cmdChanged () { // repaint the pickers, then read the text again (after typing stops)
paintWhere ( "tSrcSeg" , "tSrcMarkerRow" , "tSrcPickBox" , srcPick , "tSrcPt" );
paintWhere ( "tDstSeg" , "tDstMarkerRow" , "tDstPickBox" , dstPick , "tDstPt" );
2026-10-22 14:11:47 +09:00
cmdLLM = false ; clearTimeout ( cmdTimer ); cmdTimer = setTimeout ( parseCmd , 600 );
2026-10-21 15:19:07 +09:00
}
function parseCmd () {
const text = $ ( "tText" ). value . trim (), n = ++ cmdSeq ;
const show = ( sentence , probs ) => {
if ( n !== cmdSeq ) return ; // an older answer arriving late
$ ( "tSentence" ). textContent = sentence ;
$ ( "tProblems" ). innerHTML = probs . map ( p => `<div> ${ esc ( p ) } </div>` ). join ( "" );
2026-10-22 14:11:47 +09:00
$ ( "tStart" ). disabled = probs . length > 0 || ! parsed || ! parsed . action ;
2026-10-21 15:19:07 +09:00
$ ( "tStart" ). textContent = { give : "Give" , place : "Place" , carry : "Go" }[ parsed && parsed . action ] || "Start" ;
2026-10-22 14:11:47 +09:00
$ ( "tWhere" ). style . display = parsed && [ "fetch" , "carry" ]. includes ( parsed . action ) ? "" : "none" ;
2026-10-21 15:19:07 +09:00
paintSteps ();
};
parsed = null ;
if ( ! text && ! heldNow ) { show ( "– " , []); return ; }
const source = whereOf ( "tSrcSeg" , "tSrcMarker" , srcPick ), dest = whereOf ( "tDstSeg" , "tDstMarker" , dstPick );
$ ( "tSentence" ). textContent = "…" ;
2026-10-22 14:11:47 +09:00
api ( "/tasks/parse" , { text , source : source || null , dest : dest || null , llm : cmdLLM }). then ( r => {
2026-10-21 15:19:07 +09:00
if ( n !== cmdSeq ) return ;
parsed = r ; show ( r . sentence , r . problems );
}). catch ( e => show ( "– " , [ e . message ]));
}
const waitFor = sec => sec >= 60 ? ` ${ + ( sec / 60 ). toFixed ( 1 ) } min` : ` ${ sec } s` ;
const STEP_EN = s => ({ go : () => Array . isArray ( s . to ) ? `Go to one of ${ s . to . join ( ", " ) } ` : s . to === "here" ? "Come back here" : `Go to ${ s . to } ` ,
move : () => `Drive ${ s . m } m ${ s . dir } ` , turn : () => `Turn ${ s . deg > 0 ? "left" : "right" } ${ Math . abs ( s . deg ) } °` ,
pick : () => `Take the ${ s . colour ? s . colour + " " : "" }${ s . object } ` , receive : () => s . wait_s ? `Wait for the ${ s . object || "thing" } ( ${ waitFor ( s . wait_s ) } )` : `Take the ${ s . object || "thing" } from a person` ,
say : () => `Say “ ${ s . text } ”` , place : () => s . on ? `Put it on the ${ [ s . on . colour , s . on . name . replace ( "dining " , "" ), s . on . side && "on my " + s . on . side ]. filter ( Boolean ). join ( " " ) } ` : "Put it down" ,
give : () => "Hand it over" , hold : () => "Hold it" ,
wait : () => s . until ? `Wait for an instruction ( ${ waitFor ( s . s ) } )` : s . s == null ? "Stay" : `Wait ${ waitFor ( s . s ) } ` , arm : () => ({ reach : "Reach out" , fold : "Fold the arm" , open : "Open the hand" , close : "Close the hand" })[ s . pose ]}[ s . do ] || (() => s . do ))();
function paintSteps () { // a mission: one line per step, a step can be dropped
const r = parsed , on = r && r . action === "steps" ;
$ ( "tSteps" ). style . display = on ? "" : "none" ;
if ( ! on ) return ;
$ ( "tSteps" ). innerHTML = r . steps . map (( s , i ) => `<li><span> ${ esc ( STEP_EN ( s )) } </span><button class="icon" data-i=" ${ i } ">✕</button></li>` ). join ( "" );
}
$ ( "tSteps" ). onclick = async e => {
const b = e . target . closest ( "button" ); if ( ! b || ! parsed ) return ;
parsed . steps . splice ( + b . dataset . i , 1 );
const n = ++ cmdSeq ;
if ( ! parsed . steps . length ) { parsed = null ; $ ( "tSentence" ). textContent = "– " ; $ ( "tProblems" ). innerHTML = "" ; $ ( "tStart" ). disabled = true ; paintSteps (); return ; }
try {
const d = await api ( "/tasks/steps/describe" , { steps : parsed . steps });
if ( n !== cmdSeq ) return ;
Object . assign ( parsed , d );
$ ( "tSentence" ). textContent = d . sentence ;
$ ( "tProblems" ). innerHTML = d . problems . map ( p => `<div> ${ esc ( p ) } </div>` ). join ( "" );
$ ( "tStart" ). disabled = d . problems . length > 0 ;
} catch ( err ) { $ ( "tProblems" ). innerHTML = `<div> ${ esc ( err . message ) } </div>` ; }
paintSteps ();
};
document . querySelectorAll ( "#cmdModal .seg" ). forEach ( s => s . onclick = e => {
const b = e . target . closest ( "button" ); if ( ! b ) return ;
s . querySelectorAll ( "button" ). forEach ( x => x . classList . toggle ( "on" , x === b )); cmdChanged ();
});
[ "tSrcMarker" , "tDstMarker" ]. forEach ( id => $ ( id ). onchange = cmdChanged );
$ ( "tText" ). oninput = cmdChanged ;
2026-10-22 14:11:47 +09:00
$ ( "tText" ). onkeydown = e => { if ( e . key === "Enter" && ! e . shiftKey ) { e . preventDefault (); clearTimeout ( cmdTimer ); cmdLLM = true ; parseCmd (); } };
2026-10-21 15:19:07 +09:00
function openCmd () {
const opts = `<option value="home">Dock (home)</option>` + markerNames . map ( n => `<option> ${ esc ( n ) } </option>` ). join ( "" );
for ( const id of [ "tSrcMarker" , "tDstMarker" ]) { const old = $ ( id ). value ; $ ( id ). innerHTML = opts ; if ( old ) $ ( id ). value = old ; }
$ ( "cmdModal" ). classList . add ( "open" ); cmdChanged (); refreshTask (); $ ( "tText" ). focus ();
}
function closeCmd () { $ ( "cmdModal" ). classList . remove ( "open" ); }
$ ( "openCmd" ). onclick = openCmd ; $ ( "closeCmd" ). onclick = closeCmd ;
let downOnShade = false ; // close only on a click that started and ended on the backdrop
$ ( "cmdModal" ). addEventListener ( "pointerdown" , e => downOnShade = e . target === $ ( "cmdModal" ));
$ ( "cmdModal" ). addEventListener ( "click" , e => { if ( downOnShade && e . target === $ ( "cmdModal" )) closeCmd (); });
$ ( "tStart" ). onclick = e => {
const r = parsed ; if ( ! r || r . problems . length ) return ;
if ( r . action === "give" ) return act ( e . target , "Giving" , () => api ( "/tasks/give" , {}));
if ( r . action === "place" ) return act ( e . target , "Placing" , () => api ( "/tasks/place" , { on : ( r . task && r . task . on ) || null }));
if ( r . action === "carry" ) return act ( e . target , "On the way" , () => api ( "/tasks/carry" , { dest : r . task . dest , then : r . task . then , on : r . task . on || null }));
if ( r . action === "steps" ) return act ( e . target , "Started" , () => api ( "/tasks/steps" , { steps : r . steps , lang : r . lang , sender : r . sender || null }));
2026-10-22 14:11:47 +09:00
if ( r . action === "command" ) return act ( e . target , "Started" , () => api ( "/tasks/command" , { text : r . text }));
2026-10-21 15:19:07 +09:00
act ( e . target , "Fetch started" , () => api ( "/tasks/fetch" , r . task ));
};
$ ( "tStop" ). onclick = e => act ( e . target , "Task stopped" , () => api ( "/tasks/stop" , {}));
let taskPaused = false ;
$ ( "tPause" ). onclick = e => taskPaused ? act ( e . target , "Going on" , () => api ( "/tasks/resume" , {}))
: act ( e . target , "Paused" , () => api ( "/tasks/pause" , {}));
$ ( "tRelease" ). onclick = e => act ( e . target , "Released" , () => api ( "/tasks/release" , {}));
async function refreshTask () {
if ( ! $ ( "cmdModal" ). classList . contains ( "open" )) return ;
srcPick . ensure (); dstPick . ensure ();
try {
const s = await api ( "/tasks/state" );
$ ( "tSt" ). textContent = s . status + ( s . step ? " · " + s . step : "" );
$ ( "tRelease" ). style . display = s . step === "giving" || s . step === "receiving: waiting for okay" ? "" : "none" ;
const busy = s . status === "running" || s . status === "waiting" ;
taskPaused = !! s . paused && busy ;
$ ( "tPause" ). style . display = busy ? "" : "none" ;
$ ( "tPause" ). textContent = taskPaused ? "Resume" : "Pause" ;
if ( heldNow !== !! s . holding ) { heldNow = !! s . holding ; $ ( "tSrcSec" ). style . display = heldNow ? "none" : "" ; cmdChanged (); }
$ ( "tSt" ). className = "tag " + ( s . status === "running" || s . status === "holding" ? "live" : "" );
$ ( "tLog" ). textContent = ( s . log || []). slice ( - 3 ). map ( l => typeof l === "string" ? l : JSON . stringify ( l )). join ( "\n" );
} catch ( e ) { $ ( "tSt" ). textContent = "task runner: " + e . message ; }
}
setInterval ( refreshTask , 1000 );
$ ( "calReset" ). onclick = e => { if ( confirm ( "Forget the voice-direction calibration?" )) act ( e . target , "Calibration reset" , () => api ( "/doa/reset" , {})); };
</ script >
</ body >
</ html >