@@ -46,65 +46,90 @@ const uint16_t DataPort = 52100;
4646const uint8_t PacketHeaderLSB = (OCULUS_CHECK_ID & 0x00FF );
4747const uint8_t PacketHeaderMSB = (OCULUS_CHECK_ID & 0xFF00 ) >> 8 ;
4848
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 {
5058const float ElevationBeamwidthDeg = 20.0 ;
51- const float ElevationBeamwidthRad = 20.0 * M_PI / 180.0 ;
59+ const float ElevationBeamwidthRad = DEG2RAD(ElevationBeamwidthDeg) ;
5260
5361const float AzimuthBeamwidthDeg = 1.0 ;
54- const float AzimuthBeamwidthRad = 1.0 * M_PI / 180.0 ;
62+ const float AzimuthBeamwidthRad = DEG2RAD(AzimuthBeamwidthDeg) ;
5563
56- const float MaxRange = 120 ; // meters
57- }; // namespace Oculus_750KHz
64+ const float MaxRange = 120 ;
65+ }; // namespace Freq_750kHz
5866
59- namespace Oculus_1200MHz_Old {
67+ namespace Freq_1200kHz {
6068const float ElevationBeamwidthDeg = 12.0 ;
61- const float ElevationBeamwidthRad = 12.0 * M_PI / 180.0 ;
69+ const float ElevationBeamwidthRad = DEG2RAD(ElevationBeamwidthDeg) ;
6270
6371const float AzimuthBeamwidthDeg = 0.6 ;
64- const float AzimuthBeamwidthRad = 0.6 * M_PI / 180.0 ;
72+ const float AzimuthBeamwidthRad = DEG2RAD(AzimuthBeamwidthDeg) ;
6573
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 ?
7074const float MaxRange = 40 ;
71- }; // namespace Oculus_1200MHz_Old
75+ }; // namespace Freq_1200kHz
76+ }; // namespace Oculus_M750d
7277
73- namespace Oculus_1200MHz {
78+ namespace Oculus_M1200d {
79+ namespace Freq_1200kHz {
7480const float ElevationBeamwidthDeg = 20.0 ;
75- const float ElevationBeamwidthRad = 20.0 * M_PI / 180.0 ;
81+ const float ElevationBeamwidthRad = DEG2RAD(ElevationBeamwidthDeg) ;
7682
7783const float AzimuthBeamwidthDeg = 0.6 ;
78- const float AzimuthBeamwidthRad = 0.6 * M_PI / 180.0 ;
84+ const float AzimuthBeamwidthRad = DEG2RAD(AzimuthBeamwidthDeg) ;
7985
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.
8286const float MaxRange = 40 ;
83- }; // namespace Oculus_1200MHz
87+ }; // namespace Freq_1200kHz
8488
85- namespace Oculus_2100MHz {
89+ namespace Freq_2100kHz {
8690const float ElevationBeamwidthDeg = 12.0 ;
87- const float ElevationBeamwidthRad = 12.0 * M_PI / 180.0 ;
91+ const float ElevationBeamwidthRad = DEG2RAD(ElevationBeamwidthDeg) ;
8892
8993const float AzimuthBeamwidthDeg = 0.4 ;
90- const float AzimuthBeamwidthRad = 0.4 * M_PI / 180.0 ;
94+ const float AzimuthBeamwidthRad = DEG2RAD(AzimuthBeamwidthDeg) ;
9195
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
9699
97- namespace Oculus_3000MHz {
100+ namespace Oculus_M3000d {
101+ namespace Freq_1200kHz {
98102const float ElevationBeamwidthDeg = 20.0 ;
99- const float ElevationBeamwidthRad = 20.0 * M_PI / 180.0 ;
103+ const float ElevationBeamwidthRad = DEG2RAD(ElevationBeamwidthDeg) ;
100104
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) ;
103107
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;
108133
109134struct FlagBits {
110135 // bit 0: 0 = interpret range as percent, 1 = interpret range as meters
0 commit comments