@@ -46,65 +46,90 @@ const uint16_t DataPort = 52100;
46
46
const uint8_t PacketHeaderLSB = (OCULUS_CHECK_ID & 0x00FF );
47
47
const uint8_t PacketHeaderMSB = (OCULUS_CHECK_ID & 0xFF00 ) >> 8 ;
48
48
49
- namespace Oculus_750KHz {
49
+ #define DEG2RAD (x ) (x * M_PI / 180.0 )
50
+
51
+ // ===================================================================
52
+ //
53
+ // New constants API which separates constants by both model
54
+ // and frequency band
55
+
56
+ namespace Oculus_M750d {
57
+ namespace Freq_750kHz {
50
58
const float ElevationBeamwidthDeg = 20.0 ;
51
- const float ElevationBeamwidthRad = 20.0 * M_PI / 180.0 ;
59
+ const float ElevationBeamwidthRad = DEG2RAD(ElevationBeamwidthDeg) ;
52
60
53
61
const float AzimuthBeamwidthDeg = 1.0 ;
54
- const float AzimuthBeamwidthRad = 1.0 * M_PI / 180.0 ;
62
+ const float AzimuthBeamwidthRad = DEG2RAD(AzimuthBeamwidthDeg) ;
55
63
56
- const float MaxRange = 120 ; // meters
57
- }; // namespace Oculus_750KHz
64
+ const float MaxRange = 120 ;
65
+ }; // namespace Freq_750kHz
58
66
59
- namespace Oculus_1200MHz_Old {
67
+ namespace Freq_1200kHz {
60
68
const float ElevationBeamwidthDeg = 12.0 ;
61
- const float ElevationBeamwidthRad = 12.0 * M_PI / 180.0 ;
69
+ const float ElevationBeamwidthRad = DEG2RAD(ElevationBeamwidthDeg) ;
62
70
63
71
const float AzimuthBeamwidthDeg = 0.6 ;
64
- const float AzimuthBeamwidthRad = 0.6 * M_PI / 180.0 ;
72
+ const float AzimuthBeamwidthRad = DEG2RAD(AzimuthBeamwidthDeg) ;
65
73
66
- // ! NOTE:(by LinZhao) for old generation 1.2MHz,
67
- // M750d max range is 40m, M1200d max range is 30m
68
- // Maybe set a specfic name for 1.2MHz, since
69
- // the beamwidth changes between generation and model ?
70
74
const float MaxRange = 40 ;
71
- }; // namespace Oculus_1200MHz_Old
75
+ }; // namespace Freq_1200kHz
76
+ }; // namespace Oculus_M750d
72
77
73
- namespace Oculus_1200MHz {
78
+ namespace Oculus_M1200d {
79
+ namespace Freq_1200kHz {
74
80
const float ElevationBeamwidthDeg = 20.0 ;
75
- const float ElevationBeamwidthRad = 20.0 * M_PI / 180.0 ;
81
+ const float ElevationBeamwidthRad = DEG2RAD(ElevationBeamwidthDeg) ;
76
82
77
83
const float AzimuthBeamwidthDeg = 0.6 ;
78
- const float AzimuthBeamwidthRad = 0.6 * M_PI / 180.0 ;
84
+ const float AzimuthBeamwidthRad = DEG2RAD(AzimuthBeamwidthDeg) ;
79
85
80
- // NOTE(lindzey): According to the spec sheet, max range is 30 m
81
- // at 1.2 MHz on the M3000d, but 40 m on the M1200d.
82
86
const float MaxRange = 40 ;
83
- }; // namespace Oculus_1200MHz
87
+ }; // namespace Freq_1200kHz
84
88
85
- namespace Oculus_2100MHz {
89
+ namespace Freq_2100kHz {
86
90
const float ElevationBeamwidthDeg = 12.0 ;
87
- const float ElevationBeamwidthRad = 12.0 * M_PI / 180.0 ;
91
+ const float ElevationBeamwidthRad = DEG2RAD(ElevationBeamwidthDeg) ;
88
92
89
93
const float AzimuthBeamwidthDeg = 0.4 ;
90
- const float AzimuthBeamwidthRad = 0.4 * M_PI / 180.0 ;
94
+ const float AzimuthBeamwidthRad = DEG2RAD(AzimuthBeamwidthDeg) ;
91
95
92
- // \todo These shouldn't be fixed, should read from Oculus.h
93
- // But I don't feel like dealing with their data structure
94
- const float MaxRange = 10 ; // meters
95
- }; // namespace Oculus_2100MHz
96
+ const float MaxRange = 10 ;
97
+ }; // namespace Freq_2100kHz
98
+ }; // namespace Oculus_M1200d
96
99
97
- namespace Oculus_3000MHz {
100
+ namespace Oculus_M3000d {
101
+ namespace Freq_1200kHz {
98
102
const float ElevationBeamwidthDeg = 20.0 ;
99
- const float ElevationBeamwidthRad = 20.0 * M_PI / 180.0 ;
103
+ const float ElevationBeamwidthRad = DEG2RAD(ElevationBeamwidthDeg) ;
100
104
101
- const float AzimuthBeamwidthDeg = 0.4 ;
102
- const float AzimuthBeamwidthRad = 0.4 * M_PI / 180.0 ;
105
+ const float AzimuthBeamwidthDeg = 0.6 ;
106
+ const float AzimuthBeamwidthRad = DEG2RAD(AzimuthBeamwidthDeg) ;
103
107
104
- // \todo These shouldn't be fixed, should read from Oculus.h
105
- // But I don't feel like dealing with their data structure
106
- const float MaxRange = 5 ; // meters
107
- }; // namespace Oculus_3000MHz
108
+ const float MaxRange = 30 ;
109
+ }; // namespace Freq_1200kHz
110
+
111
+ namespace Freq_3000kHz {
112
+ const float ElevationBeamwidthDeg = 20.0 ;
113
+ const float ElevationBeamwidthRad = DEG2RAD(ElevationBeamwidthDeg);
114
+
115
+ const float AzimuthBeamwidthDeg = 0.4 ;
116
+ const float AzimuthBeamwidthRad = DEG2RAD(AzimuthBeamwidthDeg);
117
+
118
+ const float MaxRange = 5 ;
119
+ }; // namespace Freq_3000kHz
120
+ }; // namespace Oculus_M3000d
121
+
122
+ // ===================================================================
123
+ //
124
+ // "Old"" constants API which only considered nominal frequency.
125
+ // So it can't handle the case where different models may have
126
+ // different performance at the same nominal center frequency.
127
+
128
+ // For backwards compatibility
129
+ namespace Oculus_750KHz = Oculus_M750d::Freq_750kHz;
130
+ namespace Oculus_1200MHz = Oculus_M1200d::Freq_1200kHz;
131
+ namespace Oculus_2100MHz = Oculus_M1200d::Freq_2100kHz;
132
+ namespace Oculus_3000MHz = Oculus_M3000d::Freq_3000kHz;
108
133
109
134
struct FlagBits {
110
135
// bit 0: 0 = interpret range as percent, 1 = interpret range as meters
0 commit comments