Пример #1
0
//----Checks if there is a match, add activities, else creates a new association----//
void checkLocalCell()
{
	//uses a normalised version of the localTemp.  The comparison local cells are stored as normalised when 1st created
	char z;
	char match = 0;
	float dotTempValue = 0;
	float tempAngle = 0;
	if(nextEmptyCell == 0)
	{
	  //first localCellView
		addAssociation(nextEmptyCell);
    nextEmptyCell++;
    PlaySound(soundFastUpwardTones);
    while(bSoundActive) {}
	}
  else {
    for(z = 0; z<nextEmptyCell; z++)
    {
    	//search for a previous local cell that matches the current view to a certain degree
      memcpy(localComparison,poseAssoc[z].localView,numNeuralUnits*4);
      dotTempValue = dotMultiply();
      tempAngle = acos(dotTempValue);
      if(tempAngle<0.17) //if difference less than 10 degrees between vectors
      {
      	match = 1;
      	break; //save cycles break out
      }
    }
    if(match == 0)
    {//no match found - create a new local view cell
    	addAssociation(nextEmptyCell);
    	nextEmptyCell++;
    	nxtDisplayCenteredTextLine(6, "cell created");
      PlaySound(soundFastUpwardTones);
      while(bSoundActive) {}
    }
    else if(match == 1)
    {
    	char tempX, tempY, tempTheta;
    	tempX = poseAssoc[nextEmptyCell-1].xCell;
    	tempY = poseAssoc[nextEmptyCell-1].yCell;
    	tempTheta = poseAssoc[nextEmptyCell-1].thetaCell;
    	//injectEnergy(stepSize, tempX, tempY, tempTheta);
    	nxtDisplayCenteredTextLine(6, "Energy Injected");
      PlaySound(soundBeepBeep);
      while(bSoundActive) {}
    }
  }
}
Пример #2
0
void SrcModel::addSrcData(QString dataString) {
    int id = dataString.section(":",4,4).toInt();
    double staticT = dataString.section(":",11,11).toDouble();
    double staticEn = dataString.section(":",12,12).toDouble();
    double dynT = dataString.section(":",13,13).toDouble();
    double dynEn = dataString.section(":",14,14).toDouble();
    srcData.insertMulti(id, new Data(dynEn, staticEn, dynT, staticT, id));
    addAssociation(id, dataString.section(":",6,6).toInt());
}
Пример #3
0
EditAssociationConstraint::EditAssociationConstraint(Task *t, QWidget *parent) : task(t), QDialog(parent) {
    predecessors = new QListView(this);
    successors = new QListView(this);
    predecessors->setSelectionMode(QAbstractItemView::MultiSelection);
    successors->setSelectionMode(QAbstractItemView::MultiSelection);
    predecessors->setModel(MainWindow::tasksModel);
    successors->setModel(MainWindow::tasksModel);

    addB = new QPushButton("Add",this);
    addB->connect(addB,SIGNAL(clicked()),this,SLOT(addAssociation()));
    removeB = new QPushButton("Remove",this);
    removeB->connect(removeB,SIGNAL(clicked()),this,SLOT(removeAssociation()));
    formLayout = new QFormLayout(this);
    formLayout->addRow("predecessors : ",predecessors);
    formLayout->addRow("successors : ",successors);
    formLayout->addRow(addB);
    formLayout->addRow(removeB);

    setLayout(formLayout);
}
Пример #4
0
void MAPSJoin::ProcessData()
{
	//Here I have the list of obstacles and the list of the obstacles in the gating window of each one
	//I have to compare all the parameters that I can to get the coincident level that the obstacles have
	//and select one nonone for each one

	//Useful parameters
	/*
	-Position
	-Size
	-Width
	-Speed
	-Direction vector
	-Relative speed of the vehicle
	-Kind of obstacle
	*/

	//I have to create 3 list

	//-List of asociated obstacles
	/*
		Format:
		2 columns
		n rows; n = number of Laser obstacles
	*/

	//-List of non asociated Laser obstacles
	/*
	Format:
	1 row n columns
	For each position we have the id of one Laser object
	*/

	//-List of non asociated Camera obstacles
	/*
	Format:
	1 row n columns
	For each position we have the id of one Camera object
	*/
	joined.resize(Laser_Matched.number_objects);
	for (int i = 0; i < Laser_Matched.number_objects; i++)
	{
		//Clean list of joined
		joined.vector[i][0] = Laser_Matched.id[i];
		joined.vector[i][1] = -1;
		joined.vector[i][2] = 0;
		for (int j = 0; j < Laser_Matched.number_matched[i]; j++)
		{
			score = 0;
			score = calculateScore(Laser_Matched.id[i], Laser_Matched.Matrix_matched[i][j][0]);
			if (score >= 0) 
			{
				addAssociation(i, Laser_Matched.Matrix_matched[i][j][0], score);
			}
		}
	}
	selectAssociations();
	//At the end of this for we will have a list of asociated objects
	cleanAssociatedList();
	//Now we can find the non calculated Laser objects
	for (int j = 0; j < ArrayLaserObjects.number_of_objects; j++)
	{
		if (!findAssociatedLaser(ArrayLaserObjects.object[j].id))
		{
			nonLaserJoined.push_back(ArrayLaserObjects.object[j].id);
		}
	}
	//Now we can find the non calculated Caemra objects
	for (int k = 0; k < ArrayCameraObjects.number_of_objects; k++)
	{
		if (!findAssociatedCamera(ArrayCameraObjects.object[k].id))
		{
			nonCameraJoined.push_back(ArrayCameraObjects.object[k].id);
		}
	}
}