Difference between revisions of "Czechbot"

From RoboWiki
Jump to: navigation, search
(Abstract)
(Project Files)
 
(12 intermediate revisions by the same user not shown)
Line 14: Line 14:
 
'''General Idea:'''
 
'''General Idea:'''
  
Make a robot which can find a goal in a non-cycled maze (only with blind tracks) of black lines by going left on every intersection.
+
Make a robot which can find a goal in a non-cycled maze (only with dead end tracks) of black lines by going left on every intersection.
  
 
----
 
----
Line 26: Line 26:
 
'''Results:'''
 
'''Results:'''
  
Our robot can follow the black line, it can recognize blind tracks and turn himself back to line. The only problem is with marking the intersections. Because robot hasn´t a ideal movement, there are still some inaccuracies. Theoreticaly we have some thoughts how to clean up, but we didn´t have enough of time to implement it right.
+
Our robot can follow the black line, he can recognize blind tracks and turn himself back to line. The only problem is with marking the intersections. Because robot hasn´t a ideal movement, there are still some inaccuracies. Theoreticaly we have some thoughts how to clean up, but we didn´t have enough of time to implement it right.
 
+
So our robot can`t recognize intersections properly and that is the reason why he makes so many mistakes.
----
 
 
 
Some thoughts about intersection recognition:
 
 
 
<source lang="java">
 
 
 
</source>
 
  
 
== Project Files ==
 
== Project Files ==
Line 70: Line 63:
 
}
 
}
  
public boolean isMiddleDark() {
+
public boolean isMiddleDark() {
 
return middle.readValue() < 50;
 
return middle.readValue() < 50;
 
}
 
}
Line 79: Line 72:
 
if (isLeftDark()) {
 
if (isLeftDark()) {
 
if (isRightDark()) {
 
if (isRightDark()) {
navi.travel(6);
+
navi.travel(4);
 
if (isMiddleDark()) {
 
if (isMiddleDark()) {
 
Sound.twoBeeps();
 
Sound.twoBeeps();
navi.rotate(90);
+
navi.travel(2);
 +
navi.rotate(92);
 +
}
 +
else {
 +
navi.travel(2);
 +
navi.rotate(92);
 
}
 
}
else navi.rotate(90);
 
 
}
 
}
 
// leve T nebo leva zatacka
 
// leve T nebo leva zatacka
 
else {
 
else {
navi.travel(6);
+
navi.travel(4);
 
if (isMiddleDark()) {
 
if (isMiddleDark()) {
 
Sound.twoBeeps();
 
Sound.twoBeeps();
navi.rotate(90);
+
navi.travel(2);
 +
navi.rotate(92);
 +
}
 +
else {
 +
navi.travel(2);
 +
navi.rotate(92);
 
}
 
}
else navi.rotate(90);
 
 
}
 
}
 
}
 
}
Line 99: Line 100:
 
else if (isRightDark()) {
 
else if (isRightDark()) {
 
if (isLeftDark()) {
 
if (isLeftDark()) {
navi.travel(6);
+
navi.travel(4);
 
if (isMiddleDark()) {
 
if (isMiddleDark()) {
 
Sound.twoBeeps();
 
Sound.twoBeeps();
navi.rotate(90);
+
navi.travel(2);
 +
navi.rotate(92);
 
}
 
}
 
}
 
}
Line 108: Line 110:
 
else {
 
else {
 
navi.rotate(-5);
 
navi.rotate(-5);
navi.travel(6);
+
navi.travel(4);
 
if (isMiddleDark()) {
 
if (isMiddleDark()) {
 +
navi.travel(2);
 
Sound.beep();
 
Sound.beep();
 
}
 
}
else navi.rotate(-80);
+
else {
 +
navi.travel(2);
 +
navi.rotate(-80);
 +
}
 
}
 
}
 
}
 
}
Line 119: Line 125:
 
public void followLine() {
 
public void followLine() {
 
int dig = 0;
 
int dig = 0;
Motor.C.setSpeed(300);
+
Motor.C.setSpeed(270);
Motor.A.setSpeed(300);
+
Motor.A.setSpeed(270);
 
if (middle.readValue() > 45) {
 
if (middle.readValue() > 45) {
 
Motor.A.stop();
 
Motor.A.stop();
Line 129: Line 135:
 
Motor.C.rotate(-dig);
 
Motor.C.rotate(-dig);
 
navi.setSpeed(360);
 
navi.setSpeed(360);
navi.travel(6);
+
navi.travel(8);
navi.rotate(180);
+
navi.rotate(185);
 
}
 
}
  
Line 163: Line 169:
  
 
}
 
}
 +
 
</source>
 
</source>
  
 +
(illustration picture)
  
 
[[Image:Czechbot.jpg]]
 
[[Image:Czechbot.jpg]]
 +
  
  

Latest revision as of 09:39, 14 August 2009

Overview

Author(s): Pavel Kuttelwascher, Vladimír Janouš
Country: Czech Republic
Date: 12.08.2009-14.8.2009
Activity: Centrobot Robotic Summer School 2009
Location: Vienna, Austria
Hardware: LEGO Mindstorms NXT

Abstract

General Idea:

Make a robot which can find a goal in a non-cycled maze (only with dead end tracks) of black lines by going left on every intersection.


Thoughts:

At first we tried robot only with two sensors and he did quite well. But finally we had to rewrite a source code for three sensors robot in a very short time because of troubles with implementation of two sensors ancestor. And that was the whole problem.


Results:

Our robot can follow the black line, he can recognize blind tracks and turn himself back to line. The only problem is with marking the intersections. Because robot hasn´t a ideal movement, there are still some inaccuracies. Theoreticaly we have some thoughts how to clean up, but we didn´t have enough of time to implement it right. So our robot can`t recognize intersections properly and that is the reason why he makes so many mistakes.

Project Files

import lejos.navigation.TachoNavigator;


import lejos.nxt.*;

@SuppressWarnings("deprecation")
public class TEst {
	LightSensor left,right,middle;
	TachoNavigator navi;
	
public static void main(String[] args) throws Exception {
	 TEst l=new TEst();
	 l.run();
  }
	
public TEst() { 
	//init
    right = new LightSensor(SensorPort.S3);
    middle = new LightSensor(SensorPort.S2);
    left = new LightSensor(SensorPort.S4);
    navi = new TachoNavigator(5.6f, 11.5f, Motor.C, Motor.A); 
}
  
public boolean isRightDark() {
	return right.readValue() < 50;
}

public boolean isLeftDark() {
	return left.readValue() < 50;
}

public boolean isMiddleDark() {	
	return middle.readValue() < 50;
}

public void findIntersection() {
	navi.setSpeed(120);
	navi.travel(1);
	if (isLeftDark()) {
		if (isRightDark()) {
			navi.travel(4);
			if (isMiddleDark()) {
				Sound.twoBeeps();
				navi.travel(2);
				navi.rotate(92);
			}	
			else {
				navi.travel(2);
				navi.rotate(92);
			}	
		}
		// leve T nebo leva zatacka
		else {
			navi.travel(4);
				if (isMiddleDark()) {
					Sound.twoBeeps();
					navi.travel(2);
					navi.rotate(92);
				}
				else { 
					navi.travel(2);
					navi.rotate(92);
				}
		}
	}
	
	else if (isRightDark()) {
		if (isLeftDark()) {
			navi.travel(4);
			if (isMiddleDark()) {
				Sound.twoBeeps();
				navi.travel(2);
				navi.rotate(92);
			}
		}
		// pravy T nebo prava zatacka
		else {
				navi.rotate(-5);
				navi.travel(4);
				if (isMiddleDark()) {
					navi.travel(2);
					Sound.beep();
				}
				else {
					navi.travel(2);
					navi.rotate(-80);
				}
			}
	}
}

public void followLine() {
	int dig = 0;
	Motor.C.setSpeed(270);
	Motor.A.setSpeed(270);
	if (middle.readValue() > 45) {
		Motor.A.stop();
		Motor.C.forward();

		dig = Motor.C.getTachoCount();
		if (Math.abs(dig) > 270) {
			Motor.C.rotate(-dig);
			navi.setSpeed(360);
			navi.travel(8);
			navi.rotate(185);
		}

	}
	else if (middle.readValue() <= 45) {
		Motor.C.stop();
		Motor.A.forward();	
		Motor.C.resetTachoCount();
	}
}

public void run() throws InterruptedException {	  
    while (!Button.ESCAPE.isPressed()) { 	
    	followLine();
    	if (isLeftDark()) {
    		navi.stop();
    		Motor.A.rotate(-5);
    		Motor.C.rotate(5);
    		findIntersection();
    	}
    	else if (isRightDark()) {
    		navi.stop();
    		Motor.A.rotate(5);
    		Motor.C.rotate(-5);
    		findIntersection();
    	}
    	LCD.drawInt(SensorPort.S3.readValue(), 4, 0, 0);
    	LCD.drawInt(SensorPort.S2.readValue(), 4, 0, 1);
    	LCD.drawInt(SensorPort.S4.readValue(), 4, 0, 2);
    }
 }	

}

(illustration picture)

Czechbot.jpg



Go back to the List of the projects