Ejemplo n.º 1
0
void mdaSubSynth::resume()
{
  phi = env = filt1 = filt2 = filt3 = filt4 = filti = filto = 0.0f;

  setParameter(0, getParameter(0));
}
Ejemplo n.º 2
0
GUIParameterTableWindow*
GUIMEVehicle::getParameterWindow(GUIMainWindow& app,
                                 GUISUMOAbstractView&) {
    GUIParameterTableWindow* ret =
        new GUIParameterTableWindow(app, *this, 21);
    // add items
    ret->mkItem("edge [id]", false, getEdge()->getID());
    ret->mkItem("segment [#]", false, getSegment()->getIndex());
    ret->mkItem("position [m]", true, new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &MEVehicle::getPositionOnLane));
    ret->mkItem("speed [m/s]", true, new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &MEVehicle::getSpeed));
    ret->mkItem("angle [degree]", true, new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &GUIBaseVehicle::getNaviDegree));
    ret->mkItem("waiting time [s]", true,
                new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &MEVehicle::getWaitingSeconds));
    if (getChosenSpeedFactor() != 1) {
        ret->mkItem("speed factor", false, getChosenSpeedFactor());
    }
    //ret->mkItem("time gap [s]", true,
    //            new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &MSVehicle::getTimeGap));
    //ret->mkItem("waiting time [s]", true,
    //            new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &MSVehicle::getWaitingSeconds));
    //ret->mkItem("impatience", true,
    //            new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &MSVehicle::getImpatience));
    //ret->mkItem("last lane change [s]", true,
    //            new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &GUIMEVehicle::getLastLaneChangeOffset));
    ret->mkItem("desired depart [s]", false, time2string(getParameter().depart));
    ret->mkItem("depart delay [s]", false, time2string(getDepartDelay()));
    if (getParameter().repetitionNumber < INT_MAX) {
        ret->mkItem("remaining [#]", false, (unsigned int) getParameter().repetitionNumber - getParameter().repetitionsDone);
    }
    if (getParameter().repetitionOffset > 0) {
        ret->mkItem("insertion period [s]", false, time2string(getParameter().repetitionOffset));
    }
    if (getParameter().repetitionProbability > 0) {
        ret->mkItem("insertion probability", false, getParameter().repetitionProbability);
    }
    //ret->mkItem("stop info", false, getStopInfo());
    ret->mkItem("line", false, myParameter->line);
    //ret->mkItem("CO2 [mg/s]", true,
    //            new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &GUIMEVehicle::getCO2Emissions));
    //ret->mkItem("CO [mg/s]", true,
    //            new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &GUIMEVehicle::getCOEmissions));
    //ret->mkItem("HC [mg/s]", true,
    //            new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &GUIMEVehicle::getHCEmissions));
    //ret->mkItem("NOx [mg/s]", true,
    //            new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &GUIMEVehicle::getNOxEmissions));
    //ret->mkItem("PMx [mg/s]", true,
    //            new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &GUIMEVehicle::getPMxEmissions));
    //ret->mkItem("fuel [ml/s]", true,
    //            new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &GUIMEVehicle::getFuelConsumption));
    //ret->mkItem("noise (Harmonoise) [dB]", true,
    //            new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &GUIMEVehicle::getHarmonoise_NoiseEmissions));
    std::ostringstream str;
    for (std::vector<MSDevice*>::const_iterator i = myDevices.begin(); i != myDevices.end(); ++i) {
        if (i != myDevices.begin()) {
            str << ' ';
        }
        str << (*i)->getID().substr(0, (*i)->getID().find(getID()));
    }
    ret->mkItem("devices", false, str.str());
    //ret->mkItem("persons", true,
    //            new FunctionBinding<GUIMEVehicle, unsigned int>(this, &GUIMEVehicle::getPersonNumber));
    //ret->mkItem("containers", true,
    //            new FunctionBinding<GUIMEVehicle, unsigned int>(this, &GUIMEVehicle::getContainerNumber));
    ret->mkItem("parameters [key:val]", false, toString(getParameter().getMap()));

    // meso specific values
    ret->mkItem("event time [s]", true, new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &MEVehicle::getEventTimeSeconds));
    ret->mkItem("entry time [s]", true, new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &MEVehicle::getLastEntryTimeSeconds));
    ret->mkItem("block time [s]", true, new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &MEVehicle::getBlockTimeSeconds));
    ret->mkItem("tls penalty [s]", true, new FunctionBinding<GUIMEVehicle, SUMOReal>(this, &MEVehicle::getCurrentTLSPenaltySeconds));
    // close building
    ret->closeBuilding();
    return ret;
}
Ejemplo n.º 3
0
void TextviewView::processCommand() {
	char commandStr[80];
	char *paramP;
	strcpy(commandStr, _currentLine + 1);
	str_upper(commandStr);

	if (!strncmp(commandStr, "BACKGROUND", 10)) {
		// Set the background
		paramP = commandStr + 10;
		int screenId = getParameter(&paramP);
		_bgSurface.loadBackground(screenId, &_bgCurrent);
		_vm->_palette->addRange(_bgCurrent);
		_bgSurface.translate(_bgCurrent);

	} else if (!strncmp(commandStr, "GO", 2)) {
		_animating = true;

		// Grab what the final palete will be
		RGB8 destPalette[256];
		_vm->_palette->grabPalette(destPalette, 0, 256);

		// Copy the loaded background, if any, to the view surface
		int yp = (height() - _bgSurface.height()) / 2;
		_bgSurface.copyTo(this, 0, yp);

		// Handle fade-in
		_processEvents = false;		// stop processing events during fade-in
		_vm->_palette->fadeIn(TV_NUM_FADE_STEPS, TV_FADE_DELAY_MILLI, destPalette, 256);
		_processEvents = true;

	} else if (!strncmp(commandStr, "PAN", 3)) {
		// Set panning values
		paramP = commandStr + 3;
		int panX = getParameter(&paramP);
		int panY = getParameter(&paramP);
		int panSpeed = getParameter(&paramP);

		if ((panX != 0) || (panY != 0)) {
			_panX = panX;
			_panY = panY;
			_panSpeed = panSpeed;
		}

	} else if (!strncmp(commandStr, "DRIVER", 6)) {
		// Set the driver to use
		// TODO: Handling of the sound drivers

	} else if (!strncmp(commandStr, "SOUND", 5)) {
		// Set sound number
		paramP = commandStr + 5;
		//int soundId = getParameter(&paramP);

		//TODO: Proper handling of the sound drivers/sounds
		//if (!_soundDriverLoaded)
		//	error("Attempted to set sound without loading any driver");

	} else if (!strncmp(commandStr, "COLOR", 5) && ((commandStr[5] == '0') || (commandStr[5] == '1'))) {
		// Set the text colors
		int index = commandStr[5] - '0';
		paramP = commandStr + 6;

		RGB8 palEntry;
		palEntry.r = getParameter(&paramP) << 2;
		palEntry.g = getParameter(&paramP) << 2;
		palEntry.b = getParameter(&paramP) << 2;
		_vm->_palette->setPalette(&palEntry, 5 + index, 1);

	} else if (!strncmp(commandStr, "SPARE", 5)) {
		// Sets a secondary background number that can be later switched in with a PAGE command
		paramP = commandStr + 6;
		int spareIndex = commandStr[5] - '0';
		if ((spareIndex >= 0) && (spareIndex <= 9)) {
			int screenId = getParameter(&paramP);

			_spareScreens[spareIndex] = screenId;
		}

	} else if (!strncmp(commandStr, "PAGE", 4)) {
		// Signals to change to a previous specified secondary background
		paramP = commandStr + 4;
		int spareIndex = getParameter(&paramP);

		// Only allow background switches if one isn't currently in progress
		if (!_spareScreen && (_spareScreens[spareIndex] != 0)) {
			_spareScreen = new M4Surface(width(), MADS_SURFACE_HEIGHT);
			_spareScreen->loadBackground(_spareScreens[spareIndex], &_bgSpare);
			_vm->_palette->addRange(_bgSpare);
			_spareScreen->translate(_bgSpare);

			_translationX = 0;
		}

	} else {
		error("Unknown response command: '%s'", commandStr);
	}
}
Ejemplo n.º 4
0
Integer ParameterManager::getIntParameter(const std::string & name) const {

   Integer value = 0;
   getParameter(name, value);
   return value;
}
Ejemplo n.º 5
0
void Master::assignParameters()
{
	string stringVal;   //!< auxiliary variable for reading strings

	// get the enumeration strategy
	enumerationStrategy_= (ENUMSTRAT)
		findParameter("EnumerationStrategy",4,ENUMSTRAT_);

	// get the branching strategy

	branchingStrategy_=(BRANCHINGSTRAT)
		findParameter("BranchingStrategy",2,BRANCHINGSTRAT_);

	// get the number of tested candidates for branching variables
	assignParameter(nBranchingVariableCandidates_, "NBranchingVariableCandidates",0, numeric_limits<int>::max());

	// get the number of simplex iterations to perform when testing
	// branching candidates within strong branching
	assignParameter(nStrongBranchingIterations_, "NStrongBranchingIterations",-1, numeric_limits<int>::max());

	// get the solution guarantee
	assignParameter(requiredGuarantee_,"Guarantee",0.0,infinity());

	// get the maximal level in the enumeration tree
	assignParameter(maxLevel_, "MaxLevel", 1, numeric_limits<int>::max());

	// get the maximal level in the enumeration tree
	assignParameter(maxNSub_, "MaxNSub", 1, numeric_limits<int>::max());

	// get the maximal cpu time
	assignParameter(stringVal,"MaxCpuTime",0);
	maxCpuTime(stringVal);

	// get the maximal wall clock time
	assignParameter(stringVal,"MaxCowTime",0);
	maxCowTime(stringVal);

	// get the integrality condition on the objective function
	assignParameter(objInteger_,"ObjInteger" );

	// get the number of linear programs for the tailing off analysis
	assignParameter(tailOffNLp_, "TailOffNLps", numeric_limits<int>::min(), numeric_limits<int>::max());

	// get the minimal improvement for the tailing off analysis
	assignParameter(tailOffPercent_, "TailOffPercent", 0.0, infinity());

	// get the threshold for delayed branching
	assignParameter(dbThreshold_, "DelayedBranchingThreshold", 0, numeric_limits<int>::max());

	// get the minimal number of rounds a subproblem should stay dormant
	assignParameter(minDormantRounds_,  "MinDormantRounds", 1, numeric_limits<int>::max());

	//initializeParameters();

	// get the primal bound initialization mode
	pbMode_ = (PRIMALBOUNDMODE) findParameter("PrimalBoundInitMode", 3, PRIMALBOUNDMODE_);

	// get the pricing frequency
	assignParameter(pricingFreq_, "PricingFrequency", 0, numeric_limits<int>::max());

	// get the skip factor
	assignParameter(skipFactor_, "SkipFactor", 0, numeric_limits<int>::max());

	// get the skipping mode

	skippingMode_ = (SKIPPINGMODE) findParameter("SkippingMode", 2, SKIPPINGMODE_);

	// is fixing/setting by reduced costs turned on?
	assignParameter(fixSetByRedCost_, "FixSetByRedCost");

	// should the LP be output every iteration?
	assignParameter(printLP_, "PrintLP");

	// get the maximal number of added constraints
	assignParameter(maxConAdd_, "MaxConAdd", 0, numeric_limits<int>::max());

	// get the size of the buffer for constraints
	assignParameter(maxConBuffered_, "MaxConBuffered", 0, numeric_limits<int>::max());

	// get the maximal number of added variables
	assignParameter(maxVarAdd_, "MaxVarAdd", 0, numeric_limits<int>::max());

	// get the size of the buffer for variables
	assignParameter(maxVarBuffered_, "MaxVarBuffered", 0, numeric_limits<int>::max());

	// get the maximal number of iterations in the cutting plane phase
	assignParameter(maxIterations_, "MaxIterations", -1, numeric_limits<int>::max());

	// should fixed or set variables be eliminated from the LP?
	assignParameter(eliminateFixedSet_, "EliminateFixedSet");

	// should a new root be reoptimized?
	assignParameter(newRootReOptimize_, "NewRootReOptimize");

	// get the name of the file storing the optimal solutions
	/* The name of the file storing the optimal solutions is only an optional
	*   parameter which can be missing.
	*/
	getParameter("OptimumFileName", optimumFileName_);

	// should the average distance of the cuts per iteration be output?
	assignParameter(showAverageCutDistance_, "ShowAverageCutDistance");

	// get the constraint elimination mode
	conElimMode_ = (CONELIMMODE) findParameter("ConstraintEliminationMode", 3, CONELIMMODE_);

	// get the variable elimination mode
	varElimMode_ = (VARELIMMODE) findParameter("VariableEliminationMode", 2, VARELIMMODE_);

	// get the tolerance for variable elimination
	assignParameter(varElimEps_, "VarElimEps", 0.0, infinity());

	// get the tolerance for constraint elimination
	assignParameter(conElimEps_, "ConElimEps", 0.0, infinity());

	// get the age for constraint elimination
	assignParameter(conElimAge_, "ConElimAge", 1, numeric_limits<int>::max());

	// get the age for variable elimination
	assignParameter(varElimAge_, "VarElimAge", 1, numeric_limits<int>::max());

	// should a log-file of the enumeration tree be generated?
	VbcLog_ = (VBCMODE) findParameter("VbcLog", 3, VBCMODE_);

	//! get the default LP-solver
	defaultLpSolver_ = (OSISOLVER) findParameter("DefaultLpSolver", 12, OSISOLVER_);
	assignParameter(solveApprox_, "SolveApprox", false);
}
Ejemplo n.º 6
0
const string& AmConfigReader::getParameter(const string& param) const
{
  return getParameter(param,__empty_string);
}
Ejemplo n.º 7
0
std::string ParameterManager::getStringParameter(const std::string & name) const {

   std::string value = "";
   getParameter(name, value);
   return value;
}
Ejemplo n.º 8
0
void contentTypeField::setBoundary(const string& boundary)
{
	getParameter("boundary")->setValue(word(boundary, vmime::charsets::US_ASCII));
}
Ejemplo n.º 9
0
void contentTypeField::setCharset(const charset& ch)
{
	getParameter("charset")->setValue(ch);
}
Ejemplo n.º 10
0
void CLsodaMethod::initializeParameter()
{
  CCopasiParameter *pParm;

  mpReducedModel =
    assertParameter("Integrate Reduced Model", CCopasiParameter::BOOL, (bool) false)->getValue().pBOOL;
  mpRelativeTolerance =
    assertParameter("Relative Tolerance", CCopasiParameter::UDOUBLE, (C_FLOAT64) 1.0e-6)->getValue().pUDOUBLE;
  mpAbsoluteTolerance =
    assertParameter("Absolute Tolerance", CCopasiParameter::UDOUBLE, (C_FLOAT64) 1.0e-12)->getValue().pUDOUBLE;
  mpMaxInternalSteps =
    assertParameter("Max Internal Steps", CCopasiParameter::UINT, (unsigned C_INT32) 10000)->getValue().pUINT;

  // Check whether we have a method with the old parameter names
  if ((pParm = getParameter("LSODA.RelativeTolerance")) != NULL)
    {
      *mpRelativeTolerance = *pParm->getValue().pUDOUBLE;
      removeParameter("LSODA.RelativeTolerance");

      if ((pParm = getParameter("LSODA.AbsoluteTolerance")) != NULL)
        {
          *mpAbsoluteTolerance = *pParm->getValue().pUDOUBLE;
          removeParameter("LSODA.AbsoluteTolerance");
        }

      if ((pParm = getParameter("LSODA.AdamsMaxOrder")) != NULL)
        {
          removeParameter("LSODA.AdamsMaxOrder");
        }

      if ((pParm = getParameter("LSODA.BDFMaxOrder")) != NULL)
        {
          removeParameter("LSODA.BDFMaxOrder");
        }

      if ((pParm = getParameter("LSODA.MaxStepsInternal")) != NULL)
        {
          *mpMaxInternalSteps = *pParm->getValue().pUINT;
          removeParameter("LSODA.MaxStepsInternal");
        }
    }

  // Check whether we have a method with "Use Default Absolute Tolerance"
  if ((pParm = getParameter("Use Default Absolute Tolerance")) != NULL)
    {
      C_FLOAT64 NewValue;

      if (*pParm->getValue().pBOOL)
        {
          // The default
          NewValue = 1.e-12;
        }
      else
        {
          C_FLOAT64 OldValue = *mpAbsoluteTolerance;
          CCopasiDataModel* pDataModel = getObjectDataModel();
          assert(pDataModel != NULL);
          CModel * pModel = pDataModel->getModel();

          if (pModel == NULL)
            // The default
            NewValue = 1.e-12;
          else
            {
              const CCopasiVectorNS< CCompartment > & Compartment = pModel->getCompartments();
              unsigned C_INT32 i, imax;
              C_FLOAT64 Volume = DBL_MAX;

              for (i = 0, imax = Compartment.size(); i < imax; i++)
                if (Compartment[i]->getValue() < Volume)
                  Volume = Compartment[i]->getValue();

              if (Volume == DBL_MAX)
                // The default
                NewValue = 1.e-12;
              else
                // Invert the scaling as best as we can
                NewValue = OldValue / (Volume * pModel->getQuantity2NumberFactor());
            }
        }

      *mpAbsoluteTolerance = NewValue;
      removeParameter("Use Default Absolute Tolerance");
    }

  // These parameters are no longer supported.
  removeParameter("Adams Max Order");
  removeParameter("BDF Max Order");
}
Ejemplo n.º 11
0
void contentTypeField::setReportType(const string& reportType)
{
	getParameter("report-type")->setValue(word(reportType, vmime::charsets::US_ASCII));
}
Ejemplo n.º 12
0
QString ContentType::getCharset() const
{
    return getParameter(Charset);
}
Ejemplo n.º 13
0
QString ContentType::getBoundary() const
{
    return getParameter(Boundary);
}
Ejemplo n.º 14
0
void AMAmp::update(DefaultGUIModel::update_flags_t flag) {

	switch(flag) {
		// initialize the parameters and then the GUI. 
		case INIT:
			setParameter("Input Channel", input_channel);
			setParameter("Output Channel", output_channel);
			setParameter("Amplifier Mode", amp_mode);
			setParameter("Probe Gain", probe_gain);
			setParameter("AI Offset", ai_offset);
			setParameter("AO Offset", ao_offset);

			inputBox->setValue(input_channel);
			outputBox->setValue(output_channel);
			ampButtonGroup->button(amp_mode)->setStyleSheet("QRadioButton { font: bold;}");
			ampButtonGroup->button(amp_mode)->setChecked(true);
			
			probeGainComboBox->setCurrentIndex(probe_gain);
			probeGainComboBox->blacken();

			aiOffsetEdit->setText(QString::number(ai_offset));
			aoOffsetEdit->setText(QString::number(ao_offset));
			break;
		
		case MODIFY:
			input_channel = getParameter("Input Channel").toInt();
			output_channel = getParameter("Output Channel").toInt();

			inputBox->setValue(input_channel);
			outputBox->setValue(output_channel);
			if (amp_mode != getParameter("Amplifier Mode").toInt()) {
				ampButtonGroup->button(amp_mode)->setStyleSheet("QRadioButton { font: normal; }");
				ampButtonGroup->button(getParameter("Amplifier Mode").toInt())->setStyleSheet("QRadioButton { font: bold;}");
				amp_mode = getParameter("Amplifier Mode").toInt();
			}
			
			probe_gain = static_cast<probe_gain_t>(getParameter("Probe Gain").toInt());
			std::cout<<probe_gain<<std::endl;
			switch (probe_gain) {
				case HIGH:
					probe_gain_factor = 1; //.10;
					std::cout<<"Probe Gain HIGH - "<<probe_gain_factor<<std::endl;
					break;

				case LOW:
					probe_gain_factor = 10; //1;
					std::cout<<"Probe Gain LOW - "<<probe_gain_factor<<std::endl;
					break;

				default:
					std::cout<<"ERROR: default called for probe_gain in update(MODIFY)"<<std::endl;
					break;
			}

			ai_offset = getParameter("AI Offset").toDouble();
			ao_offset = getParameter("AO Offset").toDouble();

			updateDAQ();

			// blacken the GUI to reflect that changes have been saved to variables.
			inputBox->blacken();
			outputBox->blacken();
			aiOffsetEdit->blacken();
			aoOffsetEdit->blacken();
			probeGainComboBox->blacken();

			// Disable findZeroButton if not currently I=0 mode
			if (amp_mode == 2) findZeroButton->setEnabled(true);
			else findZeroButton->setEnabled(false);
			break;

		default:
			break;
	}
}
Ejemplo n.º 15
0
bool ArchiveParser::handleCtrlInfo(ChannelIterator &channel)
{
    if (!_value)
    {
        printf("Line %zd: no header, yet\n", getLineNo());
        return false;
    }

    long prec=2;
    stdString units;
    float disp_low=0, disp_high=0;
    float low_alarm=0, low_warn=0, high_warn=0, high_alarm=0;
    stdString parameter, value;
    CtrlInfo::Type type;
    size_t states = 0;
    stdVector<stdString> state;

    if (!nextLine()  ||
            getLine() != "{")
    {
        printf("Line %zd: missing start of CtrlInfo\n", getLineNo());
        return false;
    }

    while (nextLine())
    {
        if (getLine() == "}")
            break;
        if (getParameter (parameter, value))
        {
            if (parameter == "type")
            {
                if (value == "Numeric")
                    type = CtrlInfo::Numeric;
                else if (value == "Enumerated")
                    type = CtrlInfo::Enumerated;
                else
                {
                    printf("Line %zd: Unknown type %s\n",
                           getLineNo(), value.c_str());
                    return false;
                }
            }
            if (parameter == "display_high")
                disp_high = atof(value.c_str());
            else if (parameter == "display_low")
                disp_low = atof(value.c_str());
            else if (parameter == "high_alarm")
                high_alarm = atof(value.c_str());
            else if (parameter == "high_warning")
                high_warn = atof(value.c_str());
            else if (parameter == "low_warning")
                low_warn = atof(value.c_str());
            else if (parameter == "low_alarm")
                low_alarm = atof(value.c_str());
            else if (parameter == "precision")
                prec = atoi(value.c_str());
            else if (parameter == "units")
                units = value;
            else if (parameter == "states")
                states = atoi(value.c_str());
            else if (parameter == "state")
                state.push_back (value);
        }
        else
            printf("Line %zd skipped\n", getLineNo());
    }

    if (type == CtrlInfo::Numeric)
        _info.setNumeric (prec, units, disp_low, disp_high,
                          low_alarm, low_warn, high_warn, high_alarm);
    else if (type == CtrlInfo::Enumerated)
    {
        if (state.size() != states)
        {
            printf("Line %zd: Asked for %zd states but provided %zd\n",
                   getLineNo(), states, state.size());
            return false;
        }
        size_t i, len = 0;
        for (i=0; i<states; ++i)
            len += state[i].length();
        _info.allocEnumerated (states, len);
        for (i=0; i<states; ++i)
            _info.setEnumeratedString (i, state[i].c_str());
    }
    else
    {
        printf("Line %zd: Invalid CtrlInfo\n", getLineNo());
        return false;
    }

    _value->setCtrlInfo(&_info);
    _new_ctrl_info = true;

    return true;
}
Ejemplo n.º 16
0
/* doDebug - send Debug infos over Serial -----------------------------------*/
void doDebug()
{
	char x [200];			
	
	/* Graphoutput must start with 'G' and first value is timer (not used) */
	if (getParameter(PARA_DEBUG) & PARA_DEBUG_ADC)
	{
		sprintf(x,"Gyro-ACC:1:%d:",ADCSensorValue[GYRO_X]);
		print_uart1(x);
		sprintf(x,"%d:",ADCSensorValue[GYRO_Y]);
		print_uart1(x);
		sprintf(x,"%d:",ADCSensorValue[GYRO_Z]);
		print_uart1(x);
		sprintf(x,"%d:",ADCSensorValue[ACC_X]);
		print_uart1(x);
		sprintf(x,"%d:",ADCSensorValue[ACC_Y]);
		print_uart1(x);
		sprintf(x,"%d:",ADCSensorValue[ACC_Z]);
		print_uart1(x);
		sprintf(x,"%d:\r\n",ADCSensorValue[VOLT]);
		print_uart1(x);
		//sprintf(x,"%d:%d:%d:%d:%d:%d:%d:%d\r\n",ADCSensorValue[0],ADCSensorValue[7],ADCSensorValue[14],ADCSensorValue[21],ADCSensorValue[28],ADCSensorValue[35],ADCSensorValue[42],ADCSensorValue[49]);
		//print_uart1(x);
	}
	
	/* Graphoutput must start with 'G' and first value is timer (not used) */
	if (getParameter(PARA_DEBUG) & PARA_DEBUG_SENSOR)
	{
		sprintf(x,"G-A-C:1:%d:",gyroAngle[X]/1000);
		print_uart1(x);
		sprintf(x,"%d:",gyroAngle[Y]/1000);
		print_uart1(x);
		sprintf(x,"%d:",gyroAngle[Z]/1000);
		print_uart1(x);
		sprintf(x,"%d:",accAngle[X]/1000);
		print_uart1(x);
		sprintf(x,"%d:",accAngle[Y]/1000);
		print_uart1(x);
		sprintf(x,"%d:",copterAngle[X]/1000);
		print_uart1(x);
		sprintf(x,"%d:",copterAngle[Y]/1000);
		print_uart1(x);
		sprintf(x,"%d:\r\n",copterAngle[Z]/1000);
		print_uart1(x);
	}
	

	/* Debug output for receiver channels */
	// if parameter value is 1 - 1. bit is set
	if (getParameter(PARA_DEBUG) & PARA_DEBUG_REC)
	{
		sprintf(x,"RC-%d:%d:",getParameter(getParameter(PARA_HW) & 0x01),receiverChannel[0]);
		print_uart1(x);
		sprintf(x,"%d:",receiverChannel[1]);
		print_uart1(x);
		sprintf(x,"%d:",receiverChannel[2]);
		print_uart1(x);
		sprintf(x,"%d:",receiverChannel[3]);
		print_uart1(x);
		sprintf(x,"%d:",receiverChannel[4]);
		print_uart1(x);
		sprintf(x,"%d:",receiverChannel[5]);
		print_uart1(x);
		sprintf(x,"%d:",receiverChannel[6]);
		print_uart1(x);
		sprintf(x,"%d:",receiverChannel[7]);
		print_uart1(x);
		sprintf(x,"%d:\r\n",receiverChannel[8]);
		print_uart1(x);	
	}
	

	/* Debug output for receiver channels */
	// if parameter value is 1 - 1. bit is set
	if (getParameter(PARA_DEBUG) & PARA_DEBUG_MOT)
	{
		sprintf(x,"G-TarAngle-Mot:1:%d:",targetAngle[0]/1000);
		print_uart1(x);
		sprintf(x,"%d:",targetAngle[1]/1000);
		print_uart1(x);
		sprintf(x,"%d:",targetAngle[2]/1000);
		print_uart1(x);
		sprintf(x,"%d:",motor[1]);
		print_uart1(x);
		sprintf(x,"%d:",motor[2]);
		print_uart1(x);
		sprintf(x,"%d:",motor[3]);
		print_uart1(x);
		sprintf(x,"%d:\r\n",motor[4]);
		print_uart1(x);
	}
	

	/* Debug output for receiver channels */
	// if parameter value is 1 - 1. bit is set
	if (getParameter(PARA_DEBUG) & PARA_DEBUG_COMP)
	{
		sprintf(x,"G-Compass XYZ Deg:1:%d:",compassout[0]);
		print_uart1(x);
		sprintf(x,"%d:",compassout[1]);
		print_uart1(x);
		sprintf(x,"%d:",compassout[2]);
		print_uart1(x);
		sprintf(x,"%d:\r\n",compassAngle/1000);
		print_uart1(x);
	}

	/* Debug output for PID */
	if (getParameter(PARA_DEBUG) & PARA_DEBUG_PID)
	{
		sprintf(x,"G-PID(XYZ):1:%d:",PIDCorr[X]);
		print_uart1(x);
		sprintf(x,"%d:",PIDCorr[Y]);
		print_uart1(x);
		sprintf(x,"%d:\r\n",PIDCorr[Z]);
		print_uart1(x);
	}
	
}
Ejemplo n.º 17
0
int AmConfigReader::loadString(const char* cfg_lines, size_t cfg_len)
{
  int  lc = 0;
  int  ls = 0;
  char lb[MAX_CONFIG_LINE] = {'\0'};

  char *c,*key_beg,*key_end,*val_beg,*val_end,*inc_beg,*inc_end;

  const char* cursor = cfg_lines;
  const char* cfg_end = cursor + cfg_len;

  c=key_beg=key_end=val_beg=val_end=inc_beg=inc_end=0;
  while((cursor < cfg_end) && 
	((ls = str_get_line(&cursor, cfg_end, lb, MAX_CONFIG_LINE)) != -1)){
	
    c=key_beg=key_end=val_beg=val_end=0;
    lc++;

    c = lb;
    TRIM(c);

    if(IS_EOL(*c)) continue;

    key_beg = c;
    while( (*c != '=') && !IS_SPACE(*c) ) c++;
    
    key_end = c;
    if(IS_SPACE(*c))
      TRIM(c);
    else if( !(c - key_beg) )
      goto syntax_error;

    if(*c != '=')
      goto syntax_error;

    c++;
    TRIM(c);

    if(*c == '"'){
      char last_c = ' ';
      val_beg = ++c;

      while( ((*c != '"') || (last_c == '\\')) && (*c != '\0') ) {
	last_c = *c;
	c++;
      }

      if(*c == '\0')
	goto syntax_error;

      val_end = c;
    }
    else {
      val_beg = c;

      while( !IS_EOL(*c) && !IS_SPACE(*c) ) c++;

      val_end = c;
    }

    if((key_beg < key_end) && (val_beg <= val_end)) {
      string keyname = string(key_beg,key_end-key_beg);
      string val = string(val_beg,val_end-val_beg);
      if (hasParameter(keyname)) {
	WARN("while loading string: overwriting configuration "
	     "'%s' value '%s' with  '%s'\n",
	     keyname.c_str(), getParameter(keyname).c_str(), 
	     val.c_str());
      }

      keys[keyname] = val;
    } else
      goto syntax_error;
  }

  return 0;

 syntax_error:
  ERROR("syntax error line %i\n",lc);
  return -1;
}
Ejemplo n.º 18
0
  /*
   * Calculate all peaks' parameters
   */
  void LeBailFunction::calPeaksParameters()
  {
    // 1. Get parameters (class)
    Alph0 = getParameter("Alph0");
    Alph1 = getParameter("Alph1");
    Beta0 = getParameter("Beta0");
    Beta1 = getParameter("Beta1");
    Alph0t = getParameter("Alph0t");
    Alph1t = getParameter("Alph1t");
    Beta0t = getParameter("Beta0t");
    Beta1t = getParameter("Beta1t");
    Dtt1 = getParameter("Dtt1");
    Dtt1t = getParameter("Dtt1t");
    Dtt2t = getParameter("Dtt2t");
    Zero = getParameter("Zero");
    Zerot = getParameter("Zerot");
    Sig0 = getParameter("Sig0");
    Sig1 = getParameter("Sig1");
    Sig2 = getParameter("Sig2");
    Gam0 = getParameter("Gam0");
    Gam1 = getParameter("Gam1");
    Gam2 = getParameter("Gam2");

    // 2. Calcualte peak parameters for all peaks
    for (size_t id = 0; id < dvalues.size(); ++id)
    {
      double dh = dvalues[id];
      // a) Calculate all the parameters
      double alpha, beta, tof_h, sigma2, gamma;
      calPeakParametersForD(dh, alpha, beta, tof_h, sigma2, gamma, mPeakParameters[id]);

      // b) Set peak parameters
      mPeaks[id]->setParameter("TOF_h", tof_h);
      mPeaks[id]->setParameter("Height", heights[id]);
      mPeaks[id]->setParameter("Alpha", alpha);
      mPeaks[id]->setParameter("Beta", beta);
      mPeaks[id]->setParameter("Sigma2", sigma2);
      mPeaks[id]->setParameter("Gamma", gamma);
    }

    return;
  }
Ejemplo n.º 19
0
int  AmConfigReader::loadFile(const string& path)
{
  FILE* fp = fopen(path.c_str(),"r");
  if(!fp){
      WARN("could not open configuration file '%s': %s\n",
	   path.c_str(),strerror(errno));
      return -1;
  }
  
  int  lc = 0;
  int  ls = 0;
  char lb[MAX_CONFIG_LINE] = {'\0'};

  char *c,*key_beg,*key_end,*val_beg,*val_end,*inc_beg,*inc_end;

  c=key_beg=key_end=val_beg=val_end=inc_beg=inc_end=0;
  while(!feof(fp) && ((ls = fifo_get_line(fp, lb, MAX_CONFIG_LINE)) != -1)){
	
    c=key_beg=key_end=val_beg=val_end=0;
    lc++;

    c = lb;
    TRIM(c);

    if(IS_EOL(*c)) continue;

    if (*c == '@') { /* process included config file */
	c++;
	TRIM(c);
	inc_beg = c++;
	while( !IS_EOL(*c) && !IS_SPACE(*c) ) c++;
	inc_end = c;
	string fname = string(inc_beg,inc_end-inc_beg);
	if (fname.length() && fname[0] != '/')
	  fname = AmConfig::ModConfigPath + fname;
	if(loadFile(fname))
	    goto error;
	continue;
    }

    key_beg = c;
    while( (*c != '=') && !IS_SPACE(*c) ) c++;
    
    key_end = c;
    if(IS_SPACE(*c))
      TRIM(c);
    else if( !(c - key_beg) )
      goto syntax_error;

    if(*c != '=')
      goto syntax_error;

    c++;
    TRIM(c);

    if(*c == '"'){
      char last_c = ' ';
      val_beg = ++c;

      while( ((*c != '"') || (last_c == '\\')) && (*c != '\0') ) {
	last_c = *c;
	c++;
      }

      if(*c == '\0')
	goto syntax_error;

      val_end = c;
    }
    else {
      val_beg = c;

      while( !IS_EOL(*c) && !IS_SPACE(*c) ) c++;

      val_end = c;
    }

    if((key_beg < key_end) && (val_beg <= val_end)) {
      string keyname = string(key_beg,key_end-key_beg);
      string val = string(val_beg,val_end-val_beg);
      if (hasParameter(keyname)) {
	WARN("while loading '%s': overwriting configuration "
	     "'%s' value '%s' with  '%s'\n",
	     path.c_str(), keyname.c_str(), 
	     getParameter(keyname).c_str(), val.c_str());
      }

      keys[keyname] = val;

      // small hack to make include work with right path
      if (keyname == "plugin_config_path")
	AmConfig::ModConfigPath = val;

    } else
      goto syntax_error;
  }

  fclose(fp);
  return 0;

 syntax_error:
  ERROR("syntax error line %i in %s\n",lc,path.c_str());
 error:
  fclose(fp);
  return -1;
}
Ejemplo n.º 20
0
  void LeBailFunction::function1D(double *out, const double *xValues, size_t nData) const
  {
    // 1. Get parameters (class)
    Alph0 = getParameter("Alph0");
    Alph1 = getParameter("Alph1");
    Beta0 = getParameter("Beta0");
    Beta1 = getParameter("Beta1");
    Alph0t = getParameter("Alph0t");
    Alph1t = getParameter("Alph1t");
    Beta0t = getParameter("Beta0t");
    Beta1t = getParameter("Beta1t");
    Dtt1 = getParameter("Dtt1");
    Dtt1t = getParameter("Dtt1t");
    Dtt2t = getParameter("Dtt2t");
    Zero = getParameter("Zero");
    Zerot = getParameter("Zerot");
    Sig0 = getParameter("Sig0");
    Sig1 = getParameter("Sig1");
    Sig2 = getParameter("Sig2");
    Gam0 = getParameter("Gam0");
    Gam1 = getParameter("Gam1");
    Gam2 = getParameter("Gam2");
    double latticeconstant = getParameter("LatticeConstant");

    /*
    std::cout << " \n-------------------------  being visited -----------------------\n" << std::endl;
    std::cout << "Alph0  = " << Alph0 << std::endl;
    std::cout << "Alph1  = " << Alph1 << std::endl;
    std::cout << "Alph0t = " << Alph0t << std::endl;
    std::cout << "Alph1t = " << Alph1t << std::endl;
    std::cout << "Zero   = " << Zero << std::endl;
    std::cout << "Zerot  = " << Zerot << std::endl;
    std::cout << "Lattice= " << latticeconstant << " Number of Peaks = " << mPeakHKLs.size() << std::endl;
    */

    // 2.
    double *tempout = new double[nData];
    for (size_t iy = 0; iy < nData; ++iy)
    {
      out[iy] = 0.0;
    }

    for (size_t id = 0; id < mPeakHKLs.size(); ++id)
    {
      int h = mPeakHKLs[id][0];
      int k = mPeakHKLs[id][1];
      int l = mPeakHKLs[id][2];
      double dh = calCubicDSpace(latticeconstant, h, k, l);
      dvalues[id] = dh;

      // a) Calculate all the parameters
      double alpha, beta, tof_h, sigma2, gamma;
      calPeakParametersForD(dh, alpha, beta, tof_h, sigma2, gamma, mPeakParameters[id]);

      // b) Set peak parameters
      g_log.debug() << "DB546 Peak @ d = " << dh << " Set Height = " << dh << std::endl;
      mPeaks[id]->setParameter("TOF_h", tof_h);
      mPeaks[id]->setParameter("Height", heights[id]);
      mPeaks[id]->setParameter("Alpha", alpha);
      mPeaks[id]->setParameter("Beta", beta);
      mPeaks[id]->setParameter("Sigma2", sigma2);
      mPeaks[id]->setParameter("Gamma", gamma);

      // c) Calculate individual peak range
      mPeaks[id]->setPeakRadius(PEAKRADIUS);

      // d) Calculate peak
      mPeaks[id]->function1D(tempout, xValues, nData);
      for (size_t iy = 0; iy < nData; ++iy)
      {
        out[iy] += tempout[iy];
      }
    } // END-FOR D-values

    for (size_t n = 0; n < nData; ++n)
      g_log.debug() << "DB327 " << xValues[n] << "\t\t" << out[n] << std::endl;

    // 3. Clean
    delete[] tempout;

    return;
  }
Ejemplo n.º 21
0
Float ParameterManager::getFloatParameter(const std::string & name) const {

   Float value = 0.;
   getParameter(name, value);
   return value;
}
const String GainLawsAudioProcessor::getParameterText (int index)
{
    return String (getParameter (index), 2);
}
Ejemplo n.º 23
0
IntParamVector ParameterManager::getIntVectorParameter(const std::string & name) const {

   IntParamVector value;
   getParameter(name, value);
   return value;
}
Ejemplo n.º 24
0
Self::Self(std::string player_params, std::string team_name, int unum, std::string side) {
	this->player_params = player_params;
	Self::TEAM_NAME = team_name;
	Self::UNIFORM_NUMBER = unum;
	Self::SIDE = side;
	Self::ALLOW_MULT_DEFAULT_TYPE              = atoi((getParameter("allow_mult_default_type")).c_str());
	Self::CATCHABLE_AREA_L_STRECH_MAX          = atof((getParameter("catchable_area_l_stretch_max")).c_str());
	Self::CATCHABLE_AREA_L_STRECH_MIN          = atof((getParameter("catchable_area_l_stretch_min")).c_str());
	Self::DASH_POWER_RATE_DELTA_MAX            = atof((getParameter("dash_power_rate_delta_max")).c_str());
	Self::DASH_POWER_RATE_DELTA_MIN            = atof((getParameter("dash_power_rate_delta_min")).c_str());
	Self::EFFORT_MAX_DELTA_FACTOR              = atof((getParameter("effort_max_delta_factor")).c_str());
	Self::EFFORT_MIN_DELTA_FACTOR              = atof((getParameter("effort_min_delta_factor")).c_str());
	Self::EXTRA_STAMINA_DELTA_MAX              = atof((getParameter("extra_stamina_delta_max")).c_str());
	Self::EXTRA_STAMINA_DELTA_MIN              = atof((getParameter("extra_stamina_delta_min")).c_str());
	Self::FOUL_DETECT_PROBABILITY_DELTA_FACTOR = atof((getParameter("foul_detect_probability_delta_factor")).c_str());
	Self::INERTIA_MOMENT_DELTA_FACTOR          = atof((getParameter("inertia_moment_delta_factor")).c_str());
	Self::KICK_POWER_RATE_DELTA_MAX            = atof((getParameter("kick_power_rate_delta_max")).c_str());
	Self::KICK_POWER_RATE_DELTA_MIN            = atof((getParameter("kick_power_rate_delta_min")).c_str());
	Self::KICK_RAND_DELTA_FACTOR               = atof((getParameter("kick_rand_delta_factor")).c_str());
	Self::KICKABLE_MARGIN_DELTA_MAX            = atof((getParameter("kickable_margin_delta_max")).c_str());
	Self::KICKABLE_MARGIN_DELTA_MIN            = atof((getParameter("kickable_margin_delta_min")).c_str());
	Self::NEW_DASH_POWER_RATE_DELTA_MAX        = atof((getParameter("new_dash_power_rate_delta_max")).c_str());
	Self::NEW_DASH_POWER_RATE_DELTA_MIN        = atof((getParameter("new_dash_power_rate_delta_min")).c_str());
	Self::NEW_STAMINA_INC_MAX_DELTA_FACTOR     = atof((getParameter("new_stamina_inc_max_delta_factor")).c_str());
	Self::PLAYER_DECAY_DELTA_MAX               = atof((getParameter("player_decay_delta_max")).c_str());
	Self::PLAYER_DECAY_DELTA_MIN               = atof((getParameter("player_decay_delta_min")).c_str());
	Self::PLAYER_SIZE_DELTA_FACTOR             = atof((getParameter("player_size_delta_factor")).c_str());
	Self::PLAYER_SPEED_MAX_DELTA_MAX           = atof((getParameter("player_speed_max_delta_max")).c_str());
	Self::PLAYER_SPEED_MAX_DELTA_MIN           = atof((getParameter("player_speed_max_delta_min")).c_str());
	Self::PLAYER_TYPES                         = atoi((getParameter("player_types")).c_str());
	Self::PT_MAX                               = atoi((getParameter("pt_max")).c_str());
	Self::RANDOM_SEED                          = atoi((getParameter("random_seed")).c_str());
	Self::STAMINA_INC_MAX_DELTA_FACTOR         = atof((getParameter("stamina_inc_max_delta_factor")).c_str());
	Self::SUBS_MAX                             = atoi((getParameter("subs_max")).c_str());
	types_id = new int[Self::PLAYER_TYPES];
	player_speed_max = new double[Self::PLAYER_TYPES];
	stamina_inc_max = new double[Self::PLAYER_TYPES];
	player_decay = new double[Self::PLAYER_TYPES];
	inertia_moment = new double[Self::PLAYER_TYPES];
	dash_power_rate = new double[Self::PLAYER_TYPES];
	player_size = new double[Self::PLAYER_TYPES];
	kickable_margin = new double[Self::PLAYER_TYPES];
	kick_rand = new double[Self::PLAYER_TYPES];
	extra_stamina = new double[Self::PLAYER_TYPES];
	effort_max = new double[Self::PLAYER_TYPES];
	effort_min = new double[Self::PLAYER_TYPES];
	kick_power_rate = new double[Self::PLAYER_TYPES];
	foul_detect_probability = new double[Self::PLAYER_TYPES];
	catchable_area_l_stretch = new double[Self::PLAYER_TYPES];
	sense_body = boost::regex(std::string() + "^\\(sense_body\\s+\\d+\\s+" +
					"\\(view_mode\\s+(\\w+)\\s+(\\w+)\\)\\s*" + //group 1 group 2
					"\\(stamina\\s+([\\d\\.\\-e]+)\\s+([\\d\\.\\-e]+)\\s+([\\d\\.\\-e]+)\\)\\s*" + //\\-\\d+|\\d+\\.\\d+ //group 3 group 4 group 5
					"\\(speed\\s+([\\d\\.\\-e]+)\\s+([\\d\\.\\-e]+)\\)\\s*" + //group 6 group 7
					"\\(head_angle\\s+([\\d\\.\\-e]+)\\)\\s*" + //group 8
					"\\(kick\\s+(\\d+)\\)\\s*" + //group 9
					"\\(dash\\s+(\\d+)\\)\\s*" + //group 10
					"\\(turn\\s+(\\d+)\\)\\s*" + //group 11
					"\\(say\\s+(\\d+)\\)\\s*" + //group 12
					"\\(turn_neck\\s+(\\d+)\\)\\s*" + //group 13
					"\\(catch\\s+(\\d+)\\)\\s*" + //group 14
					"\\(move\\s+(\\d+)\\)\\s*" + //group 15
					"\\(change_view\\s+(\\d+)\\)\\s*" + //group 16
					"\\(arm\\s+" +
						"\\(movable\\s+(\\d+)\\)\\s*" + //group 17
						"\\(expires\\s+(\\d+)\\)\\s*" + //group 18
						"\\(target\\s+([\\d\\.\\-e]+)\\s+([\\d\\.\\-e]+)\\)\\s*" + //group 19 20
						"\\(count\\s+(\\d+)\\)\\s*" + //group 21
					"\\)\\s*" +
					"\\(focus\\s+" +
						"\\(target\\s+(none|[lr]\\s+\\d+)\\)\\s*" + //group 22
						"\\(count\\s+(\\d+)\\)\\s*" + //group 23
					"\\)\\s*" +
					"\\(tackle\\s+" +
	   					"\\(expires\\s+(\\d+)\\)\\s*" + //group 24
	   					"\\(count\\s+(\\d+)\\)\\s*" + //group 25
	   				"\\)\\s*" +
	   				"\\(collision\\s+(none|\\(ball\\)|\\(player\\)|\\(post\\)|\\s)+\\)\\s*" + //group 26
	   				"\\(foul\\s+" +
	   					"\\(charged\\s+(\\d+)\\)\\s*" + //group 27
	   					"\\(card\\s+(none|yellow|red)\\)\\s*" + //group 28
	   				"\\)\\s*" +
			"\\)$");
	Flag::initializeField();
	Self::positioned = false;
}
Ejemplo n.º 25
0
/**
 * Copy constructor. Creates a deep copy of the AccelSensor object. All parameters and the
 * settings of the InterfaceValues are adpoted by the copy.
 * @param sensor 
 */
AccelSensor::AccelSensor(const AccelSensor &sensor) : SimSensor(sensor), Object(),
		ValueChangedListener(), SimObject(sensor), mHostBody(0), mSensorBody(0), 
		mGravitationValue(0), mNumberOfAxes(sensor.mNumberOfAxes)
{
	mMaxSensorValue = sensor.mMaxSensorValue;
	mLocalPosition = dynamic_cast<Vector3DValue*>(getParameter("LocalPosition"));
	mLocalOrientation = dynamic_cast<QuaternionValue*>(getParameter("LocalOrientation"));
	mDisableBodyCollisions = dynamic_cast<BoolValue*>(getParameter("DisableBodyCollisions"));
	mSensorAxisOneValue = dynamic_cast<Vector3DValue*>(getParameter("Axis1"));
	mSensorAxisTwoValue = dynamic_cast<Vector3DValue*>(getParameter("Axis2"));
	mSensorAxisThreeValue = dynamic_cast<Vector3DValue*>(getParameter("Axis3"));
	mSensorSizeValue = dynamic_cast<Vector3DValue*>(getParameter("Measurements"));
	mFirstSensorValue = dynamic_cast<InterfaceValue*>(getParameter("AccelAxis1"));
	mSecondSensorValue = dynamic_cast<InterfaceValue*>(getParameter("AccelAxis2"));
	mThirdSensorValue = dynamic_cast<InterfaceValue*>(getParameter("AccelAxis3"));
	
	mScalingFactor = dynamic_cast<DoubleValue*>(getParameter("Tmp/ScalingFactor"));
	
	mReferenceBodyName = dynamic_cast<StringValue*>(getParameter("ReferenceBody"));
	mReferenceBodyName->set("");

	mLowPassFilterDelayValue = dynamic_cast<IntValue*>(Core::getInstance()->
		getValueManager()->getValue("/AccelSensor/LowPassFilterDelay"));

	mGlobalNoiseDeviationValue = dynamic_cast<DoubleValue*>(Core::getInstance()->
		getValueManager()->getValue("/AccelSensor/Deviation"));

	if(mLowPassFilterDelayValue == 0 || mGlobalNoiseDeviationValue == 0) {
		Core::log("AccelSensor: Could not find required Value.");
	}
	mColor = sensor.mColor;
	if(mNumberOfAxes > 0) {
		mOutputValues.append(mFirstSensorValue);
	}
	if(mNumberOfAxes > 1) {
		mOutputValues.append(mSecondSensorValue);
	}
	if(mNumberOfAxes > 2) {
		mOutputValues.append(mThirdSensorValue);
	}
	mSensorBody = 0;
	mSensorGeometry = 0;
	mGravitation = 0.0;
	mGlobalNoiseDeviation = mGlobalNoiseDeviationValue->get();
	mInitialized = false;
}
Ejemplo n.º 26
0
void Self::addPlayerType(std::string player_type) {
	int id = atoi((getParameter(player_type, "id")).c_str());
	types_id[id]                 = id;
	player_speed_max[id]         = atof((getParameter(player_type, "player_speed_max")).c_str());
	stamina_inc_max[id]          = atof((getParameter(player_type, "stamina_inc_max")).c_str());
	player_decay[id]             = atof((getParameter(player_type, "player_decay")).c_str());
	inertia_moment[id]           = atof((getParameter(player_type, "inertia_moment")).c_str());
	dash_power_rate[id]          = atof((getParameter(player_type, "dash_power_rate")).c_str());
	player_size[id]              = atof((getParameter(player_type, "player_size")).c_str());
	kickable_margin[id]          = atof((getParameter(player_type, "player_size")).c_str());
	kick_rand[id]                = atof((getParameter(player_type, "kick_rand")).c_str());
	extra_stamina[id]            = atof((getParameter(player_type, "extra_stamina")).c_str());
	effort_max[id]               = atof((getParameter(player_type, "effort_max")).c_str());
	effort_min[id]               = atof((getParameter(player_type, "effort_min")).c_str());
	kick_power_rate[id]          = atof((getParameter(player_type, "kick_power_rate")).c_str());
	foul_detect_probability[id]  = atof((getParameter(player_type, "foul_detect_probability")).c_str());
	catchable_area_l_stretch[id] = atof((getParameter(player_type, "catchable_area_l_stretch")).c_str());
}
Ejemplo n.º 27
0
static t_list		*productPage(t_list **script, t_socket *client)
{
  t_list		*list;
  char			request[1024];
  t_list		*ret;
  t_list		*tmp;

  char			*id;
  char			*amount;

  list = NULL;
  if (!script || !*script || !client || !client->request)
    return NULL;
  
  printf("\tProductPage :: \n");  
  if (!(id = getParameter(client, "id")))
    {
      printf("Missing id parameter\n");
      list = addToList(list, "");
      return commitResult(list, script);
    }


  // PARAMS WERE FILLED
  if ((amount = getParameter(client, "hiddenAmount")))
    list = addProductToCart(list, client, id, amount);

  /* DISPLAY */
  snprintf(request, 1024,
	   "SELECT "\
	   "MarqueId, CategorieId, TVAId, ProduitStockStatut, "\
	   "ProduitNom, ProduitDescription, ProduitPrixHT, ProduitPrixTTC "\
	   "FROM produits WHERE ProduitReference='%s' LIMIT 1;", id);
  setDatabase("lapothicaire");
  setScript(request);
  if ((ret = execRequest()) && (tmp = ret) && (ret = ret->next) && ret->content)
    {
      char	*content;
      char	*marqueId;
      char	*categorieId;
      char	*TVAId;

      t_product product;
      t_list	*tmp2;

      product.id = id;

      setRequestResult(ret->content);
      getNextResultValue(&marqueId);
      getNextResultValue(&categorieId);
      getNextResultValue(&TVAId);
      
      getNextResultValue(&product.ProduitStockStatut);
      getNextResultValue(&product.ProduitNom);
      getNextResultValue(&product.ProduitDescription);
      getNextResultValue(&product.ProduitPrixHT);
      getNextResultValue(&product.ProduitPrixTTC);
      setRequestResult(NULL);
      

      snprintf(request, 1024,
	       "SELECT CategorieNom FROM categories WHERE CategorieId='%s' LIMIT 1;",
	       categorieId);
      product.categorie = execRequestGetValue();
      snprintf(request, 1024,
	       "SELECT MarqueNom FROM marques WHERE MarqueId='%s' LIMIT 1;",
	       marqueId);
      product.marque = execRequestGetValue();
      snprintf(request, 1024,
	       "SELECT TVAValeur FROM tva WHERE TVAId='%s' LIMIT 1;",
	       TVAId);
      product.TVA = execRequestGetValue();      
      destroyList(tmp, FALSE);

      getDeclinaisons(&product);

      printf("\tCatégorie : '%s'\n", product.categorie);
      printf("\tMarque : '%s'\n", product.marque);
      printf("\tTVA : '%s'\n", product.TVA);
      printf("\tNom : '%s'\n", product.ProduitNom);
      printf("\tDescription : '%s'\n", product.ProduitDescription);
      printf("\tHT : '%s'\n", product.ProduitPrixHT);
      printf("\tTTC : '%s'\n", product.ProduitPrixTTC);


      list = displayProduct(list, &product);
    }
  else
    list = addToList(list, "<p>Pas de résultat pour ce produit.</p>");
  return commitResult(list, script);
}
Ejemplo n.º 28
0
void Mimic::update(DefaultGUIModel::update_flags_t flag) {
    if(flag == MODIFY) {
        gain   = getParameter("Gain").toDouble();
        offset = getParameter("Offset").toDouble();
    }
}
Ejemplo n.º 29
0
const String AutomizerAudioProcessor::getParameterText (int index)
{
    return String (getParameter (index), 2);
}
Ejemplo n.º 30
0
/**
 * Gives the FWHM of the peak. This is estimated as
 * 0.5*(LorentzFWHM + GaussianFWHM)
 * @return value of FWHM of peak
 */
double Voigt::fwhm() const {
  return (getParameter(LORENTZ_FWHM) + getParameter(GAUSSIAN_FWHM));
}