Spaces:
Sleeping
Sleeping
File size: 8,841 Bytes
65da30d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RMScript Web Demo</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1400px;
margin: 0 auto;
background: white;
border-radius: 20px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
overflow: hidden;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0;
}
.panel {
padding: 30px;
}
.panel.editor-panel {
border-right: 1px solid #e0e0e0;
}
h1 {
color: #333;
margin-bottom: 10px;
font-size: 24px;
}
.subtitle {
color: #666;
margin-bottom: 20px;
font-size: 14px;
}
.status {
padding: 12px;
border-radius: 8px;
margin-bottom: 15px;
font-size: 14px;
display: flex;
justify-content: space-between;
align-items: center;
}
.status.idle {
background: #f5f5f5;
color: #666;
}
.status.success {
background: #d4edda;
color: #155724;
}
.status.error {
background: #f8d7da;
color: #721c24;
}
.status.connected {
background: #d4edda;
color: #155724;
}
.status.disconnected {
background: #f8d7da;
color: #721c24;
}
.status-dot {
width: 10px;
height: 10px;
border-radius: 50%;
margin-right: 8px;
display: inline-block;
}
.status-dot.green {
background: #28a745;
box-shadow: 0 0 10px #28a745;
}
.status-dot.red {
background: #dc3545;
}
.status-dot.gray {
background: #999;
}
.editor {
width: 100%;
min-height: 400px;
padding: 15px;
font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
font-size: 14px;
border: 2px solid #e0e0e0;
border-radius: 8px;
resize: vertical;
margin-bottom: 15px;
line-height: 1.5;
}
.editor:focus {
outline: none;
border-color: #667eea;
}
.button-group {
display: flex;
gap: 10px;
margin-bottom: 20px;
}
button {
background: #667eea;
color: white;
border: none;
padding: 12px 24px;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
flex: 1;
}
button:hover:not(:disabled) {
background: #5568d3;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
button:active:not(:disabled) {
transform: translateY(0);
}
button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
button.secondary {
background: #6c757d;
}
button.secondary:hover:not(:disabled) {
background: #5a6268;
}
button.danger {
background: #dc3545;
}
button.danger:hover:not(:disabled) {
background: #c82333;
}
.console {
background: #1e1e1e;
color: #d4d4d4;
padding: 15px;
border-radius: 8px;
font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
font-size: 12px;
max-height: 300px;
overflow-y: auto;
line-height: 1.6;
}
.console-line {
margin-bottom: 4px;
}
.console-line.error {
color: #f48771;
}
.console-line.warning {
color: #dcdcaa;
}
.console-line.success {
color: #4ec9b0;
}
.console-line.info {
color: #9cdcfe;
}
.section-title {
font-size: 16px;
font-weight: 600;
color: #333;
margin-bottom: 10px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.example-buttons {
display: flex;
gap: 8px;
margin-bottom: 15px;
flex-wrap: wrap;
}
.example-buttons button {
flex: 0 1 auto;
padding: 8px 16px;
font-size: 12px;
}
.ir-display {
background: #f8f9fa;
padding: 15px;
border-radius: 8px;
max-height: 300px;
overflow-y: auto;
font-size: 13px;
margin-top: 15px;
}
.ir-action {
background: white;
padding: 10px;
margin-bottom: 8px;
border-radius: 4px;
border-left: 4px solid #667eea;
}
.ir-action-type {
font-weight: 600;
color: #667eea;
margin-bottom: 4px;
}
.ir-action-details {
font-size: 12px;
color: #666;
font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}
</style>
</head>
<body>
<div class="container">
<!-- Left Panel: Editor -->
<div class="panel editor-panel">
<h1>🤖 RMScript Editor</h1>
<p class="subtitle">Write and test your rmscript code</p>
<div id="compileStatus" class="status idle">
<span><span class="status-dot gray"></span>Ready</span>
</div>
<div class="section-title">Examples</div>
<div class="example-buttons">
<button class="secondary" onclick="loadExample('basic')">Basic</button>
<button class="secondary" onclick="loadExample('complex')">Complex</button>
<button class="secondary" onclick="loadExample('repeat')">Repeat</button>
<button class="secondary" onclick="clearEditor()">Clear</button>
</div>
<textarea id="editor" class="editor" placeholder="DESCRIPTION My robot script
look left
wait 1s
look right"></textarea>
<div class="button-group">
<button onclick="verifyScript()">✓ Verify</button>
<button id="executeBtn" onclick="executeScript()" disabled>â–¶ Execute</button>
</div>
<div class="section-title">Console</div>
<div id="console" class="console">
<div class="console-line info">Ready. Write some rmscript and click Verify!</div>
</div>
</div>
<!-- Right Panel: Robot Control -->
<div class="panel">
<h1>🔗 Robot Connection</h1>
<p class="subtitle">Connect to Reachy Mini on localhost:8000</p>
<div id="robotStatus" class="status disconnected">
<span><span class="status-dot red"></span>Disconnected</span>
</div>
<div class="section-title">Compiled IR</div>
<div id="irDisplay" class="ir-display">
<div style="color: #999; text-align: center; padding: 20px;">
No IR yet. Verify a script first!
</div>
</div>
<div class="section-title" style="margin-top: 20px;">Execution Info</div>
<div id="executionInfo" class="console" style="max-height: 150px;">
<div class="console-line info">Ready to execute when robot is connected</div>
</div>
</div>
</div>
<!-- Load app.js with path that works both locally (file://) and on server -->
<script>
// Auto-detect correct path for app.js
const scriptSrc = window.location.protocol === 'file:'
? './app.js' // Local file access
: '/static/app.js'; // Served from web server
const script = document.createElement('script');
script.src = scriptSrc;
document.head.appendChild(script);
</script>
</body>
</html>
|