add decoder for orientation submodules

This commit is contained in:
2025-03-15 08:39:27 -05:00
parent 3c5cd86ae2
commit 122b546ba2
5 changed files with 123 additions and 0 deletions
+34
View File
@@ -35,6 +35,40 @@ const goodTests = [
},
decoder: Decoders.CentroidPosition,
},
{
description: 'Orientation (Quaternion)',
bytes: new Uint8Array([
0x03, 0x00, 37, 0x00, 0x10, 0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]),
expected: {
type: 0x03,
size: 37,
latency: 16,
Qx: 1.0,
Qy: 2.0,
Qz: 3.0,
Qw: 4.0,
},
decoder: Decoders.OrientationQuaternion,
},
{
description: 'Orientation (Euler)',
bytes: new Uint8Array([
0x04, 0x00, 31, 0x00, 0x10, 0x01, 0x23, 0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
]),
expected: {
type: 0x04,
size: 31,
latency: 16,
order: 0x0123,
r1: 1.0,
r2: 2.0,
r3: 3.0,
},
decoder: Decoders.OrientationEuler,
},
];
describe('RTTrP Bytes Decoding', () => {