Skip to content

Commit 41bdcd9

Browse files
authored
Merge pull request #163 from open-ephys-plugins/issue-148
Add input ranges for channels
2 parents bf9ef1c + 8e18d22 commit 41bdcd9

File tree

11 files changed

+130
-33
lines changed

11 files changed

+130
-33
lines changed

Source/Devices/AnalogIO.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ using namespace OnixSourcePlugin;
2727
AnalogIO::AnalogIO (std::string name, std::string hubName, const oni_dev_idx_t deviceIdx_, std::shared_ptr<Onix1> oni_ctx)
2828
: OnixDevice (name, hubName, AnalogIO::getDeviceType(), deviceIdx_, oni_ctx)
2929
{
30+
const ContinuousChannel::InputRange inputRange { -10.0f, 10.0f };
31+
3032
StreamInfo analogInputStream = StreamInfo (
3133
createStreamName ("AnalogInput", false),
3234
"Analog Input data",
@@ -38,7 +40,9 @@ AnalogIO::AnalogIO (std::string name, std::string hubName, const oni_dev_idx_t d
3840
getVoltsPerDivision (AnalogIOVoltageRange::TenVolts), // NB: +/- 10 Volts
3941
"V",
4042
{},
41-
{ "input" });
43+
{ "input" },
44+
{},
45+
{ inputRange });
4246
streamInfos.add (analogInputStream);
4347

4448
for (int i = 0; i < numFrames; i++)

Source/Devices/Bno055.cpp

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
3030
auto streamIdentifier = getStreamIdentifier();
3131

3232
std::string port = getPortName (deviceIdx);
33+
34+
const ContinuousChannel::InputRange eulerYawRange { -360.0f, 360.0f };
35+
const ContinuousChannel::InputRange eulerRollRange { -180.0f, 180.0f };
36+
const ContinuousChannel::InputRange eulerPitchRange { -90.0f, 90.0f };
37+
3338
StreamInfo eulerAngleStream = StreamInfo (
3439
createStreamName ("Euler"),
3540
"Bosch Bno055 9-axis inertial measurement unit (IMU) Euler angle",
@@ -39,12 +44,15 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
3944
"Eul",
4045
ContinuousChannel::Type::AUX,
4146
eulerAngleScale,
42-
"Degrees",
47+
"Deg.",
4348
{ "Y", "R", "P" },
4449
"euler",
45-
{ "y", "r", "p" });
50+
{ "y", "r", "p" },
51+
{ eulerYawRange, eulerRollRange, eulerPitchRange });
4652
streamInfos.add (eulerAngleStream);
4753

54+
const ContinuousChannel::InputRange quaternionRange { -1.0f, 1.0f };
55+
4856
StreamInfo quaternionStream = StreamInfo (
4957
createStreamName ("Quaternion"),
5058
"Bosch Bno055 9-axis inertial measurement unit (IMU) Quaternion",
@@ -54,12 +62,15 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
5462
"Quat",
5563
ContinuousChannel::Type::AUX,
5664
quaternionScale,
57-
"u", // NB: Quaternion data is unitless by definition
65+
"", // NB: Quaternion data is unitless by definition
5866
{ "W", "X", "Y", "Z" },
5967
"quaternion",
60-
{ "w", "x", "y", "z" });
68+
{ "w", "x", "y", "z" },
69+
{ quaternionRange });
6170
streamInfos.add (quaternionStream);
6271

72+
const ContinuousChannel::InputRange accelerationRange { -100.0f, 100.0f };
73+
6374
StreamInfo accelerationStream = StreamInfo (
6475
createStreamName ("Acceleration"),
6576
"Bosch Bno055 9-axis inertial measurement unit (IMU) Acceleration",
@@ -72,9 +83,12 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
7283
"m/s^2",
7384
{ "X", "Y", "Z" },
7485
"acceleration",
75-
{ "x", "y", "z" });
86+
{ "x", "y", "z" },
87+
{ accelerationRange });
7688
streamInfos.add (accelerationStream);
7789

90+
const ContinuousChannel::InputRange gravityRange { -10.0f, 10.0f };
91+
7892
StreamInfo gravityStream = StreamInfo (
7993
createStreamName ("Gravity"),
8094
"Bosch Bno055 9-axis inertial measurement unit (IMU) Gravity",
@@ -87,9 +101,12 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
87101
"m/s^2",
88102
{ "X", "Y", "Z" },
89103
"gravity",
90-
{ "x", "y", "z" });
104+
{ "x", "y", "z" },
105+
{ gravityRange });
91106
streamInfos.add (gravityStream);
92107

108+
const ContinuousChannel::InputRange temperatureRange { -100.0f, 100.0f };
109+
93110
StreamInfo temperatureStream = StreamInfo (
94111
createStreamName ("Temperature"),
95112
"Bosch Bno055 9-axis inertial measurement unit (IMU) Temperature",
@@ -99,11 +116,15 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
99116
"Temp",
100117
ContinuousChannel::Type::AUX,
101118
1.0f,
102-
"Celsius",
119+
String::fromUTF8 ("\xc2\xb0") + String ("C"), // NB: "\xc2\xb0" --> degree symbol
103120
{ "" },
104-
"temperature");
121+
"temperature",
122+
{},
123+
{ temperatureRange });
105124
streamInfos.add (temperatureStream);
106125

126+
const ContinuousChannel::InputRange calibrationRange { -3.0f, 3.0f };
127+
107128
StreamInfo calibrationStatusStream = StreamInfo (
108129
createStreamName ("Calibration"),
109130
"Bosch Bno055 9-axis inertial measurement unit (IMU) Calibration status",
@@ -116,7 +137,8 @@ Bno055::Bno055 (std::string name, std::string hubName, const oni_dev_idx_t devic
116137
"",
117138
{ "Mag", "Acc", "Gyr", "Sys" },
118139
"calibration",
119-
{ "magnetometer", "acceleration", "gyroscope", "system" });
140+
{ "magnetometer", "acceleration", "gyroscope", "system" },
141+
{ calibrationRange });
120142
streamInfos.add (calibrationStatusStream);
121143

122144
for (int i = 0; i < numFrames; i++)

Source/Devices/DigitalIO.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ using namespace OnixSourcePlugin;
2828
DigitalIO::DigitalIO (std::string name, std::string hubName, const oni_dev_idx_t deviceIdx_, std::shared_ptr<Onix1> oni_ctx)
2929
: OnixDevice (name, hubName, DigitalIO::getDeviceType(), deviceIdx_, oni_ctx)
3030
{
31+
const ContinuousChannel::InputRange digitalRange { 0.0f, 1.0f };
32+
3133
StreamInfo digitalInputStream = StreamInfo (
3234
createStreamName ({ getHubName(), name, "DigitalInputs" }),
3335
"Digital Inputs data",
@@ -39,7 +41,9 @@ DigitalIO::DigitalIO (std::string name, std::string hubName, const oni_dev_idx_t
3941
1.0,
4042
"u", // NB: Digital data is unitless by definition
4143
{},
42-
{ "input" });
44+
{ "input" },
45+
{},
46+
{ digitalRange });
4347
streamInfos.add (digitalInputStream);
4448

4549
StreamInfo digitalButtonStream = StreamInfo (
@@ -53,7 +57,9 @@ DigitalIO::DigitalIO (std::string name, std::string hubName, const oni_dev_idx_t
5357
1.0,
5458
"u", // NB: Digital data is unitless by definition
5559
{ "Moon", "Triangle", "X", "Check", "Circle", "Square" },
56-
{ "input" });
60+
{ "input" },
61+
{},
62+
{ digitalRange });
5763
streamInfos.add (digitalButtonStream);
5864

5965
eventCodes.fill (0);

Source/Devices/HarpSyncInput.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ HarpSyncInput::HarpSyncInput (std::string name, std::string hubName, const oni_d
4040
1.0f,
4141
"s",
4242
{ "" },
43-
"harptime");
43+
"harptime",
44+
{},
45+
{});
4446
streamInfos.add (harpTimeStream);
4547

4648
for (int i = 0; i < numFrames; i++)

Source/Devices/MemoryMonitor.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ void MemoryMonitorUsage::stopAcquisition()
7777
MemoryMonitor::MemoryMonitor (std::string name, std::string hubName, const oni_dev_idx_t deviceIdx_, std::shared_ptr<Onix1> oni_ctx)
7878
: OnixDevice (name, hubName, MemoryMonitor::getDeviceType(), deviceIdx_, oni_ctx)
7979
{
80+
const ContinuousChannel::InputRange percentRange { -100.0f, 100.0f };
81+
8082
StreamInfo percentUsedStream = StreamInfo (
8183
createStreamName ("PercentUsed", false),
8284
"Percent of available memory that is currently used",
@@ -88,7 +90,9 @@ MemoryMonitor::MemoryMonitor (std::string name, std::string hubName, const oni_d
8890
1.0f,
8991
"%",
9092
{ "" },
91-
"percent");
93+
"percent",
94+
{},
95+
{ percentRange });
9296
streamInfos.add (percentUsedStream);
9397
}
9498

Source/Devices/Neuropixels1e.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Neuropixels1e::Neuropixels1e (std::string name, std::string hubName, const oni_d
7979
: Neuropixels1 (name, hubName, OnixDeviceType::NEUROPIXELSV1E, deviceIdx_, ctx_)
8080
{
8181
std::string port = getPortName (getDeviceIdx());
82+
8283
StreamInfo apStream = StreamInfo (
8384
createStreamName (STREAM_NAME_AP),
8485
"Neuropixels 1.0 AP band data stream",
@@ -90,7 +91,9 @@ Neuropixels1e::Neuropixels1e (std::string name, std::string hubName, const oni_d
9091
0.195f,
9192
"uV",
9293
{},
93-
"ap");
94+
"ap",
95+
{},
96+
{});
9497
streamInfos.add (apStream);
9598

9699
StreamInfo lfpStream = StreamInfo (
@@ -104,7 +107,9 @@ Neuropixels1e::Neuropixels1e (std::string name, std::string hubName, const oni_d
104107
0.195f,
105108
"uV",
106109
{},
107-
"lfp");
110+
"lfp",
111+
{},
112+
{});
108113
streamInfos.add (lfpStream);
109114

110115
defineMetadata (settings[0].get(), ProbeType::NPX_V1);

Source/Devices/Neuropixels1f.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ Neuropixels1f::Neuropixels1f (std::string name, std::string hubName, const oni_d
7878
0.195f,
7979
"uV",
8080
{},
81-
"ap");
81+
"ap",
82+
{},
83+
{});
8284
streamInfos.add (apStream);
8385

8486
StreamInfo lfpStream = StreamInfo (
@@ -92,7 +94,9 @@ Neuropixels1f::Neuropixels1f (std::string name, std::string hubName, const oni_d
9294
0.195f,
9395
"uV",
9496
{},
95-
"lfp");
97+
"lfp",
98+
{},
99+
{});
96100
streamInfos.add (lfpStream);
97101

98102
defineMetadata (settings[0].get(), ProbeType::NPX_V1);

Source/Devices/Neuropixels2e.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ void Neuropixels2e::createDataStream (int n)
7171
0.195f,
7272
"uV",
7373
{},
74-
"ap");
74+
"ap",
75+
{},
76+
{});
7577
streamInfos.add (apStream);
7678
}
7779

Source/Devices/PolledBno055.cpp

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
3131
{
3232
auto streamIdentifier = getStreamIdentifier();
3333

34+
const ContinuousChannel::InputRange eulerYawRange { -360.0f, 360.0f };
35+
const ContinuousChannel::InputRange eulerRollRange { -180.0f, 180.0f };
36+
const ContinuousChannel::InputRange eulerPitchRange { -90.0f, 90.0f };
37+
3438
std::string port = getPortName (deviceIdx);
3539
StreamInfo eulerAngleStream = StreamInfo (
3640
createStreamName ("Euler"),
@@ -41,12 +45,15 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
4145
"Eul",
4246
ContinuousChannel::Type::AUX,
4347
EulerAngleScale,
44-
"Degrees",
48+
"Deg.",
4549
{ "Y", "R", "P" },
4650
"euler",
47-
{ "y", "r", "p" });
51+
{ "y", "r", "p" },
52+
{ eulerYawRange, eulerRollRange, eulerPitchRange });
4853
streamInfos.add (eulerAngleStream);
4954

55+
const ContinuousChannel::InputRange quaternionRange { -1.0f, 1.0f };
56+
5057
StreamInfo quaternionStream = StreamInfo (
5158
createStreamName ("Quaternion"),
5259
"Bosch Bno055 9-axis inertial measurement unit (IMU) Quaternion",
@@ -56,12 +63,15 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
5663
"Quat",
5764
ContinuousChannel::Type::AUX,
5865
QuaternionScale,
59-
"",
66+
"", // NB: Quaternion data is unitless by definition
6067
{ "W", "X", "Y", "Z" },
6168
"quaternion",
62-
{ "w", "x", "y", "z" });
69+
{ "w", "x", "y", "z" },
70+
{ quaternionRange });
6371
streamInfos.add (quaternionStream);
6472

73+
const ContinuousChannel::InputRange accelerationRange { -100.0f, 100.0f };
74+
6575
StreamInfo accelerationStream = StreamInfo (
6676
createStreamName ("Acceleration"),
6777
"Bosch Bno055 9-axis inertial measurement unit (IMU) Acceleration",
@@ -71,12 +81,15 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
7181
"Acc",
7282
ContinuousChannel::Type::AUX,
7383
AccelerationScale,
74-
"m / s ^ 2",
84+
"m/s^2",
7585
{ "X", "Y", "Z" },
7686
"acceleration",
77-
{ "x", "y", "z" });
87+
{ "x", "y", "z" },
88+
{ accelerationRange });
7889
streamInfos.add (accelerationStream);
7990

91+
const ContinuousChannel::InputRange gravityRange { -10.0f, 10.0f };
92+
8093
StreamInfo gravityStream = StreamInfo (
8194
createStreamName ("Gravity"),
8295
"Bosch Bno055 9-axis inertial measurement unit (IMU) Gravity",
@@ -89,9 +102,12 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
89102
"m/s^2",
90103
{ "X", "Y", "Z" },
91104
"gravity",
92-
{ "x", "y", "z" });
105+
{ "x", "y", "z" },
106+
{ gravityRange });
93107
streamInfos.add (gravityStream);
94108

109+
const ContinuousChannel::InputRange temperatureRange { -100.0f, 100.0f };
110+
95111
StreamInfo temperatureStream = StreamInfo (
96112
createStreamName ("Temperature"),
97113
"Bosch Bno055 9-axis inertial measurement unit (IMU) Temperature",
@@ -101,11 +117,15 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
101117
"Temp",
102118
ContinuousChannel::Type::AUX,
103119
1.0f,
104-
"Celsius",
120+
String::fromUTF8 ("\xc2\xb0") + String ("C"), // NB: "\xc2\xb0" --> degree symbol
105121
{ "" },
106-
"temperature");
122+
"temperature",
123+
{},
124+
{ temperatureRange });
107125
streamInfos.add (temperatureStream);
108126

127+
const ContinuousChannel::InputRange calibrationRange { -3.0f, 3.0f };
128+
109129
StreamInfo calibrationStatusStream = StreamInfo (
110130
createStreamName ("Calibration"),
111131
"Bosch Bno055 9-axis inertial measurement unit (IMU) Calibration status",
@@ -118,7 +138,8 @@ PolledBno055::PolledBno055 (std::string name, std::string hubName, const oni_dev
118138
"",
119139
{ "Mag", "Acc", "Gyr", "Sys" },
120140
"calibration",
121-
{ "magnetometer", "acceleration", "gyroscope", "system" });
141+
{ "magnetometer", "acceleration", "gyroscope", "system" },
142+
{ calibrationRange });
122143
streamInfos.add (calibrationStatusStream);
123144

124145
for (int i = 0; i < NumFrames; i++)

0 commit comments

Comments
 (0)