feat: Initializer version v1.0.0

This commit is contained in:
Su Yang 2025-05-26 14:40:25 +08:00
parent 9466c4bf1a
commit fca11ccc44
No known key found for this signature in database
GPG Key ID: DBCDD8CBF440F8DE
6 changed files with 3713 additions and 0 deletions

37
go.mod Normal file
View File

@ -0,0 +1,37 @@
module hands
go 1.24.1
require (
github.com/gin-contrib/cors v1.7.5
github.com/gin-gonic/gin v1.10.1
)
require (
github.com/bytedance/sonic v1.13.2 // indirect
github.com/bytedance/sonic/loader v0.2.4 // indirect
github.com/cloudwego/base64x v0.1.5 // indirect
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
github.com/gin-contrib/sse v1.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.26.0 // indirect
github.com/goccy/go-json v0.10.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.17.0 // indirect
golang.org/x/crypto v0.38.0 // indirect
golang.org/x/net v0.40.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.25.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

94
go.sum Normal file
View File

@ -0,0 +1,94 @@
github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ=
github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY=
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
github.com/gin-contrib/cors v1.7.5 h1:cXC9SmofOrRg0w9PigwGlHG3ztswH6bqq4vJVXnvYMk=
github.com/gin-contrib/cors v1.7.5/go.mod h1:4q3yi7xBEDDWKapjT2o1V7mScKDDr8k+jZ0fSquGoy0=
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ=
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
golang.org/x/arch v0.17.0 h1:4O3dfLzd+lQewptAHqjewQZQDyEdejz3VwgeYwkZneU=
golang.org/x/arch v0.17.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=

1346
main.go Normal file

File diff suppressed because it is too large Load Diff

232
static/index.html Normal file
View File

@ -0,0 +1,232 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>灵巧手 Linker Hand L10 控制面板</title>
<link rel="stylesheet" href="/static/styles.css">
</head>
<body>
<h1>灵巧手 Linker Hand L10 控制面板</h1>
<!-- 手部配置面板 -->
<div class="hands-config">
<h3>🤖 手部配置管理</h3>
<div style="display: flex; gap: 10px; margin-bottom: 15px;">
<button id="refresh-all" class="refresh-button">刷新所有接口</button>
<button onclick="debugSystemStatus()" class="refresh-button" style="background-color: #e67e22;">🔍 系统调试</button>
</div>
<div class="hands-grid" id="hands-grid">
<!-- 手部配置项将在这里动态生成 -->
</div>
</div>
<!-- 连接警告 -->
<div class="connection-warning" id="connection-warning">
⚠️ CAN 服务连接异常,请检查服务状态或网络连接
</div>
<!-- 全局控制 -->
<div class="global-controls">
<h4>🎮 全局控制</h4>
<div class="control-buttons-grid">
<button id="send-all-finger-poses" class="global">发送所有手指姿态</button>
<button id="send-all-palm-poses" class="global">发送所有掌部姿态</button>
<button id="reset-all-hands" class="stop">重置所有手部</button>
<button id="stop-all-animations" class="stop">停止所有动画</button>
</div>
</div>
<div class="container">
<div class="control-panel">
<h2>手指控制 <span class="info-badge">指令0x01</span></h2>
<div class="slider-group">
<h3>手指关节控制</h3>
<div class="slider-container">
<div class="slider-label">
<span>拇指 (Thumb)</span>
<span class="value-display" id="finger0-value">64</span>
</div>
<input type="range" id="finger0" class="finger-slider" min="0" max="255" value="64">
</div>
<div class="slider-container">
<div class="slider-label">
<span>拇指转动 (Thumb Rotate)</span>
<span class="value-display" id="finger1-value">64</span>
</div>
<input type="range" id="finger1" class="finger-slider" min="0" max="255" value="64">
</div>
<div class="slider-container">
<div class="slider-label">
<span>食指 (Index)</span>
<span class="value-display" id="finger2-value">64</span>
</div>
<input type="range" id="finger2" class="finger-slider" min="0" max="255" value="64">
</div>
<div class="slider-container">
<div class="slider-label">
<span>中指 (Middle)</span>
<span class="value-display" id="finger3-value">64</span>
</div>
<input type="range" id="finger3" class="finger-slider" min="0" max="255" value="64">
</div>
<div class="slider-container">
<div class="slider-label">
<span>无名指 (Ring)</span>
<span class="value-display" id="finger4-value">64</span>
</div>
<input type="range" id="finger4" class="finger-slider" min="0" max="255" value="64">
</div>
<div class="slider-container">
<div class="slider-label">
<span>小指 (Pinky)</span>
<span class="value-display" id="finger5-value">64</span>
</div>
<input type="range" id="finger5" class="finger-slider" min="0" max="255" value="64">
</div>
</div>
<div class="slider-group">
<h3>掌部控制 <span class="info-badge">指令0x04</span></h3>
<div class="slider-container">
<div class="slider-label">
<span>关节 7</span>
<span class="value-display" id="palm0-value">128</span>
</div>
<input type="range" id="palm0" class="finger-slider" min="0" max="255" value="128">
</div>
<div class="slider-container">
<div class="slider-label">
<span>关节 8</span>
<span class="value-display" id="palm1-value">128</span>
</div>
<input type="range" id="palm1" class="finger-slider" min="0" max="255" value="128">
</div>
<div class="slider-container">
<div class="slider-label">
<span>关节 9</span>
<span class="value-display" id="palm2-value">128</span>
</div>
<input type="range" id="palm2" class="finger-slider" min="0" max="255" value="128">
</div>
<div class="slider-container">
<div class="slider-label">
<span>关节 10</span>
<span class="value-display" id="palm3-value">128</span>
</div>
<input type="range" id="palm3" class="finger-slider" min="0" max="255" value="128">
</div>
</div>
</div>
<div class="animation-panel">
<h2>预设动作</h2>
<div class="preset-grid">
<button class="preset" id="pose-fist">握拳</button>
<button class="preset" id="pose-open">张开</button>
<button class="preset" id="pose-pinch">捏取</button>
<button class="preset" id="pose-point">食指指点</button>
<button class="preset" id="pose-yeah">Yeah</button>
<button class="preset" id="pose-thumbs-up">竖起大拇指</button>
<button class="preset" id="pose-wave">手指波浪</button>
<button class="preset" id="pose-big-fist">紧握拳</button>
<button class="preset" id="pose-big-open">完全张开</button>
<button class="preset" id="pose-yo">Yo!</button>
<button class="preset" id="pose-gun">PONG</button>
<button class="preset" id="pose-ok">OK!</button>
</div>
<h3>NUM Pose</h3>
<div class="preset-grid">
<button class="preset-num-pose" id="pose-1">1</button>
<button class="preset-num-pose" id="pose-2">2</button>
<button class="preset-num-pose" id="pose-3">3</button>
<button class="preset-num-pose" id="pose-4">4</button>
<button class="preset-num-pose" id="pose-5">5</button>
<button class="preset-num-pose" id="pose-6">6</button>
<button class="preset-num-pose" id="pose-7">7</button>
<button class="preset-num-pose" id="pose-8">8</button>
<button class="preset-num-pose" id="pose-9">9</button>
<button onclick="triggerButtonsSequentially()">auto</button>
<button id="refill-core">Refill core</button>
<button onclick="window.startSequentialHandAnimation()">SequentialHandAnimation</button>
<button onclick="window.startCustomSequentialAnimation()">CustomSequentialAnimation</button>
<button onclick="window.startWaveAnimation()">WaveAnimation</button>
<button onclick="window.startThumbsUpRelay()">ThumbsUpRelay</button>
<button onclick="window.startPointingRelay()">PointingRelay</button>
<button onclick="window.startNumberCountdown()">NumberCountdown</button>
<button onclick="window.startMexicanWave()">MexicanWave</button>
<button onclick="window.startFistOpenWave()">FistOpenWave</button>
<button onclick="window.startBidirectionalWave()">BidirectionalWave</button>
</div>
<h3 style="margin-top: 20px;">动画控制</h3>
<div class="animation-controls">
<div class="slider-container">
<div class="slider-label">
<span>动作速度 (毫秒)</span>
<span class="value-display" id="speed-value">500</span>
</div>
<input type="range" id="animation-speed" min="30" max="1000" step="30" value="500">
</div>
<div class="control-buttons">
<button id="start-wave">波浪动画</button>
<button id="start-sway">横向摆动</button>
<button id="stop-animation" class="stop">停止动画</button>
</div>
</div>
</div>
<div class="status-panel">
<h2>状态监控</h2>
<div class="status-output" id="status-log">
<div class="log-entry">
<span class="status-indicator status-info"></span>
<span class="log-timestamp">00:00:00</span>
正在初始化系统...
</div>
</div>
<div style="margin-top: 15px;">
<h3>启用的手部状态</h3>
<div style="background-color: #f8f9fa; padding: 10px; border-radius: 5px;">
<div id="enabled-hands-status">等待更新...</div>
</div>
</div>
<div style="margin-top: 15px;">
<h3>传感器数据 (TBD)</h3>
<div style="background-color: #f8f9fa; padding: 10px; border-radius: 5px;">
<div id="sensor-data">等待更新...</div>
</div>
</div>
</div>
</div>
<footer>
<p style="
font-style: italic;
font-size: 12px;
padding: 12px;">使用 CAN 进行连接后,或许需要手动启动 Linux 网卡:<code style="
border: 1px solid pink;
padding: 4px;
border-radius: 4px;
background: #0a0a0a;
font-size: 10px;
color: #fff;">sudo ip link set can0 up type can bitrate 1000000</code></p>
</footer>
<script src="/static/script.js"></script>
</body>
</html>

1649
static/script.js Normal file

File diff suppressed because it is too large Load Diff

355
static/styles.css Normal file
View File

@ -0,0 +1,355 @@
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
padding: 20px;
max-width: 1800px;
margin: 0 auto;
background-color: #f5f5f7;
color: #333;
}
.container {
display: flex;
flex-wrap: wrap;
gap: 20px;
}
.control-panel, .status-panel, .animation-panel {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
flex: 1;
min-width: 300px;
}
h1, h2, h3 {
color: #2c3e50;
}
/* 手部配置面板 */
.hands-config {
background-color: #e8f4fd;
padding: 20px;
border-radius: 10px;
margin-bottom: 20px;
border-left: 4px solid #3498db;
}
.hands-config h3 {
margin-top: 0;
margin-bottom: 15px;
color: #2980b9;
}
.hands-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 15px;
}
.hand-item {
background: white;
padding: 15px;
border-radius: 8px;
border: 2px solid transparent;
transition: all 0.3s ease;
}
.hand-item.enabled {
border-color: #27ae60;
box-shadow: 0 2px 8px rgba(39, 174, 96, 0.2);
}
.hand-item.disabled {
opacity: 0.6;
background-color: #f8f9fa;
}
.hand-header {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 10px;
}
.hand-checkbox {
width: 18px;
height: 18px;
accent-color: #27ae60;
}
.hand-title {
font-weight: bold;
font-size: 16px;
}
.hand-controls {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
margin-top: 10px;
}
.control-group {
display: flex;
flex-direction: column;
gap: 5px;
}
.control-label {
font-size: 12px;
color: #666;
font-weight: 500;
}
.hand-select {
padding: 6px 8px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
}
.hand-status {
display: flex;
align-items: center;
gap: 5px;
margin-top: 8px;
font-size: 12px;
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
display: inline-block;
}
.status-dot.online {
background-color: #27ae60;
}
.status-dot.offline {
background-color: #e74c3c;
}
.status-dot.loading {
background-color: #f39c12;
animation: pulse 1s infinite;
}
@keyframes pulse {
0% { opacity: 1; }
50% { opacity: 0.5; }
100% { opacity: 1; }
}
/* 控制按钮区域 */
.global-controls {
background-color: #fff3cd;
padding: 15px;
border-radius: 8px;
margin-bottom: 20px;
border-left: 4px solid #ffc107;
}
.global-controls h4 {
margin: 0 0 10px 0;
color: #856404;
}
.control-buttons-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 10px;
}
.slider-container {
margin: 15px 0;
}
.slider-label {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
}
.finger-slider {
width: 100%;
}
.value-display {
width: 40px;
text-align: center;
font-weight: bold;
}
.control-buttons {
display: flex;
gap: 10px;
margin-top: 20px;
flex-wrap: wrap;
}
button {
padding: 10px 15px;
background-color: #3498db;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #2980b9;
}
button:disabled {
background-color: #bdc3c7;
cursor: not-allowed;
}
button.preset {
background-color: #27ae60;
}
button.preset:hover {
background-color: #219955;
}
button.stop {
background-color: #e74c3c;
}
button.stop:hover {
background-color: #c0392b;
}
button.global {
background-color: #f39c12;
}
button.global:hover {
background-color: #e67e22;
}
.refresh-button {
background-color: #9b59b6;
padding: 6px 10px;
font-size: 12px;
}
.refresh-button:hover {
background-color: #8e44ad;
}
.status-output {
background-color: #f8f9fa;
border: 1px solid #eee;
border-radius: 5px;
padding: 10px;
font-family: monospace;
height: 300px;
overflow-y: auto;
}
.log-entry {
margin-bottom: 5px;
padding: 5px;
border-bottom: 1px solid #eee;
}
.log-entry:last-child {
border-bottom: none;
}
.status-indicator {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 50%;
margin-right: 5px;
}
.log-timestamp {
color: #7f8c8d;
font-size: 0.8em;
margin-right: 5px;
}
.status-success {
background-color: #2ecc71;
}
.status-error {
background-color: #e74c3c;
}
.status-info {
background-color: #3498db;
}
.animation-controls {
display: flex;
flex-direction: column;
gap: 10px;
}
.preset-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 10px;
margin-top: 10px;
}
.slider-group {
background-color: #f8f9fa;
padding: 15px;
border-radius: 8px;
margin-bottom: 10px;
}
.slider-group h3 {
margin-top: 0;
font-size: 1.1em;
}
.info-badge {
display: inline-block;
font-size: 0.7em;
padding: 2px 5px;
background-color: #95a5a6;
color: white;
border-radius: 3px;
margin-left: 5px;
vertical-align: middle;
}
.connection-warning {
background-color: #fff3cd;
border: 1px solid #ffeeba;
color: #856404;
padding: 10px;
border-radius: 5px;
margin-bottom: 15px;
display: none;
}
/* 响应式调整 */
@media (max-width: 1200px) {
.container {
flex-direction: column;
}
.hands-grid {
grid-template-columns: 1fr;
}
}
@media (max-width: 768px) {
.hand-controls {
grid-template-columns: 1fr;
}
.control-buttons-grid {
grid-template-columns: 1fr;
}
}