Exemplo n.º 1
0
void QASActor::update(QVariantMap json) {
#ifdef DEBUG_QAS
  qDebug() << "updating Actor" << m_id;
#endif
  bool ch = false;
  bool dummy = false;

  m_json = json;

  m_author = NULL;

  updateVar(json, m_url, "url", ch); 
  updateVar(json, m_displayName, "displayName", ch);
  updateVar(json, m_objectType, "objectType", ch);
  updateVar(json, m_preferredUsername, "preferredUsername", ch);

  updateVar(json, m_published, "published", ch);
  updateVar(json, m_updated, "updated", ch);

  m_webFinger = m_id;
  if (m_webFinger.startsWith("http://") || m_webFinger.startsWith("https://"))
    m_webFinger = m_preferredUsername;

  if (m_webFinger.startsWith("acct:"))
    m_webFinger.remove(0, 5);

  // this seems to be unreliable
  updateVar(json, m_followed_json, "pump_io", "followed", dummy);

  updateVar(json, m_summary, "summary", ch);
  updateVar(json, m_location, "location", "displayName", ch);

  QString oldUrl = m_imageUrl;
  if (json.contains("image")) {
    QVariantMap im = json["image"].toMap();
    if (json.contains("status_net"))
      updateVar(im, m_imageUrl, "url", ch);
    else
      updateUrlOrProxy(im, m_imageUrl, ch);
  }

  if (ch)
    emit changed();
}
Exemplo n.º 2
0
/*
 *	Function called from main block of code
 *  Returns true (1) if sucessful, 0, if unsucessful
 */ 
int Controller()	{
	
	// Robot will turn this angle in this timestep
	// DEFAULT = no change in current heading
	double angleOfTurn = 0;	


	// INITIALIZE VALUES
	initialize();	
				

	// Checks for that remode control option is disabled
	if (rcDisabled) {		  	
		return false;
	}

	// Set ERROR flag when updating values
	int ERROR = updateVar();			

	// Runs linear controller w/Control Law (calculates next step)
	linearAngle = linearController();
	
	// Checks/updates computer model to see if robot is on 
	// desired trajectory
	modelAngle = modelController();	
	
	
	//CURRENTLY SET FOR ALL SENSOR INPUT
	int c1 = 1;
	int c2 = 0;
	if (ERROR == true)
	{
		//STEER WITHOUT SENSORY INPUT
		c1 = 0; c2 = 1;
	}  	

	// CONTROL LAW - MODEL VS. SENSOR DATA
	angleOfTurn = c1 * linearAngle + c2 * modelAngle;
							 
	// Send commands to steering board (set values of enums)							
	steer(angleOfTurn);
	
	// Update robot model of location
	updateModel(angleOfTurn);	
		
	return ERROR;
}
Exemplo n.º 3
0
void VariableEditorBase::onCheckStateChanged(int)
{
    updateVar();
}
Exemplo n.º 4
0
 Matrix *UserSpace::loadFrom(const char *filename, ...)
 {
   ifstream sfile(filename, ios::in);
   string line;   
   Matrix *curM;
   int state = 0;
   string varName;
   int rows(0), cols(0);
   vector<OM_SUPPORT_TYPE> elements;

   int curRows(0), curCols(0);
   int error = 0;
   while(getline(sfile, line))
     {
       if (line.size() == 0) 
         continue;

       if (state == 0) // expecting a new matrix
         {
           if (isComment(line))
             {
               curRows = 0;
               curCols = 0;
               if(containName(line))
                 {
                   varName = getName(line);
                   state = 0;
                 }
               else if (isRow(line))
                 {
                   rows = getRows(line);
                   state = 0;
                 }
               else if (isCol(line))
                 {
                   cols = getCols(line);
                   state = 0;
                 }
             }
           else
             {
               curCols = readDataLine(elements, line);
               curRows++;
               if (cols != 0 && cols != curCols)
                 {
                   error = 1;
                   break;
                 }
               state = 1;
             }
         }
       else if (state = 1) // in the middle of reading data
         {          
           if (isComment(line)) // a new matrix starts
             {
               if (curRows > 0)
                 {
                   if (rows != 0 && rows != curRows)
                     {
                       error = 1;
                       break;
                     }
                   // store the data
                   int dims[2];
                   dims[0] = curRows; 
                   dims[1] = curCols;
                   const OM_SUPPORT_TYPE *e = &elements[0];
                   Matrix *m = new Matrix(NULL, 2, dims, e);
                   if (varName.size() != 0)
                     updateVar(varName.c_str(), m);
                   else
                     assert(0); // todo
                 }
               curRows = 0;
               curCols = 0;
               varName = "";
               state = 0;
               elements.clear();
               // processing the current line
               if(containName(line))
                 {
                   varName = getName(line);
                   state = 0;
                 }
               else if (isRow(line))
                 {
                   rows = getRows(line);
                   state = 0;
                 }
               else if (isCol(line))
                 {
                   cols = getCols(line);
                   state = 0;
                 }

             }
           else
             {
               // read data
               curCols = readDataLine(elements, line);
               curRows++;
               if (cols != 0 && cols !=  curCols)
                 throw ExeException("Error loading the file\n");

               state = 1;
             }
         }
     }

   if (state = 1)
     {
       if (curRows > 0)
         {
           if (rows != 0 && rows != curRows)
             {
               error = 1;
             }
           else
             {
               // store the data
               int dims[2];
               dims[0] = curRows; dims[1] = curCols;
               Matrix *m = new Matrix(NULL, 2, dims, &elements[0]);
               if (varName.size() != 0)
                 updateVar(varName.c_str(), m);
               else
                 assert(0); // todo

             }
         }
     }
   sfile.close();
   if (error == 1)
     throw ExeException("Error loading the file.");
 }
Exemplo n.º 5
0
void ValueComboVariableEditor::resetDefaultValue()
{
   _checkBox->setChecked(false);
   _comboBox->setCurrentIndex(_defaultValueIndex);
   updateVar();
}
Exemplo n.º 6
0
void ValueComboVariableEditor::onComboBoxCurrentIndexChanged(int)
{
    updateVar();
}
Exemplo n.º 7
0
void BoolComboVariableEditor::resetDefaultValue()
{
    _checkBox->setChecked(false);
    _comboBox->setCurrentIndex(_defaultValue ? COMBO_INDEX_TRUE : COMBO_INDEX_FALSE);
    updateVar();
}
Exemplo n.º 8
0
void DoubleSpinVariableEditor::onDoubleSpinBoxValueChanged(double)
{
    updateVar();
}
Exemplo n.º 9
0
void DoubleSpinVariableEditor::resetDefaultValue()
{
    _checkBox->setChecked(false);
    _doubleSpinBox->setValue(_defaultValue);
    updateVar();
}
Exemplo n.º 10
0
void LinearIsoElasticPFDamage::computeQpStress()
{
  updateVar();
  updateJacobian();
}
Exemplo n.º 11
0
void LinearIsoElasticPFDamage::computeQpStress()
{
  _stress[_qp].zero();
  updateVar();
}