예제 #1
0
void CRandomFieldGridMap3D::TInsertionOptions::loadFromConfigFile(
	const mrpt::config::CConfigFileBase& iniFile, const std::string& section)
{
	GMRF_lambdaPrior = iniFile.read_double(
		section.c_str(), "GMRF_lambdaPrior", GMRF_lambdaPrior);
	GMRF_skip_variance = iniFile.read_bool(
		section.c_str(), "GMRF_skip_variance", GMRF_skip_variance);
}
void CCascadeClassifierDetection::init(
	const mrpt::config::CConfigFileBase& config)
{
#if MRPT_HAS_OPENCV && MRPT_OPENCV_VERSION_NUM >= 0x200
	// load configuration values
	m_options.cascadeFileName =
		config.read_string("CascadeClassifier", "cascadeFilename", "");
	m_options.scaleFactor =
		config.read_double("DetectionOptions", "scaleFactor", 1.1);
	m_options.minNeighbors =
		config.read_int("DetectionOptions", "minNeighbors", 3);
	m_options.flags = config.read_int("DetectionOptions", "flags", 0);
	m_options.minSize = config.read_int("DetectionOptions", "minSize", 30);

	m_cascade = new CascadeClassifier();

	// Load cascade classifier from file
	CASCADE->load(m_options.cascadeFileName);

	// Check if cascade is empty
	if (CASCADE->empty()) throw std::runtime_error("Incorrect cascade file.");
#endif
}
예제 #3
0
/* -----------------------------------------------------
				loadConfig_sensorSpecific
   ----------------------------------------------------- */
void CGPSInterface::loadConfig_sensorSpecific(
	const mrpt::config::CConfigFileBase& configSource,
	const std::string& iniSection)
{
	m_parser = configSource.read_enum<CGPSInterface::PARSERS>(
		iniSection, "parser", m_parser, false /*Allow default values*/);
	m_raw_dump_file_prefix = configSource.read_string(
		iniSection, "raw_dump_file_prefix", m_raw_dump_file_prefix,
		false /*Allow default values*/);

#ifdef _WIN32
	m_COMname =
		configSource.read_string(iniSection, "COM_port_WIN", m_COMname, true);
#else
	m_COMname =
		configSource.read_string(iniSection, "COM_port_LIN", m_COMname, true);
#endif

	m_COMbauds =
		configSource.read_int(iniSection, "baudRate", m_COMbauds, true);
	m_sensorLabelAppendMsgType = configSource.read_bool(
		iniSection, "sensor_label_append_msg_type", m_sensorLabelAppendMsgType);

	// legacy custom cmds:
	m_customInit =
		configSource.read_string(iniSection, "customInit", m_customInit, false);

	// new custom cmds:
	m_custom_cmds_delay = configSource.read_float(
		iniSection, "custom_cmds_delay", m_custom_cmds_delay);
	m_custom_cmds_append_CRLF = configSource.read_bool(
		iniSection, "custom_cmds_append_CRLF", m_custom_cmds_append_CRLF);
	// Load as many strings as found on the way:
	m_setup_cmds.clear();
	for (int i = 1; true; i++)
	{
		std::string sLine = configSource.read_string(
			iniSection, mrpt::format("setup_cmd%i", i), std::string());
		sLine = mrpt::system::trim(sLine);
		if (sLine.empty()) break;
		m_setup_cmds.push_back(sLine);
	}

	m_shutdown_cmds.clear();
	for (int i = 1; true; i++)
	{
		std::string sLine = configSource.read_string(
			iniSection, mrpt::format("shutdown_cmd%i", i), std::string());
		sLine = mrpt::system::trim(sLine);
		if (sLine.empty()) break;
		m_shutdown_cmds.push_back(sLine);
	}

	m_sensorPose.setFromValues(
		configSource.read_float(iniSection, "pose_x", 0),
		configSource.read_float(iniSection, "pose_y", 0),
		configSource.read_float(iniSection, "pose_z", 0),
		DEG2RAD(configSource.read_float(iniSection, "pose_yaw", 0)),
		DEG2RAD(configSource.read_float(iniSection, "pose_pitch", 0)),
		DEG2RAD(configSource.read_float(iniSection, "pose_roll", 0)));

	m_JAVAD_rtk_src_port = configSource.read_string(
		iniSection, "JAVAD_rtk_src_port", m_JAVAD_rtk_src_port);
	m_JAVAD_rtk_src_baud = configSource.read_int(
		iniSection, "JAVAD_rtk_src_baud", m_JAVAD_rtk_src_baud);
	m_JAVAD_rtk_format = configSource.read_string(
		iniSection, "JAVAD_rtk_format", m_JAVAD_rtk_format);

	m_topcon_useAIMMode = configSource.read_bool(
		iniSection, "JAVAD_useAIMMode", m_topcon_useAIMMode);
	m_topcon_data_period =
		1.0 / configSource.read_double(
				  iniSection, "outputRate", m_topcon_data_period);
}