[[2011a]]

#contents

 #define R OUT_C
 #define L OUT_A
 #define RL SENSOR_3
 #define LL SENSOR_1
 #define isBlack <40
 #define isWhite >=40
 #define NINETY 17
 #define BALL 20
 
 void go_straight(){
 	OnFwd (R+L);
 }
 
 void go_straight_s(){
 	OnFwd (R+L);
 	Off (R+L);
 	Wait (2);	
 }
 
 void tr(){
 	OnFwd (L);
 	OnRev (R);
 }
 
 void tr_s(){
 	OnFwd (L);
 	Off (R+L);
 }
 
 void tl(){
 	OnFwd (R);
 	OnRev (L);
 }
 
 void tl_s(){
 	OnFwd (R);
 	Off (R+L);
 }
 
 void stop_moving(){
 	Off (R+L);
 	Wait (100);
 }
 
 task main (){
	SetSensor (RL, SENSOR_LIGHT);
	SetSensor (LL, SENSOR_LIGHT);
	
	int blackline = 0;
	while (1){
		go_straight();
		if (blackline >= 2) break;
		if (RL isBlack && LL isBlack){
			PlaySound (SOUND_CLICK);
			blackline++;
			while (RL isBlack || LL isBlack) go_straight();
		}
	}
	stop_moving();
	// turn left
	while (1){
		if (LL isBlack) break;
		tl_s();
	}
	stop_moving();
	// should be on the line, so trace it
	while (1){
		if (RL isBlack && LL isBlack) {
			while (RL isBlack && LL isBlack) go_straight();
			break;
		}
		else if (RL isWhite && LL isWhite) go_straight();
		else if (RL isBlack && LL isWhite) tr_s();
		else if (RL isWhite && LL isBlack) tl_s();
	}
	stop_moving();
	// should be at the end of the line
	/*while (1){
		if (LL isBlack) break;
		tl();
	}*/
	tl();
	Wait (NINETY);
	stop_moving();
	
	// ready
	while (1){
		if (Message() == 1){
			Wait (300);
			go_straight();
			Wait (BALL);
		}
		ClearMessage();
	}
	go_straight();
	//Wait (300);
 }



 #define R OUT_A
 #define L OUT_C
 #define SLIDE OUT_B
 #define RL SENSOR_1
 #define LL SENSOR_3
 #define NINETY 10
 #define isWhite <40
 #define isBlack >40
 #define ANGLE 10
 #define GOAL 500
 
 void go_straight(){
 	OnFwd (R+L);
 }
 
 void go_straight_s(){
	OnFwd (R+L);
	Off (R+L);
	Wait (1);
 }
 
 void go_back(){
	OnRev (R+L);
 }
 
 void tr(){
	OnFwd (L);
	OnRev (R);
	Off (R+L);
	Wait (1);
 }
 
 void tl(){
	OnFwd (R);
	OnRev (L);
	Off (R+L);
	Wait (1);
 }
 
 void stop_moving(){
	Off (R+L);
	Wait (100);
 }
 
 void out(){
	OnFwd (SLIDE);
	Wait (50);
	Off (SLIDE);
 }
 
 void set_in(){
	OnRev (SLIDE);
	Wait (50);
	Off (SLIDE);
 }
 
 task main (){
	SetSensor (RL, SENSOR_LIGHT);
	SetSensor (LL, SENSOR_LIGHT);
	
	int blackline = 0;
	while (1){
		go_straight_s();
		if (blackline >= 2) break;
		if (RL isBlack && LL isBlack){
			PlaySound (SOUND_CLICK);
			blackline++;
			while (RL isBlack || LL isBlack) go_straight_s();
		}
	}
	
	stop_moving();
	while (1){
		if (RL isWhite) break;
		tr();
	}
	stop_moving();
	while (1){
		if (RL isBlack && LL isBlack) {
			while (RL isBlack && LL isBlack) go_straight_s();
			break;
		}
		else if (RL isWhite && LL isWhite) go_straight_s();
		else if (RL isBlack && LL isWhite) tr();
		else if (RL isWhite && LL isBlack) tl();
	}
	while (1){
		stop_moving();
		SendMessage (1);
		
		tl();
		Wait (NINETY);
		stop_moving();
		
		Wait (300);
		
		tr();
		Wait (70);
		go_straight_s();
		Wait (GOAL);
		
		stop_moving();
		out();
		
		set_in();
		go_back();
		Wait (GOAL);
		tl();
		Wait (ANGLE);
		Wait (ANGLE);
		stop_moving();
	}
 }

*メンバー紹介 [#d0cdd143]
・hiros

・show

・くまちゃん

・まえだ

*マシン紹介 [#acac78f6]

**ボール押し出し [#e162e410]
#ref(ロボコン(ちびろぼ).jpg);
#ref(ろぼこん(ちびろぼ)2.jpg);
#ref(ろぼこん(ちびろぼ)3.jpg);

**ボールを運ぶ [#m4567511]
#ref(ろぼこん(でかろぼ)2.jpg);
#ref(ろぼこん(でかろぼ)3.jpg);
#ref(ろぼこん(でかろぼ)4.jpg);
#ref(ろぼこん(でかろぼ)5.jpg);

*プログラミング [#w9700e66]

**ボール押し出し [#j5a06489]

**ボールを運ぶ [#r8a0be8a]


*感想と考察 [#a54e4aae]

**hiros [#uaeafd10]

**show [#p66b4bc6]

**くまちゃん [#t5c20556]

**まえだ [#pd2104ff]


*コメント [#b65accf6]

#comment

今日:
&counter(today);

昨日:
&counter(yesterday);

全て:
&counter(all);


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS