Spaces:
Running
Running
Fix set_target matrix format: send 4x4 nested array
Browse filesThe backend expects np.array() to produce a 4x4 matrix, so we need
to send nested arrays instead of a flat 16-element array.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- index.html +5 -4
index.html
CHANGED
|
@@ -664,11 +664,12 @@
|
|
| 664 |
const cy = Math.cos(yawRad), sy = Math.sin(yawRad);
|
| 665 |
const cp = Math.cos(pitchRad), sp = Math.sin(pitchRad);
|
| 666 |
|
|
|
|
| 667 |
const matrix = [
|
| 668 |
-
cy * cp, -sy, cy * sp, 0,
|
| 669 |
-
sy * cp, cy, sy * sp, 0,
|
| 670 |
-
-sp, 0, cp, 0,
|
| 671 |
-
0, 0, 0, 1
|
| 672 |
];
|
| 673 |
|
| 674 |
dataChannel.send(JSON.stringify({ set_target: matrix }));
|
|
|
|
| 664 |
const cy = Math.cos(yawRad), sy = Math.sin(yawRad);
|
| 665 |
const cp = Math.cos(pitchRad), sp = Math.sin(pitchRad);
|
| 666 |
|
| 667 |
+
// 4x4 transformation matrix (nested array for numpy compatibility)
|
| 668 |
const matrix = [
|
| 669 |
+
[cy * cp, -sy, cy * sp, 0],
|
| 670 |
+
[sy * cp, cy, sy * sp, 0],
|
| 671 |
+
[-sp, 0, cp, 0],
|
| 672 |
+
[0, 0, 0, 1]
|
| 673 |
];
|
| 674 |
|
| 675 |
dataChannel.send(JSON.stringify({ set_target: matrix }));
|