Hallo Leute,
ich versuche mich gerade an einem Linienfolger Programm für den RP6 Roboter. Dieser soll eine schwarze Linie auf Grünem untergrund folgen.Mein Problem ist, dass die verfolgung mehr schlecht als recht funktioniert und das ich auch sehr enge kurven habe. Vielleicht habt ihr eine Idee wie ich dieses Problem lösen kann...

hier ein Bild unserer Platine mit Phototransistoren und weiser LED:

Bild


Vielen Dank für euere Hilfe Bild
hier mein Programm Code:

Code:
int a = 80;
void bumpersStateChanged(void)
{
	if (bumper_left || bumper_right)
	{

		setLEDs(0b010000);
		startStopwatch1();
		setStopwatch1(0);
	
		while (getStopwatch1() < 2000)
		{
			changeDirection(BWD);
			moveAtSpeed(200,200);
			task_RP6System();
	
		}
	
		a +=10;
		if (a == 150)
		{
			a = 80;
		
		}
	
		changeDirection(FWD);
		moveAtSpeed(a,a);
		task_RP6System();
	}
}
	
	void blink(void)
{	
	if(getStopwatch1() > 500)
	{
	
		statusLEDs.LED2 = !statusLEDs.LED2;
		statusLEDs.LED5 = !statusLEDs.LED5;
		updateStatusLEDs();
		setStopwatch1(0);
	
	}
}

int main(void)
{
	initRobotBase();
	setLEDs(0b111111);
	mSleep(1500);
	setLEDs(0b100001);

	powerON();

	startStopwatch1();
	setStopwatch1(0);

	while(true)
	{
		task_RP6System();
		task_motionControl();
		task_ADC();

		if(getStopwatch1() > 100)

		{

			int speed = 30;
			int l = adc0;
			int r = adc1;
			int noise = 10;
			int diff = l -r;
			writeInteger(l, DEC);
			writeString_P("|");
			writeInteger(r, DEC);
			writeString_P(" / ");
			writeInteger(diff, DEC);
			setStopwatch1(0);

			if (diff > noise)

			{

				writeString_P(" (Links)");
				changeDirection(FWD);
				moveAtSpeed(30,0);
			}

			else if (diff < (noise * -1))

			{
			writeString_P(" (Rechts)");
			changeDirection(FWD)
			moveAtSpeed(0,30);
			}

			else
			{
			changeDirection(FWD);
			moveAtSpeed(30,30);
			}
			writeString_P("\n");
		}

	}
	return 0;
}