25 #ifndef INCLUDED_SetupSensors_h_GUID_7F0F52BD_57B4_4ABB_0834_C61DB7C22132 26 #define INCLUDED_SetupSensors_h_GUID_7F0F52BD_57B4_4ABB_0834_C61DB7C22132 38 #include <json/reader.h> 39 #include <json/value.h> 49 static bool frontPanelFixedBeaconShared(
int id) {
50 return (
id == 16) || (
id == 17) || (
id == 19) || (
id == 20);
53 static bool backPanelFixedBeaconShared(
int) {
return true; }
56 inline void loadedCalibFileSuccessfully(ConfigParams
const &config) {
57 loadedCalibFileSuccessfully(config.calibrationFile);
60 inline void calibFileSpecifiedButNotLoaded(ConfigParams
const &config) {
61 calibFileSpecifiedButNotLoaded(config.calibrationFile);
65 using BeaconPredicate = std::function<bool(int)>;
72 inline void addRearPanelBeaconLocations(
float distanceBetweenPanels,
73 Point3Vector &locations) {
78 for (
auto &pt : OsvrHdkLedLocations_SENSOR1) {
79 locations.emplace_back(-pt.x, pt.y, -pt.z - distanceBetweenPanels);
83 inline void addRearPanelBeaconLocations(
ConfigParams const &config,
84 Point3Vector &locations) {
91 bool attemptToLoadCalib =
true,
92 BeaconPredicate &&beaconFixedPredicate = &frontPanelFixedBeaconShared) {
94 Point3Vector locations = OsvrHdkLedLocations_SENSOR0;
95 Vec3Vector directions = OsvrHdkLedDirections_SENSOR0;
99 addRearPanelBeaconLocations(config, locations);
101 variances.insert(end(variances), OsvrHdkLedLocations_SENSOR1.size(),
104 for (
auto &vec : OsvrHdkLedDirections_SENSOR1) {
105 directions.emplace_back(-vec[0], vec[1], -vec[2]);
107 double autocalibScale = 1;
108 if (attemptToLoadCalib) {
109 auto calibLocations =
111 bool gotCalib =
false;
112 if (calibLocations.size() == locations.size()) {
115 }
else if (calibLocations.size() == getNumHDKFrontPanelBeacons()) {
120 addRearPanelBeaconLocations(config, calibLocations);
125 messages::loadedCalibFileSuccessfully(config);
126 locations = calibLocations;
127 autocalibScale = BEACON_AUTOCALIB_ERROR_SCALE_IF_CALIBRATED;
130 messages::calibFileSpecifiedButNotLoaded(config);
136 locations, directions, variances,
137 beaconFixedPredicate, 4, 0, autocalibScale);
143 bool attemptToLoadCalib =
true,
144 BeaconPredicate &&frontBeaconFixedPredicate =
145 &frontPanelFixedBeaconShared,
146 BeaconPredicate &&backBeaconFixedPredicate =
147 &backPanelFixedBeaconShared) {
151 bool needFrontSensor =
true;
152 if (attemptToLoadCalib) {
153 auto calibLocations =
155 if (calibLocations.size() == getNumHDKFrontPanelBeacons() ||
156 calibLocations.size() ==
157 getNumHDKFrontPanelBeacons() +
158 getNumHDKRearPanelBeacons()) {
160 calibLocations.resize(getNumHDKFrontPanelBeacons());
161 messages::loadedCalibFileSuccessfully(config);
162 needFrontSensor =
false;
166 frontBeaconFixedPredicate, 6, 0,
167 BEACON_AUTOCALIB_ERROR_SCALE_IF_CALIBRATED);
169 messages::calibFileSpecifiedButNotLoaded(config);
172 if (needFrontSensor) {
175 OsvrHdkLedLocations_SENSOR0, OsvrHdkLedDirections_SENSOR0,
180 OsvrHdkLedDirections_SENSOR1, backBeaconFixedPredicate, 4, 0);
185 #endif // INCLUDED_SetupSensors_h_GUID_7F0F52BD_57B4_4ABB_0834_C61DB7C22132 const std::vector< double > OsvrHdkLedVariances_SENSOR0
generated by python script in this directory.
Definition: HDKData.cpp:182
Definition: CommonComponent.h:44
std::string calibrationFile
If non-empty, the file to load (or save to) for calibration data.
Definition: ConfigParams.h:251
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
double backPanelMeasurementError
This used to be different than the other beacons, but now it's mostly the same.
Definition: ConfigParams.h:198
CameraParameters getHDKCameraParameters()
Definition: CameraParameters.h:126
void setupSensorsIncludeRearPanel(VideoBasedTracker &vbtracker, ConfigParams const &config, bool attemptToLoadCalib=true, BeaconPredicate &&beaconFixedPredicate=&frontPanelFixedBeaconShared)
Definition: SetupSensors.h:89
Definition: VideoBasedTracker.h:53
LedIdentifierPtr createHDKLedIdentifier(uint8_t sensor)
Factory function to create an HDK Led Identifier object.
Definition: HDKLedIdentifierFactory.cpp:157
LedIdentifierPtr createHDKUnifiedLedIdentifier()
Factory function to create an HDK Led Identifier object containing all the beacons in order for the f...
Definition: HDKLedIdentifierFactory.cpp:172
General configuration parameters.
Definition: ConfigParams.h:82
float computeDistanceBetweenPanels(ConfigParams const &config)
distance between front and back panel target origins, in mm.
Definition: SetupSensors.h:68
double headCircumference
Head circumference at the head strap, in cm - 55.75 is our estimate for an average based on some hat ...
Definition: ConfigParams.h:188
double headToFrontBeaconOriginDistance
This is the distance fron the front of the head to the origin of the front sensor coordinate system i...
Definition: ConfigParams.h:194