|
32 | 32 |
|
33 | 33 | #pragma once
|
34 | 34 |
|
| 35 | +#include <cmath> |
35 | 36 | #include <cstddef> // for size_t
|
36 | 37 | #include <string>
|
37 | 38 | #include <vector>
|
38 |
| -#include <cmath> |
39 | 39 |
|
40 | 40 | #include "Oculus/Oculus.h"
|
41 | 41 |
|
42 | 42 | namespace liboculus {
|
43 |
| - const uint16_t StatusBroadcastPort = 52102; |
44 |
| - const uint16_t DataPort = 52100; |
| 43 | +const uint16_t StatusBroadcastPort = 52102; |
| 44 | +const uint16_t DataPort = 52100; |
45 | 45 |
|
46 |
| - const uint8_t PacketHeaderLSB = (OCULUS_CHECK_ID & 0x00FF); |
47 |
| - const uint8_t PacketHeaderMSB = (OCULUS_CHECK_ID & 0xFF00) >> 8; |
| 46 | +const uint8_t PacketHeaderLSB = (OCULUS_CHECK_ID & 0x00FF); |
| 47 | +const uint8_t PacketHeaderMSB = (OCULUS_CHECK_ID & 0xFF00) >> 8; |
48 | 48 |
|
49 |
| - namespace Oculus_1200MHz { |
50 |
| - const float ElevationBeamwidthDeg = 20.0; |
51 |
| - const float ElevationBeamwidthRad = 20.0*M_PI/180.0; |
| 49 | +namespace Oculus_1200MHz { |
| 50 | +const float ElevationBeamwidthDeg = 20.0; |
| 51 | +const float ElevationBeamwidthRad = 20.0 * M_PI / 180.0; |
52 | 52 |
|
53 |
| - const float AzimuthBeamwidthDeg = 0.6; |
54 |
| - const float AzimuthBeamwidthRad = 0.6*M_PI/180.0; |
| 53 | +const float AzimuthBeamwidthDeg = 0.6; |
| 54 | +const float AzimuthBeamwidthRad = 0.6 * M_PI / 180.0; |
55 | 55 |
|
56 |
| - // NOTE(lindzey): According to the spec sheet, max range is 30 m |
57 |
| - // at 1.2 MHz on the M3000d, but 40 m on the M1200d. |
58 |
| - const float MaxRange = 40; |
59 |
| - }; |
| 56 | +// NOTE(lindzey): According to the spec sheet, max range is 30 m |
| 57 | +// at 1.2 MHz on the M3000d, but 40 m on the M1200d. |
| 58 | +const float MaxRange = 40; |
| 59 | +}; // namespace Oculus_1200MHz |
60 | 60 |
|
61 |
| - namespace Oculus_2100MHz { |
62 |
| - const float ElevationBeamwidthDeg = 12.0; |
63 |
| - const float ElevationBeamwidthRad = 12.0*M_PI/180.0; |
| 61 | +namespace Oculus_2100MHz { |
| 62 | +const float ElevationBeamwidthDeg = 12.0; |
| 63 | +const float ElevationBeamwidthRad = 12.0 * M_PI / 180.0; |
64 | 64 |
|
65 |
| - const float AzimuthBeamwidthDeg = 0.4; |
66 |
| - const float AzimuthBeamwidthRad = 0.4*M_PI/180.0; |
| 65 | +const float AzimuthBeamwidthDeg = 0.4; |
| 66 | +const float AzimuthBeamwidthRad = 0.4 * M_PI / 180.0; |
67 | 67 |
|
68 |
| - // \todo These shouldn't be fixed, should read from Oculus.h |
69 |
| - // But I don't feel like dealing with their data structure |
70 |
| - const float MaxRange = 10; // meters |
71 |
| - }; |
| 68 | +// \todo These shouldn't be fixed, should read from Oculus.h |
| 69 | +// But I don't feel like dealing with their data structure |
| 70 | +const float MaxRange = 10; // meters |
| 71 | +}; // namespace Oculus_2100MHz |
72 | 72 |
|
73 |
| - namespace Oculus_3000MHz { |
74 |
| - const float ElevationBeamwidthDeg = 20.0; |
75 |
| - const float ElevationBeamwidthRad = 20.0*M_PI/180.0; |
| 73 | +namespace Oculus_3000MHz { |
| 74 | +const float ElevationBeamwidthDeg = 20.0; |
| 75 | +const float ElevationBeamwidthRad = 20.0 * M_PI / 180.0; |
76 | 76 |
|
77 |
| - const float AzimuthBeamwidthDeg = 0.4; |
78 |
| - const float AzimuthBeamwidthRad = 0.4*M_PI/180.0; |
| 77 | +const float AzimuthBeamwidthDeg = 0.4; |
| 78 | +const float AzimuthBeamwidthRad = 0.4 * M_PI / 180.0; |
79 | 79 |
|
80 |
| - // \todo These shouldn't be fixed, should read from Oculus.h |
81 |
| - // But I don't feel like dealing with their data structure |
82 |
| - const float MaxRange = 5; // meters |
83 |
| - }; |
| 80 | +// \todo These shouldn't be fixed, should read from Oculus.h |
| 81 | +// But I don't feel like dealing with their data structure |
| 82 | +const float MaxRange = 5; // meters |
| 83 | +}; // namespace Oculus_3000MHz |
84 | 84 |
|
85 | 85 | struct FlagBits {
|
86 | 86 | // bit 0: 0 = interpret range as percent, 1 = interpret range as meters
|
87 | 87 | // bit 1: 0 = 8 bit data, 1 = 16 bit data
|
88 | 88 | // bit 2: 0 = wont send gain, 1 = send gain
|
89 | 89 | // bit 3: 0 = send full return message, 1 = send simple return message
|
90 | 90 | // bit 4: "gain assistance"?
|
91 |
| - // bit 6: use 512 beams (vs 256): email from Blueprint said to set flags |= 0x40 |
| 91 | + // bit 6: use 512 beams (vs 256): email from Blueprint said to set flags |= |
| 92 | + // 0x40 |
92 | 93 |
|
93 | 94 | static const uint8_t RangeAsMeters = (0x01) << 0;
|
94 |
| - static const uint8_t Data16Bits = (0x01) << 1; |
95 |
| - static const uint8_t DoSendGain = (0x01) << 2; |
96 |
| - static const uint8_t SimpleReturn = (0x01) << 3; |
| 95 | + static const uint8_t Data16Bits = (0x01) << 1; |
| 96 | + static const uint8_t DoSendGain = (0x01) << 2; |
| 97 | + static const uint8_t SimpleReturn = (0x01) << 3; |
97 | 98 | static const uint8_t GainAssistance = (0x01) << 4;
|
98 |
| - static const uint8_t Do512Beams = (0x01) << 6; |
| 99 | + static const uint8_t Do512Beams = (0x01) << 6; |
99 | 100 | };
|
100 | 101 |
|
101 |
| - // There doesn't appear to be an enum for the masterMode (like there is |
102 |
| - // for pingRate and dataSize), so creating our own to match comments in |
103 |
| - // liboculus/thirdparty/Oculus/Oculus.h. |
104 |
| - typedef enum { |
105 |
| - OCULUS_LOW_FREQ = 1, |
106 |
| - OCULUS_HIGH_FREQ = 2 |
107 |
| - } OculusFreqMode; |
108 |
| - |
| 102 | +// There doesn't appear to be an enum for the masterMode (like there is |
| 103 | +// for pingRate and dataSize), so creating our own to match comments in |
| 104 | +// liboculus/thirdparty/Oculus/Oculus.h. |
| 105 | +typedef enum { OCULUS_LOW_FREQ = 1, OCULUS_HIGH_FREQ = 2 } OculusFreqMode; |
109 | 106 |
|
110 | 107 | } // namespace liboculus
|
0 commit comments