Exemple #1
0
/*******************************************************************
* Function:			void initializeRobot(void)
* Input Variables:	none
* Output Return:	none
* Overview:			This initialize the robot by using other startups
********************************************************************/
void initializeRobot(void)
{
	ATopstat = ATTINY_open();//open the tiny microcontroller
	LEopstat = LED_open(); //open the LED module
	LCopstat = LCD_open(); //open the LCD module
	STEPPER_open(); // Open STEPPER module for use
	SPKR_open(SPKR_TONE_MODE);//open the speaker in tone mode
	
	LED_open();
	I2C_open();
	ADC_open();//open the ADC module
 	ADC_set_VREF( ADC_VREF_AVCC );// Set the Voltage Reference first so VREF=5V.
	
	// Initialize IR Values and Reset Prefilter
	checkIR();
	prefilter(1);
	
	// Mistake? odometryTrigger = WORLD_RESOLUTION_SIZE*D_STEP which is about 6
	odometryTrigger = WORLD_RESOLUTION_SIZE/2.75;
	
	// pixel array for the LCD screen
	for(int i = 0; i < 4; i++) {
		for(int j = 0; j < 32; j++) {
			pix_arr[i][j] = 0x00;
		}
	}
}
const QList<Team*>& TeamBuilder::createTeams(Project& project){

    if (prefilter(project))
    {
        QList<Team*> list;
        return list;
    }


    PciBuilder* builder = new PciBuilder;

    QMap<int, QList < QPair<int,int> >* >& pci = builder->calculatePci(project.getRegisteredStudents());


    Distributor* distributor = new Distributor (pci,project);

  QList<Team*> list = distributor->distributeTeams(project.getMinTeamSize(),project.getMaxTeamSize());


  delete builder;
   delete distributor;
   delete &pci;


   return list;
}
float4 __CGsampler1DARRAY_state::nearest(const __CGimage &image, float4 strq)
{
    int1 u = wrapNearest(wrapS, image.borderlessSize.x, strq.s);
    int1 slice = wrapNearest(GL_CLAMP_TO_EDGE, image.borderlessSize.y, strq.t);
    float4 texel = image.fetch(u, slice, 0, clampedBorderValues);

    return prefilter(texel, strq.p);
}
void CBOT_main( void )
{
	// Initialize variables
	int btnValue=0;//value of button pushed

	ATopstat = ATTINY_open();//open the tiny microcontroller
	LEopstat = LED_open(); //open the LED module
	LCopstat = LCD_open(); //open the LCD module
	STEPPER_open(); // Open STEPPER module for use
	SPKR_open(SPKR_BEEP_MODE);//open the speaker in beep mode
	
	LED_open();
	I2C_open();
	ADC_open();//open the ADC module
 	ADC_set_VREF( ADC_VREF_AVCC );// Set the Voltage Reference first so VREF=5V.

	// Initialize IR Values and Reset Prefilter
	checkIR();
	prefilter(1);
	
	
	// LCD_printf("PRESS a button\nOR\nWAIT for default\n");
	//TMRSRVC_delay(3000);//wait 3 seconds
	//btnValue = WaitButton();
	LCD_clear;
	

	// Infinite loop
	while (1)
    {
		// update the sensor values
		checkLightSensor();
		checkIR();
		checkContactIR();
		
		//Test contact Sensors
		// LCD_printf("Right Contact: %i\nLeft Contact: %i\n\n\n",rightContact,leftContact);
		// TMRSRVC_delay(1000);//wait 1 seconds
		
		//Test IR Sensors
		// LCD_printf("FrontIR = %3.2f\nBackIR = %3.2f\nLeftIR = %3.2f\nRightIR = %3.2f\n", ftIR,bkIR,ltIR,rtIR);
		// TMRSRVC_delay(2000);//wait 2 seconds
		
		// run the moveBehavior FSM
		moveBehavior(LIGHT_LOVER);
		
		// debug primitive behaviors
		// moveAway();
		// moveWall();
		// moveRetreat();
		// moveTrackLight();
		// moveWander();
	
    }
}// end the CBOT_main()
float4 __CGsampler1DARRAY_state::linear(const __CGimage &image, float4 strq)
{
    int2 u;
    int1 v;
    float4 tex2[2];
    float s;

    u = wrapLinear(wrapS, image.borderlessSize.x, strq.s, s);
    v = wrapNearest(GL_CLAMP_TO_EDGE, image.borderlessSize.y, strq.t + 0.5);
    // Fetch 2 texels
    for (int i=0; i<2; i++) {
        float4 texel = image.fetch(u[i], v, 0, clampedBorderValues);

        tex2[i] = prefilter(texel, strq.p);
    }

    return linear1D(tex2, frac(float1(s) - 0.5f));
}
Exemple #6
0
void prefilterenvmap(float* envpixels, int width, int height, float* thecoeffs) {
    int count = 0;
    for (int i = 0 ; i < height ; i++) {
        for (int j = 0 ; j < width ; j++) {
            for (int k = 0 ; k < 3 ; k++) {
                hdr[i][j][k] = envpixels[count];
                count++;
            }
        }
    }
    prefilter(width, height); //calculate the L coeffs

    int counter = 0;
    for (int i = 0; i < 9; ++i) { //copy the coeffs into a 27 float array
        for (int j = 0; j < 3; ++j) {
            thecoeffs[counter] = coeffs[i][j];
            counter++;
        }
    }
}