So I have couple of virtual goggle .. each one of them has different calibration parameters. I decided to save these parameters into a yaml file (as a configuration file) .. each goggle has its own serial/identification number ... and based on this number, I select which one to use. If there is no pre-saved information for the goggle. I calibrate it and I add these parameters into the file
So right now I am trying to write to a yaml file which looks like this :
Headset:
IdentificationNumber: b630cc42-9a03-42da-a039-0e023cf5b090
GyroOffset:
GyroX:
Value: -0.013776619
GyroY:
Value: -0.016475508
GyroZ:
Value: -0.0114268782
and this is what I get actually:
Headset2:
IdentificationNumber: b630cc42-9a03-42da-a039-0e023cf5b090
? GyroOffset:
GyroX:
Value: -0.013776619
? GyroY:
Value: -0.016475508
: GyroZ:
Value: -0.0114268782
I do not figure out what I am doing wrong ! .. here is my function which writes to the yaml file:
void ParseInputDeviceYaml::addCalibrationToConfigFile(const char* identificationNumber, const float* in)
{
try {
std::ofstream updatedFile;
updatedFile.open(m_filename.toStdString(), std::ios::app);
std::map<std::string, std::string> IDNumber;
std::map<std::string, std::map<std::string, float>> gyroXOffset;
std::map<std::string, std::map<std::string, float>> gyroYOffset;
std::map<std::string, std::map<std::string, float>> gyroZOffset;
IDNumber["IdentificationNumber"] = identificationNumber;
gyroXOffset["GyroX"]["Value"] = *in;
gyroYOffset["GyroY"]["Value"] = *(in + 1);
gyroZOffset["GyroZ"]["Value"] = *(in + 2);
YAML::Emitter newNode;
newNode << YAML::BeginMap;
newNode << YAML::Key << "Headset2";
newNode << YAML::Value << YAML::BeginMap << YAML::Key << "IdentificationNumber" << YAML::Value << identificationNumber << YAML::EndMap;
newNode << YAML::BeginMap << YAML::Key << "GyroOffset" << YAML::Value << gyroXOffset << gyroYOffset << gyroZOffset << YAML::EndMap;
newNode << YAML::EndMap;
updatedFile << newNode.c_str() << "\n";
updatedFile.close();
} catch (std::exception& e) {
LOG4CPLUS_FATAL(m_logger, e.what());
throw std::runtime_error(QObject::tr("Writing gyroscope offsets ").toStdString());
}
}