Exemplo n.º 1
0
/**
 * Initializes the text data of the text label of this dimension.
 * The text data is created at 0/0 at an angle or 0. Moving the
 * label to the right position at the right angle is up to the
 * particular dimension implementation.
 */
void RDimensionData::initTextData() const {
    double dimtxt = getDimtxt();

    QString label = getMeasurement();

    // TODO: fontName property takes precedence

    textData = RTextData(RVector(0,0),    // position
                         RVector(0,0),    // alignment point
                         dimtxt,              // text height
                         0.0,
                         RS::VAlignMiddle, RS::HAlignCenter,
                         RS::LeftToRight,
                         RS::Exact, 1.0,
                         label,
                         //fontName,
                         (document==NULL || document->getDimensionFont().isEmpty()) ? "Standard" : document->getDimensionFont(),
                         false, false,
                         0.0,
                         false           // not simple (diameter signs, stacked text, ...)
                         );

    textData.setDocument(document);
    textData.setLayerId(getLayerId());
    textData.setBlockId(getBlockId());
    textData.setColor(getColor());
    textData.setLineweight(getLineweight());
    textData.setSelected(isSelected());
    textData.setDimensionLabel(true);

    //qDebug() << "label color: " << textData.getColor();
    //qDebug() << "textData: " << textData;

    dirty = true;
}
Exemplo n.º 2
0
void get_event_data(bhep::event& evt, measurement_vector& meas, EVector& vert, double* mom)
{
  vert[0] = evt.vertex()[0];
  vert[1] = evt.vertex()[1];
  vert[2] = evt.vertex()[2];

  //make the measurement vector.
  vector<bhep::particle*> parts = evt.true_particles();
  vector<bhep::particle*>::iterator pIt;

  //in this version use the truth. the combined hadron particle from G3
  for (pIt = parts.begin();pIt != parts.end();pIt++)
    {
      if ( (*pIt)->name().compare("Hadronic_vector") == 0 ){

	const vector<bhep::hit*>& hits = (*pIt)->hits("MIND");
	mom[0] = (*pIt)->px();
	mom[1] = (*pIt)->py();
	mom[2] = (*pIt)->pz();

	for (size_t j=0; j< hits.size(); j++){

	  Measurement* mnt = getMeasurement( *hits[j] );

	  meas.push_back( mnt );

	}
      }
    }

}
void loop()
{
  for(int i=0; i<270; i++)
  {
   // urm.setServo(i);
    Serial.println(getMeasurement());  // Output measurement
    delay(20);
  }
}
Exemplo n.º 4
0
float SHT3x::readTempF(const uint16_t& command) const {
    uint32_t raw_data = getMeasurement(command);
    if (!raw_data) {
        throw std::runtime_error("Bad Reading.");
    }
    uint16_t raw_temp = raw_data >> 16;
    float tempF = -49.0 + (315.0 * ((float) raw_temp / (float) 0xFFFF));
    return tempF;
}
Exemplo n.º 5
0
void ComplementaryFilter::updateImpl(
		double gx, double gy, double gz,
		double ax, double ay, double az,
	    double dt)
{
  if (!initialized_)
  {
    // First time - ignore prediction:
    getMeasurement(ax, ay, az,
                   q0_, q1_, q2_, q3_);
    initialized_ = true;
    return;
  }

  if(dt <= 0.0)
  {
    UERROR("dt=%f <=0.0, orientation will not be updated!", dt);
    return;
  }

  // Bias estimation.
  if (do_bias_estimation_)
    updateBiases(ax, ay, az, gx, gy, gz);

  // Prediction.
  double q0_pred, q1_pred, q2_pred, q3_pred;
  getPrediction(gx, gy, gz, dt,
                q0_pred, q1_pred, q2_pred, q3_pred);

  // Correction (from acc):
  // q_ = q_pred * [(1-gain) * qI + gain * dq_acc]
  // where qI = identity quaternion
  double dq0_acc, dq1_acc, dq2_acc, dq3_acc;
  getAccCorrection(ax, ay, az,
                   q0_pred, q1_pred, q2_pred, q3_pred,
                   dq0_acc, dq1_acc, dq2_acc, dq3_acc);

  double gain;
  if (do_adaptive_gain_)
  {
    gain = getAdaptiveGain(gain_acc_, ax, ay, az);

  }
  else
  {
    gain = gain_acc_;

  }

  scaleQuaternion(gain, dq0_acc, dq1_acc, dq2_acc, dq3_acc);

  quaternionMultiplication(q0_pred, q1_pred, q2_pred, q3_pred,
                           dq0_acc, dq1_acc, dq2_acc, dq3_acc,
                           q0_, q1_, q2_, q3_);

  normalizeQuaternion(q0_, q1_, q2_, q3_);
}
    IndexedVectorArray DynamicalSystemSimulator::getMeasurementArray
                    (TimeIndex startingTime, TimeSize duration)
    {
        BOOST_ASSERT(startingTime>y_.getFirstIndex() && "ERROR: The starting time is too early, try later starting time");
        IndexedVectorArray a;

        for (TimeIndex i= startingTime; i<startingTime+TimeIndex(duration);++i)
        {
            a.setValue(getMeasurement(i),i);
        }
        return a;
    }
Exemplo n.º 7
0
byte URMSerial::requestMeasurementOrTimeout(byte mType, int& value)
{
    // Request measurement or fail
    if(!requestMeasurement(mType))
    {
        return NOTREADY;
    }

    // Wait until we either timeout or we have a reading
    while(!reqTimeout() && !hasReading())
    {
        delay(10); // Wait a bit
    }

    // Request has timed out, FAIL
    if(reqTimeout()) return TIMEOUT;

    // Pass control to getMeasurement which will return the requested measurement
    return getMeasurement(value);

}
Exemplo n.º 8
0
/**
 * Initializes the text data of the text label of this dimension.
 * The text data is created at 0/0 at an angle or 0. Moving the
 * label to the right position at the right angle is up to the
 * particular dimension implementation.
 */
void RDimensionData::initTextData() const {
    double dimtxt = getDimtxt();

    QString label = getMeasurement();

    textData = RTextData(RVector(0,0),    // position
                         RVector(0,0),    // alignment point
                         dimtxt,              // text height
                         0.0,
                         RS::VAlignMiddle, RS::HAlignCenter,
                         RS::LeftToRight,
                         RS::Exact, 1.0,
                         label,
                         //fontName,
                         "Standard",
                         false, false,
                         0.0,
                         false           // not simple (diameter signs, stacked text, ...)
                         );

    dirty = true;
}
Exemplo n.º 9
0
	void* init_resource_thread(void* pLogger, void* pStartSem, MS_LIST* pMs_List, void* pMeasureRes){
		NLibMeasure::CMeasureAbstractThread* pMICThread;
		NLibMeasure::CMeasureAbstractResource* pMIC = (NLibMeasure::CMeasureAbstractResource*) pMeasureRes;
		
		if(pMIC->getVariant() == VARIANT_FULL) {
			pMICThread =  new NLibMeasure::CMeasureMICThread<VARIANT_FULL>(*((NLibMeasure::CLogger*)pLogger), *((NLibMeasure::CSemaphore*)pStartSem), getMeasurement(&pMs_List, MIC), *pMIC);
		} else {
			pMICThread =  new NLibMeasure::CMeasureMICThread<VARIANT_LIGHT>(*((NLibMeasure::CLogger*)pLogger), *((NLibMeasure::CSemaphore*)pStartSem), getMeasurement(&pMs_List, MIC), *pMIC);
		}
		
		return (void*) pMICThread;
	}