diff --git a/assets/index.d33604a3.js b/assets/index.d33604a3.js new file mode 100644 index 0000000..4476922 --- /dev/null +++ b/assets/index.d33604a3.js @@ -0,0 +1 @@ +var q=Object.defineProperty,Y=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var I=(e,a,n)=>a in e?q(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n,h=(e,a)=>{for(var n in a||(a={}))X.call(a,n)&&I(e,n,a[n]);if(B)for(var n of B(a))Q.call(a,n)&&I(e,n,a[n]);return e},k=(e,a)=>Y(e,H(a));import{R as t,B as R,A as Z,T as ee,a as w,b as O,N as M,r as f,L as J,s as x,P as S,G as u,S as te,I as v,d as ne,c as ae,e as oe,f as ie,g as re,h as le,i as se,j as L,k as ce}from"./vendor.ed4606ec.js";const ue=function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerpolicy&&(i.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?i.credentials="include":o.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}};ue();function fe(){return t.createElement(R,{sx:{flexGrow:1}},t.createElement(Z,{position:"static"},t.createElement(ee,null,t.createElement(w,{variant:"h6",component:"div",sx:{flexGrow:1}},"Aruku App"),t.createElement(O,{component:M,to:"/",style:({isActive:e})=>({fontWeight:e?900:"normal"}),color:"inherit"},"Walk Settings"),t.createElement(O,{component:M,to:"/init",style:({isActive:e})=>({fontWeight:e?900:"normal"}),color:"inherit"},"Init Settings"))))}const C={};C.web=require("grpc-web");const c={};c.aruku_interfaces={};c.aruku_interfaces.proto=require("./aruku_pb.js");c.aruku_interfaces.proto.ConfigClient=function(e,a,n){n||(n={}),n.format="text",this.client_=new C.web.GrpcWebClientBase(n),this.hostname_=e.replace(/\/+$/,"")};c.aruku_interfaces.proto.ConfigPromiseClient=function(e,a,n){n||(n={}),n.format="text",this.client_=new C.web.GrpcWebClientBase(n),this.hostname_=e.replace(/\/+$/,"")};const T=new C.web.MethodDescriptor("/aruku_interfaces.proto.Config/GetConfig",C.web.MethodType.UNARY,c.aruku_interfaces.proto.Empty,c.aruku_interfaces.proto.ConfigWalking,function(e){return e.serializeBinary()},c.aruku_interfaces.proto.ConfigWalking.deserializeBinary);c.aruku_interfaces.proto.ConfigClient.prototype.getConfig=function(e,a,n){return this.client_.rpcCall(this.hostname_+"/aruku_interfaces.proto.Config/GetConfig",e,a||{},T,n)};c.aruku_interfaces.proto.ConfigPromiseClient.prototype.getConfig=function(e,a){return this.client_.unaryCall(this.hostname_+"/aruku_interfaces.proto.Config/GetConfig",e,a||{},T)};const V=new C.web.MethodDescriptor("/aruku_interfaces.proto.Config/SaveConfig",C.web.MethodType.UNARY,c.aruku_interfaces.proto.ConfigWalking,c.aruku_interfaces.proto.Empty,function(e){return e.serializeBinary()},c.aruku_interfaces.proto.Empty.deserializeBinary);c.aruku_interfaces.proto.ConfigClient.prototype.saveConfig=function(e,a,n){return this.client_.rpcCall(this.hostname_+"/aruku_interfaces.proto.Config/SaveConfig",e,a||{},V,n)};c.aruku_interfaces.proto.ConfigPromiseClient.prototype.saveConfig=function(e,a){return this.client_.unaryCall(this.hostname_+"/aruku_interfaces.proto.Config/SaveConfig",e,a||{},V)};const j=new C.web.MethodDescriptor("/aruku_interfaces.proto.Config/PublishConfig",C.web.MethodType.UNARY,c.aruku_interfaces.proto.ConfigWalking,c.aruku_interfaces.proto.Empty,function(e){return e.serializeBinary()},c.aruku_interfaces.proto.Empty.deserializeBinary);c.aruku_interfaces.proto.ConfigClient.prototype.publishConfig=function(e,a,n){return this.client_.rpcCall(this.hostname_+"/aruku_interfaces.proto.Config/PublishConfig",e,a||{},j,n)};c.aruku_interfaces.proto.ConfigPromiseClient.prototype.publishConfig=function(e,a){return this.client_.unaryCall(this.hostname_+"/aruku_interfaces.proto.Config/PublishConfig",e,a||{},j)};const z=new C.web.MethodDescriptor("/aruku_interfaces.proto.Config/SetMainConfig",C.web.MethodType.UNARY,c.aruku_interfaces.proto.SetWalking,c.aruku_interfaces.proto.Empty,function(e){return e.serializeBinary()},c.aruku_interfaces.proto.Empty.deserializeBinary);c.aruku_interfaces.proto.ConfigClient.prototype.setMainConfig=function(e,a,n){return this.client_.rpcCall(this.hostname_+"/aruku_interfaces.proto.Config/SetMainConfig",e,a||{},z,n)};c.aruku_interfaces.proto.ConfigPromiseClient.prototype.setMainConfig=function(e,a){return this.client_.unaryCall(this.hostname_+"/aruku_interfaces.proto.Config/SetMainConfig",e,a||{},z)};var d=c.aruku_interfaces.proto;const y=f.exports.createContext();function F(){const{GRPC_WEB_API_URL:e,setPublished:a,setKinematic:n,setWalking:r}=f.exports.useContext(y),o=new d.ConfigClient(e,null,null),i=new d.Empty,[l,_]=f.exports.useState(!1),g=()=>{_(!0),o.getConfig(i,{},(m,s)=>{m?console.log(`Unexpected error: code = ${m.code}, message = "${m.message}"`):(n(JSON.parse(s.array[0])),r(JSON.parse(s.array[1])))}),a(!1),_(!1)};return t.createElement(J,{onClick:g,color:"warning",variant:"contained",sx:{margin:1,top:5},loading:l},"Reload")}function K(){const{GRPC_WEB_API_URL:e,kinematic:a,walking:n}=f.exports.useContext(y),r=new d.ConfigClient(e,null,null),o=new d.ConfigWalking,[i,l]=f.exports.useState(!1),_=()=>{l(!0),o.setJsonKinematic(JSON.stringify(a)),o.setJsonWalking(JSON.stringify(n)),r.saveConfig(o,{},g=>{g&&console.log(`Unexpected error: code = ${g.code}, message = "${g.message}"`)}),l(!1)};return t.createElement(J,{onClick:_,color:"primary",variant:"contained",sx:{margin:1,top:5},loading:i},"Save")}const ge=x(S)(({theme:e})=>k(h({backgroundColor:e.palette.mode==="dark"?"#1A2027":"#fff"},e.typography.body2),{padding:e.spacing(1),textAlign:"center",color:e.palette.text.secondary})),pe=x(w)(({theme:e})=>({textAlign:"left",padding:e.spacing(1)})),N=x(w)(({theme:e})=>({textAlign:"center",padding:e.spacing(1)}));function D({name:e,value:a,type:n}){const{setMainValue:r,setWalkingValue:o}=f.exports.useContext(y);return t.createElement(ge,null,t.createElement(u,{container:!0,spacing:1},t.createElement(u,{item:!0,xs:6},t.createElement(pe,null,e==="enable"?"AUTO_BALANCE":e.toUpperCase())),t.createElement(u,{item:!0,xs:!0},t.createElement(N,null," OFF ")),t.createElement(u,{item:!0,xs:!0},t.createElement(te,{onChange:n==="main"?i=>{r(e,i.target.checked)}:i=>{o("balance",e,i.target.checked)},checked:a})),t.createElement(u,{item:!0,xs:!0},t.createElement(N,null," ON "))))}const _e=x(S)(({theme:e})=>k(h({backgroundColor:e.palette.mode==="dark"?"#1A2027":"#fff"},e.typography.body2),{padding:e.spacing(1),textAlign:"center",color:e.palette.text.secondary})),me=x(w)(({theme:e})=>({textAlign:"left",padding:e.spacing(1),fontSize:"0.9rem"}));function E(e){const{name:a,keys:n,value:r,type:o}=e,{setMainValue:i,setWalkingValue:l,setKinematicValue:_}=f.exports.useContext(y);function g(s){let p;if(o==="main")p*=10,i(n,r+p);else if(o==="walking"){switch(a){case"balance":p/=10;break;case"pid":p*=10;break;default:p=s;break}l(a,n,r+p)}else{switch(a){case"offset":switch(n){case"x_offset":case"y_offset":case"z_offset":p*=10;break;default:p=s;break}break;case"ratio":switch(n){case"foot_height":case"period_time":p*=10;break;default:p/=10;break}break;default:p=s;break}_(a,n,r+p)}}function m(s){o==="main"?i(n,s):o==="walking"?l(a,n,s):_(a,n,s)}return t.createElement(_e,null,t.createElement(u,{container:!0,spacing:1},t.createElement(u,{item:!0,xs:6},t.createElement(me,null,n.toUpperCase())),t.createElement(u,{item:!0,xs:1},t.createElement(v,{onClick:()=>g(-1)},t.createElement(ne,null))),t.createElement(u,{item:!0,xs:1},t.createElement(v,{onClick:()=>g(-.1)},t.createElement(ae,null))),t.createElement(u,{item:!0,xs:1.5},t.createElement(oe,{value:r,margin:"dense",type:"number",InputProps:{inputProps:{style:{textAlign:"center"}}},onChangeCapture:s=>{s.target.value===""?m(0):m(parseFloat(s.target.value))}})),t.createElement(u,{item:!0,xs:1},t.createElement(v,{onClick:()=>g(.1)},t.createElement(ie,null))),t.createElement(u,{item:!0,xs:1},t.createElement(v,{onClick:()=>g(1)},t.createElement(re,null)))))}function de(){const{GRPC_WEB_API_URL:e,main:a}=f.exports.useContext(y),n=new d.ConfigClient(e,null,null),r=new d.SetWalking,o=()=>{r.setRun(a.start),r.setXMove(a.x),r.setYMove(a.y),r.setAMove(a.a),r.setAimOn(a.aim),n.setMainConfig(r,{},(i,l)=>{console.log(i?`Unexpected error: code = ${i.code}, message = "${i.message}"`:l)})};return f.exports.useEffect(()=>{o()},[a]),t.createElement("div",null,Object.keys(a).map(i=>typeof a[i]=="boolean"?t.createElement(D,{name:i,value:a[i],type:"main"}):t.createElement(E,{keys:i,value:a[i],type:"main"})))}const $=x(S)(({theme:e})=>k(h({backgroundColor:e.palette.mode==="dark"?"#1A2027":"#fff"},e.typography.body2),{padding:e.spacing(1),textAlign:"center",color:e.palette.text.secondary}));function he(){const{GRPC_WEB_API_URL:e,walking:a,kinematic:n}=f.exports.useContext(y),r=()=>{const o=new d.ConfigClient(e,null,null),i=new d.ConfigWalking;i.setJsonKinematic(JSON.stringify(n)),i.setJsonWalking(JSON.stringify(a)),o.publishConfig(i,{},(l,_)=>{console.log(l?`Unexpected error: code = ${l.code}, message = "${l.message}"`:_)})};return f.exports.useEffect(()=>{r()},[a,n]),t.createElement(u,{container:!0,xs:12,md:10,lg:8},t.createElement(u,{item:!0,xs:12,md:10,lg:6,style:{marginTop:8}},t.createElement($,null,Object.keys(n.ratio).slice(1,12).map(o=>t.createElement(E,{name:"ratio",keys:o,value:n.ratio[o],type:"kinematic"})))),t.createElement(u,{item:!0,xs:12,md:10,lg:6,style:{marginTop:8}},t.createElement($,null,t.createElement(E,{name:"ratio",keys:"foot_accel_ratio",value:n.ratio.foot_accel_ratio,type:"kinematic"}),Object.keys(n.offset).map(o=>t.createElement(E,{name:"offset",keys:o,value:n.offset[o],type:"kinematic"})),Object.keys(a.odometry).map(o=>t.createElement(E,{name:"odometry",keys:o,value:a.odometry[o],type:"walking"})))))}const U=x(S)(({theme:e})=>k(h({backgroundColor:e.palette.mode==="dark"?"#1A2027":"#fff"},e.typography.body2),{padding:e.spacing(1),textAlign:"center",color:e.palette.text.secondary}));function ke(){const{GRPC_WEB_API_URL:e,published:a,walking:n,kinematic:r,setPublished:o,setKinematic:i,setWalking:l}=f.exports.useContext(y),_=new d.ConfigClient(e,null,null),g=new d.Empty,m=()=>{_.getConfig(g,{},(s,p)=>{s?console.log(`Unexpected error: code = ${s.code}, message = "${s.message}"`):(i(JSON.parse(p.array[0])),l(JSON.parse(p.array[1])))})};return f.exports.useEffect(()=>{a||(m(),o(!0))},[]),t.createElement(R,{sx:{flexGrow:1}},t.createElement(U,{onLoad:m},t.createElement(u,{container:!0,spacing:1},t.createElement(u,{item:!0,xs:12,md:8,lg:4},t.createElement(U,null,t.createElement(de,null),Object.keys(n.balance).map(s=>typeof n.balance[s]=="boolean"?t.createElement(D,{name:s,value:n.balance[s],type:"walking"}):t.createElement(E,{name:"balance",keys:s,value:n.balance[s],type:"walking"})),t.createElement(E,{name:"ratio",keys:"forward_hip_comp_ratio",value:r.ratio.forward_hip_comp_ratio,type:"kinematic"}))),t.createElement(he,null)),t.createElement(u,{container:!0,style:{justifyContent:"end"}},t.createElement(K,null),t.createElement(F,null))))}const G=x(S)(({theme:e})=>k(h({backgroundColor:e.palette.mode==="dark"?"#1A2027":"#fff"},e.typography.body2),{padding:e.spacing(1),textAlign:"center",color:e.palette.text.secondary}));function Ce(){const{GRPC_WEB_API_URL:e,kinematic:a,walking:n}=f.exports.useContext(y),r=()=>{const o=new d.ConfigClient(e,null,null),i=new d.ConfigWalking;i.setJsonKinematic(JSON.stringify(a)),i.setJsonWalking(JSON.stringify(n)),o.publishConfig(i,{},l=>{l&&console.log(`Unexpected error: code = ${l.code}, message = "${l.message}"`)})};return f.exports.useEffect(()=>{r()},[n]),t.createElement(u,{container:!0,spacing:2},t.createElement(u,{item:!0,xs:12,md:6},t.createElement(G,null,t.createElement(w,{variant:"h6",component:"div",sx:{padding:1}},"Left Foot"),Object.keys(n.init_angles).slice(0,9).map(o=>t.createElement(E,{name:"init_angles",keys:o,value:n.init_angles[o],type:"walking"})))),t.createElement(u,{item:!0,xs:12,md:6},t.createElement(G,null,t.createElement(w,{variant:"h6",component:"div",sx:{padding:1}},"Right Foot"),Object.keys(n.init_angles).slice(9,18).map(o=>t.createElement(E,{name:"init_angles",keys:o,value:n.init_angles[o],type:"walking"})))))}x(S)(({theme:e})=>k(h({backgroundColor:e.palette.mode==="dark"?"#1A2027":"#fff"},e.typography.body2),{padding:e.spacing(1),textAlign:"center",color:e.palette.text.secondary}));function ye(){const{GRPC_WEB_API_URL:e,published:a,setPublished:n,setKinematic:r,setWalking:o}=f.exports.useContext(y),i=new d.ConfigClient(e,null,null),l=new d.Empty,_=()=>{i.getConfig(l,{},(g,m)=>{g?console.log(`Unexpected error: code = ${g.code}, message = "${g.message}"`):(r(JSON.parse(m.array[0])),o(JSON.parse(m.array[1])))})};return f.exports.useEffect(()=>{a||(_(),n(!0))},[]),t.createElement(R,{sx:{flexGrow:1}},t.createElement(Ce,null),t.createElement(u,{container:!0,style:{justifyContent:"end"}},t.createElement(K,null),t.createElement(F,null)))}function Ee(){const e={}.VITE_GRPC_WEB_API_URL,[a,n]=f.exports.useState(!1),[r,o]=f.exports.useState({start:!1,x:0,y:0,a:0,aim:!1}),[i,l]=f.exports.useState({ratio:{forward_hip_comp_ratio:0,dsp_comp_ratio:0,period_time:0,swing_right_left:0,dsp_ratio:0,period_comp_ratio:0,swing_up_down:0,arm_swing_gain:0,backward_hip_comp_ratio:0,foot_comp_ratio:0,foot_height:0,move_accel_ratio:0,foot_accel_ratio:0},offset:{y_offset:0,roll_offset:0,hip_pitch_offset:0,pitch_offset:0,yaw_offset:0,z_offset:0,x_offset:0},length:{leg_length:0,thigh_length:0,calf_length:0,ankle_length:0}}),[_,g]=f.exports.useState({balance:{enable:!1,balance_knee_gain:0,balance_ankle_pitch_gain:0,balance_hip_roll_gain:0,balance_ankle_roll_gain:0},pid:{p_gain:10,i_gain:2,d_gain:3},odometry:{ry_coefficient:0,fx_coefficient:0,ly_coefficient:0},init_angles:{left_shoulder_pitch:0,left_shoulder_roll:0,left_elbow:0,left_hip_yaw:0,left_hip_roll:0,left_hip_pitch:0,left_knee:0,left_ankle_roll:0,left_ankle_pitch:0,right_shoulder_pitch:0,right_shoulder_roll:0,right_elbow:0,right_hip_yaw:0,right_hip_roll:0,right_hip_pitch:0,right_knee:0,right_ankle_roll:0,right_ankle_pitch:0},angles_direction:{left_shoulder_pitch:-1,left_shoulder_roll:-1,left_elbow:-1,right_shoulder_pitch:1,right_shoulder_roll:1,right_elbow:1,left_hip_yaw:-1,left_hip_roll:-1,left_hip_pitch:-1,left_knee:-1,left_ankle_roll:1,left_ankle_pitch:1,right_hip_yaw:-1,right_hip_roll:-1,right_hip_pitch:1,right_knee:1,right_ankle_roll:1,right_ankle_pitch:-1},length:{thigh_length:0,calf_length:0,ankle_length:0,leg_length:0}}),m=(b,A)=>{o(P=>k(h({},P),{[b]:A}))},s=(b,A,P)=>{g(W=>k(h({},W),{[b]:k(h({},W[b]),{[A]:P})}))},p=(b,A,P)=>{l(W=>k(h({},W),{[b]:k(h({},W[b]),{[A]:P})}))};return t.createElement(y.Provider,{value:{GRPC_WEB_API_URL:e,published:a,main:r,walking:_,kinematic:i,setPublished:n,setKinematic:l,setMain:o,setWalking:g,setMainValue:m,setWalkingValue:s,setKinematicValue:p}},t.createElement(le,null,t.createElement(fe,null),t.createElement(se,null,t.createElement(L,{path:"/",element:t.createElement(ke,null)}),t.createElement(L,{path:"/init",element:t.createElement(ye,null)}))))}ce.render(t.createElement(t.StrictMode,null,t.createElement(Ee,null)),document.getElementById("root")); diff --git a/assets/index.f0e6f991.js b/assets/index.f0e6f991.js deleted file mode 100644 index 04c6a1d..0000000 --- a/assets/index.f0e6f991.js +++ /dev/null @@ -1 +0,0 @@ -var q=Object.defineProperty,Y=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var I=(e,o,n)=>o in e?q(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,d=(e,o)=>{for(var n in o||(o={}))X.call(o,n)&&I(e,n,o[n]);if(B)for(var n of B(o))Q.call(o,n)&&I(e,n,o[n]);return e},h=(e,o)=>Y(e,H(o));import{R as t,B as R,A as Z,T as ee,a as b,b as O,N as M,r as f,L as J,s as E,P as w,G as u,S as te,I as v,d as ne,c as oe,e as ae,f as ie,g as re,h as le,i as se,j as L,k as ce}from"./vendor.ed4606ec.js";const ue=function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerpolicy&&(i.referrerPolicy=a.referrerpolicy),a.crossorigin==="use-credentials"?i.credentials="include":a.crossorigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=n(a);fetch(a.href,i)}};ue();function fe(){return t.createElement(R,{sx:{flexGrow:1}},t.createElement(Z,{position:"static"},t.createElement(ee,null,t.createElement(b,{variant:"h6",component:"div",sx:{flexGrow:1}},"Aruku App"),t.createElement(O,{component:M,to:"/",style:({isActive:e})=>({fontWeight:e?900:"normal"}),color:"inherit"},"Walk Settings"),t.createElement(O,{component:M,to:"/init",style:({isActive:e})=>({fontWeight:e?900:"normal"}),color:"inherit"},"Init Settings"))))}const C={};C.web=require("grpc-web");const c={};c.aruku_interfaces={};c.aruku_interfaces.proto=require("./aruku_pb.js");c.aruku_interfaces.proto.ConfigClient=function(e,o,n){n||(n={}),n.format="text",this.client_=new C.web.GrpcWebClientBase(n),this.hostname_=e.replace(/\/+$/,"")};c.aruku_interfaces.proto.ConfigPromiseClient=function(e,o,n){n||(n={}),n.format="text",this.client_=new C.web.GrpcWebClientBase(n),this.hostname_=e.replace(/\/+$/,"")};const T=new C.web.MethodDescriptor("/aruku_interfaces.proto.Config/GetConfig",C.web.MethodType.UNARY,c.aruku_interfaces.proto.Empty,c.aruku_interfaces.proto.ConfigWalking,function(e){return e.serializeBinary()},c.aruku_interfaces.proto.ConfigWalking.deserializeBinary);c.aruku_interfaces.proto.ConfigClient.prototype.getConfig=function(e,o,n){return this.client_.rpcCall(this.hostname_+"/aruku_interfaces.proto.Config/GetConfig",e,o||{},T,n)};c.aruku_interfaces.proto.ConfigPromiseClient.prototype.getConfig=function(e,o){return this.client_.unaryCall(this.hostname_+"/aruku_interfaces.proto.Config/GetConfig",e,o||{},T)};const V=new C.web.MethodDescriptor("/aruku_interfaces.proto.Config/SaveConfig",C.web.MethodType.UNARY,c.aruku_interfaces.proto.ConfigWalking,c.aruku_interfaces.proto.Empty,function(e){return e.serializeBinary()},c.aruku_interfaces.proto.Empty.deserializeBinary);c.aruku_interfaces.proto.ConfigClient.prototype.saveConfig=function(e,o,n){return this.client_.rpcCall(this.hostname_+"/aruku_interfaces.proto.Config/SaveConfig",e,o||{},V,n)};c.aruku_interfaces.proto.ConfigPromiseClient.prototype.saveConfig=function(e,o){return this.client_.unaryCall(this.hostname_+"/aruku_interfaces.proto.Config/SaveConfig",e,o||{},V)};const j=new C.web.MethodDescriptor("/aruku_interfaces.proto.Config/PublishConfig",C.web.MethodType.UNARY,c.aruku_interfaces.proto.ConfigWalking,c.aruku_interfaces.proto.Empty,function(e){return e.serializeBinary()},c.aruku_interfaces.proto.Empty.deserializeBinary);c.aruku_interfaces.proto.ConfigClient.prototype.publishConfig=function(e,o,n){return this.client_.rpcCall(this.hostname_+"/aruku_interfaces.proto.Config/PublishConfig",e,o||{},j,n)};c.aruku_interfaces.proto.ConfigPromiseClient.prototype.publishConfig=function(e,o){return this.client_.unaryCall(this.hostname_+"/aruku_interfaces.proto.Config/PublishConfig",e,o||{},j)};const z=new C.web.MethodDescriptor("/aruku_interfaces.proto.Config/SetMainConfig",C.web.MethodType.UNARY,c.aruku_interfaces.proto.SetWalking,c.aruku_interfaces.proto.Empty,function(e){return e.serializeBinary()},c.aruku_interfaces.proto.Empty.deserializeBinary);c.aruku_interfaces.proto.ConfigClient.prototype.setMainConfig=function(e,o,n){return this.client_.rpcCall(this.hostname_+"/aruku_interfaces.proto.Config/SetMainConfig",e,o||{},z,n)};c.aruku_interfaces.proto.ConfigPromiseClient.prototype.setMainConfig=function(e,o){return this.client_.unaryCall(this.hostname_+"/aruku_interfaces.proto.Config/SetMainConfig",e,o||{},z)};var m=c.aruku_interfaces.proto;const k=f.exports.createContext();function F(){const{GRPC_WEB_API_URL:e,setPublished:o,setKinematic:n,setWalking:r}=f.exports.useContext(k),a=new m.ConfigClient(e,null,null),i=new m.Empty,[l,p]=f.exports.useState(!1),g=()=>{p(!0),a.getConfig(i,{},(_,s)=>{_?console.log(`Unexpected error: code = ${_.code}, message = "${_.message}"`):(n(JSON.parse(s.array[0])),r(JSON.parse(s.array[1])))}),o(!1),p(!1)};return t.createElement(J,{onClick:g,color:"warning",variant:"contained",sx:{margin:1,top:5},loading:l},"Reload")}function K(){const{GRPC_WEB_API_URL:e,kinematic:o,walking:n}=f.exports.useContext(k),r=new m.ConfigClient(e,null,null),a=new m.ConfigWalking,[i,l]=f.exports.useState(!1),p=()=>{l(!0),a.setJsonKinematic(JSON.stringify(o)),a.setJsonWalking(JSON.stringify(n)),r.saveConfig(a,{},g=>{g&&console.log(`Unexpected error: code = ${g.code}, message = "${g.message}"`)}),l(!1)};return t.createElement(J,{onClick:p,color:"primary",variant:"contained",sx:{margin:1,top:5},loading:i},"Save")}const ge=E(w)(({theme:e})=>h(d({backgroundColor:e.palette.mode==="dark"?"#1A2027":"#fff"},e.typography.body2),{padding:e.spacing(1),textAlign:"center",color:e.palette.text.secondary})),pe=E(b)(({theme:e})=>({textAlign:"left",padding:e.spacing(1)})),N=E(b)(({theme:e})=>({textAlign:"center",padding:e.spacing(1)}));function D({name:e,value:o,type:n}){const{setMainValue:r,setWalkingValue:a}=f.exports.useContext(k);return t.createElement(ge,null,t.createElement(u,{container:!0,spacing:1},t.createElement(u,{item:!0,xs:6},t.createElement(pe,null,e==="enable"?"AUTO_BALANCE":e.toUpperCase())),t.createElement(u,{item:!0,xs:!0},t.createElement(N,null," OFF ")),t.createElement(u,{item:!0,xs:!0},t.createElement(te,{onChange:n==="main"?i=>{r(e,i.target.checked)}:i=>{a("balance",e,i.target.checked)},checked:o})),t.createElement(u,{item:!0,xs:!0},t.createElement(N,null," ON "))))}const _e=E(w)(({theme:e})=>h(d({backgroundColor:e.palette.mode==="dark"?"#1A2027":"#fff"},e.typography.body2),{padding:e.spacing(1),textAlign:"center",color:e.palette.text.secondary})),me=E(b)(({theme:e})=>({textAlign:"left",padding:e.spacing(1),fontSize:"0.9rem"}));function y(e){const{name:o,keys:n,value:r,type:a}=e,{setMainValue:i,setWalkingValue:l,setKinematicValue:p}=f.exports.useContext(k);function g(s){a==="main"?i(n,r+s):a==="walking"?l(o,n,r+s):p(o,n,r+s)}function _(s){a==="main"?i(n,s):a==="walking"?l(o,n,s):p(o,n,s)}return t.createElement(_e,null,t.createElement(u,{container:!0,spacing:1},t.createElement(u,{item:!0,xs:6},t.createElement(me,null,n.toUpperCase())),t.createElement(u,{item:!0,xs:1},t.createElement(v,{onClick:()=>g(-10)},t.createElement(ne,null))),t.createElement(u,{item:!0,xs:1},t.createElement(v,{onClick:()=>g(-1)},t.createElement(oe,null))),t.createElement(u,{item:!0,xs:1.5},t.createElement(ae,{value:r,margin:"dense",type:"number",InputProps:{inputProps:{style:{textAlign:"center"}}},onChangeCapture:s=>{s.target.value===""?_(0):_(parseFloat(s.target.value))}})),t.createElement(u,{item:!0,xs:1},t.createElement(v,{onClick:()=>g(1)},t.createElement(ie,null))),t.createElement(u,{item:!0,xs:1},t.createElement(v,{onClick:()=>g(10)},t.createElement(re,null)))))}function de(){const{GRPC_WEB_API_URL:e,main:o}=f.exports.useContext(k),n=new m.ConfigClient(e,null,null),r=new m.SetWalking,a=()=>{r.setRun(o.start),r.setXMove(o.x),r.setYMove(o.y),r.setAMove(o.a),r.setAimOn(o.aim),n.setMainConfig(r,{},(i,l)=>{console.log(i?`Unexpected error: code = ${i.code}, message = "${i.message}"`:l)})};return f.exports.useEffect(()=>{a()},[o]),t.createElement("div",null,Object.keys(o).map(i=>typeof o[i]=="boolean"?t.createElement(D,{name:i,value:o[i],type:"main"}):t.createElement(y,{keys:i,value:o[i],type:"main"})))}const $=E(w)(({theme:e})=>h(d({backgroundColor:e.palette.mode==="dark"?"#1A2027":"#fff"},e.typography.body2),{padding:e.spacing(1),textAlign:"center",color:e.palette.text.secondary}));function he(){const{GRPC_WEB_API_URL:e,walking:o,kinematic:n}=f.exports.useContext(k),r=()=>{const a=new m.ConfigClient(e,null,null),i=new m.ConfigWalking;i.setJsonKinematic(JSON.stringify(n)),i.setJsonWalking(JSON.stringify(o)),a.publishConfig(i,{},(l,p)=>{console.log(l?`Unexpected error: code = ${l.code}, message = "${l.message}"`:p)})};return f.exports.useEffect(()=>{r()},[o,n]),t.createElement(u,{container:!0,xs:12,md:10,lg:8},t.createElement(u,{item:!0,xs:12,md:10,lg:6,style:{marginTop:8}},t.createElement($,null,Object.keys(n.ratio).slice(1,12).map(a=>t.createElement(y,{name:"ratio",keys:a,value:n.ratio[a],type:"kinematic"})))),t.createElement(u,{item:!0,xs:12,md:10,lg:6,style:{marginTop:8}},t.createElement($,null,t.createElement(y,{name:"ratio",keys:"foot_accel_ratio",value:n.ratio.foot_accel_ratio,type:"kinematic"}),Object.keys(n.offset).map(a=>t.createElement(y,{name:"offset",keys:a,value:n.offset[a],type:"kinematic"})),Object.keys(o.odometry).map(a=>t.createElement(y,{name:"odometry",keys:a,value:o.odometry[a],type:"walking"})))))}const U=E(w)(({theme:e})=>h(d({backgroundColor:e.palette.mode==="dark"?"#1A2027":"#fff"},e.typography.body2),{padding:e.spacing(1),textAlign:"center",color:e.palette.text.secondary}));function Ce(){const{GRPC_WEB_API_URL:e,published:o,walking:n,kinematic:r,setPublished:a,setKinematic:i,setWalking:l}=f.exports.useContext(k),p=new m.ConfigClient(e,null,null),g=new m.Empty,_=()=>{p.getConfig(g,{},(s,W)=>{s?console.log(`Unexpected error: code = ${s.code}, message = "${s.message}"`):(i(JSON.parse(W.array[0])),l(JSON.parse(W.array[1])))})};return f.exports.useEffect(()=>{o||(_(),a(!0))},[]),t.createElement(R,{sx:{flexGrow:1}},t.createElement(U,{onLoad:_},t.createElement(u,{container:!0,spacing:1},t.createElement(u,{item:!0,xs:12,md:8,lg:4},t.createElement(U,null,t.createElement(de,null),Object.keys(n.balance).map(s=>typeof n.balance[s]=="boolean"?t.createElement(D,{name:s,value:n.balance[s],type:"walking"}):t.createElement(y,{name:"balance",keys:s,value:n.balance[s],type:"walking"})),t.createElement(y,{name:"ratio",keys:"forward_hip_comp_ratio",value:r.ratio.forward_hip_comp_ratio,type:"kinematic"}))),t.createElement(he,null)),t.createElement(u,{container:!0,style:{justifyContent:"end"}},t.createElement(K,null),t.createElement(F,null))))}const G=E(w)(({theme:e})=>h(d({backgroundColor:e.palette.mode==="dark"?"#1A2027":"#fff"},e.typography.body2),{padding:e.spacing(1),textAlign:"center",color:e.palette.text.secondary}));function ke(){const{GRPC_WEB_API_URL:e,kinematic:o,walking:n}=f.exports.useContext(k),r=()=>{const a=new m.ConfigClient(e,null,null),i=new m.ConfigWalking;i.setJsonKinematic(JSON.stringify(o)),i.setJsonWalking(JSON.stringify(n)),a.publishConfig(i,{},l=>{l&&console.log(`Unexpected error: code = ${l.code}, message = "${l.message}"`)})};return f.exports.useEffect(()=>{r()},[n]),t.createElement(u,{container:!0,spacing:2},t.createElement(u,{item:!0,xs:12,md:6},t.createElement(G,null,t.createElement(b,{variant:"h6",component:"div",sx:{padding:1}},"Left Foot"),Object.keys(n.init_angles).slice(0,9).map(a=>t.createElement(y,{name:"init_angles",keys:a,value:n.init_angles[a],type:"walking"})))),t.createElement(u,{item:!0,xs:12,md:6},t.createElement(G,null,t.createElement(b,{variant:"h6",component:"div",sx:{padding:1}},"Right Foot"),Object.keys(n.init_angles).slice(9,18).map(a=>t.createElement(y,{name:"init_angles",keys:a,value:n.init_angles[a],type:"walking"})))))}E(w)(({theme:e})=>h(d({backgroundColor:e.palette.mode==="dark"?"#1A2027":"#fff"},e.typography.body2),{padding:e.spacing(1),textAlign:"center",color:e.palette.text.secondary}));function ye(){const{GRPC_WEB_API_URL:e,published:o,setPublished:n,setKinematic:r,setWalking:a}=f.exports.useContext(k),i=new m.ConfigClient(e,null,null),l=new m.Empty,p=()=>{i.getConfig(l,{},(g,_)=>{g?console.log(`Unexpected error: code = ${g.code}, message = "${g.message}"`):(r(JSON.parse(_.array[0])),a(JSON.parse(_.array[1])))})};return f.exports.useEffect(()=>{o||(p(),n(!0))},[]),t.createElement(R,{sx:{flexGrow:1}},t.createElement(ke,null),t.createElement(u,{container:!0,style:{justifyContent:"end"}},t.createElement(K,null),t.createElement(F,null)))}function Ee(){const e={}.VITE_GRPC_WEB_API_URL,[o,n]=f.exports.useState(!1),[r,a]=f.exports.useState({start:!1,x:0,y:0,a:0,aim:!1}),[i,l]=f.exports.useState({ratio:{forward_hip_comp_ratio:0,dsp_comp_ratio:0,period_time:0,swing_right_left:0,dsp_ratio:0,period_comp_ratio:0,swing_up_down:0,arm_swing_gain:0,backward_hip_comp_ratio:0,foot_comp_ratio:0,foot_height:0,move_accel_ratio:0,foot_accel_ratio:0},offset:{y_offset:0,roll_offset:0,hip_pitch_offset:0,pitch_offset:0,yaw_offset:0,z_offset:0,x_offset:0},length:{leg_length:0,thigh_length:0,calf_length:0,ankle_length:0}}),[p,g]=f.exports.useState({balance:{enable:!1,balance_knee_gain:0,balance_ankle_pitch_gain:0,balance_hip_roll_gain:0,balance_ankle_roll_gain:0},pid:{p_gain:10,i_gain:2,d_gain:3},odometry:{ry_coefficient:0,fx_coefficient:0,ly_coefficient:0},init_angles:{left_shoulder_pitch:0,left_shoulder_roll:0,left_elbow:0,left_hip_yaw:0,left_hip_roll:0,left_hip_pitch:0,left_knee:0,left_ankle_roll:0,left_ankle_pitch:0,right_shoulder_pitch:0,right_shoulder_roll:0,right_elbow:0,right_hip_yaw:0,right_hip_roll:0,right_hip_pitch:0,right_knee:0,right_ankle_roll:0,right_ankle_pitch:0},angles_direction:{left_shoulder_pitch:-1,left_shoulder_roll:-1,left_elbow:-1,right_shoulder_pitch:1,right_shoulder_roll:1,right_elbow:1,left_hip_yaw:-1,left_hip_roll:-1,left_hip_pitch:-1,left_knee:-1,left_ankle_roll:1,left_ankle_pitch:1,right_hip_yaw:-1,right_hip_roll:-1,right_hip_pitch:1,right_knee:1,right_ankle_roll:1,right_ankle_pitch:-1},length:{thigh_length:0,calf_length:0,ankle_length:0,leg_length:0}}),_=(x,S)=>{a(A=>h(d({},A),{[x]:S}))},s=(x,S,A)=>{g(P=>h(d({},P),{[x]:h(d({},P[x]),{[S]:A})}))},W=(x,S,A)=>{l(P=>h(d({},P),{[x]:h(d({},P[x]),{[S]:A})}))};return t.createElement(k.Provider,{value:{GRPC_WEB_API_URL:e,published:o,main:r,walking:p,kinematic:i,setPublished:n,setKinematic:l,setMain:a,setWalking:g,setMainValue:_,setWalkingValue:s,setKinematicValue:W}},t.createElement(le,null,t.createElement(fe,null),t.createElement(se,null,t.createElement(L,{path:"/",element:t.createElement(Ce,null)}),t.createElement(L,{path:"/init",element:t.createElement(ye,null)}))))}ce.render(t.createElement(t.StrictMode,null,t.createElement(Ee,null)),document.getElementById("root")); diff --git a/index.html b/index.html index 902e64c..dd4970c 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ - +