[[2010b]]

[[2010b]]

*お絵かきロボット[2010/後期/A4/左] [#k085003f]

#contents

**課題の内容 [#se8cb208]
-LEGOブロックでオリジナルロボットを組み立て、NQCを利用してパートナーの似顔絵を描くプログラムを作ること。
-使用できるのはLEGOブロックとペンのみ。

**メンバー紹介 [#d5fbb1ab]
-松本
-王

**組み立てたロボット [#ob3846a1]
-全体像
→最初に作ったドライブベースでは四輪の場合前方に傾いてしまい、もしもペンが引っ掛かったときに本体に負荷がかかり、下手すれば壊れてしまうので、ドライブベースを作り直し、RCX本体にタイヤを横付けするようにした。


#ref(NEC_0007.jpg)



-タイヤ部
→上記のとおり、水平を保てるようになっている。さらに、車高が低いので、いざ上から過負荷がかかり、本体がたわんでもかろうじて移動はできるようになっている。


#ref(NEC_0013.jpg)




これがタイヤ部の工夫点。1プレート分だけずれている。


#ref(NEC_0012.jpg)



-ペン部
→当初はペン自体をゴムとビームを利用して固定したアームをつくり、アーム自体をアゲサゲしようとおもったが、うまく制御しづらい(それに単純すぎて面白みがない(笑))ので、エレベータ式にした。


#ref(NEC_0008.jpg)


#ref(NEC_0011.jpg)




これもモーターと可動部をつなげるために工夫が必要だった。
最初のドライブベースからアイディアを得て、モーターを挟み込んでみたらうまくいった。


#ref(NEC_0010.jpg)



#ref(NEC_0009.jpg)


やはり、工夫した点は、ペンをどのように保持しておくかであり、その点は、写真の白い
ギアを使うことで解決した。
これをつかうことで、ペンを持ち上げて保持する際、常にモーターを回し続けていても本体には負荷がかからない(もちろん電気的な負荷はコンピューターにはかかるかもしれないが・・・^^;)ので、常にまわしづづけることで、ペンの保持をすることができる。


#ref(NEC_0007.jpg)


**似顔絵の完成予想図 [#m550eff4]


-松本

#ref(NEC_0024.jpg)


**プログラム [#s7c2934c]

-松本のプログラム


 sub glasses()                        //メガネのサブルーチン
 {
 	OnFwd(OUT_A+OUT_C);     //前進
  	Wait(90);
 	OnRev(OUT_C);     //片方のみ逆回転させてメガネの右レンズを作る
 	Wait(25);
 	Off(OUT_A+OUT_B+OUT_C);
 	OnRev(OUT_B);        //ペン持ち上げ
 	Wait(15);
 	OnFwd(OUT_A+OUT_C);     //位置補正(機体移動)
 	Wait(42);
 	OnRev(OUT_A);
 	Wait(25);
 	OnRev(OUT_C)
 	Wait(45);
 	Off(OUT_A+OUT_B+OUT_C);
 	OnFwd(OUT_B);       //ペンを下す
 	Wait(23);
 	Off(OUT_A+OUT_B+OUT_C);
 	OnRev(OUT_A+OUT_C);    //メガネの右レンズの下枠を作る
 	Wait(28);
 	OnFwd(OUT_A+OUT_C);
 	OnRev(OUT_A);
 	Wait(22);
 	OnRev(OUT_B);       //ペン持ち上げ
 	Off(OUT_A+OUT_C);
 	Wait(50);
 	OnFwd(OUT_A+OUT_C);    //位置補正(機体移動)
 	OnRev(OUT_C);
 	Wait(22);
 	OnFwd(OUT_C);
 	Wait(4);
 	OnRev(OUT_A+OUT_C);
 	Wait(18);
 	OnFwd(OUT_A+OUT_C);
 	OnRev(OUT_A);
 	Wait(20);
 	OnFwd(OUT_B);       //ペンを下す
 	Off(OUT_A+OUT_C);
 	Wait(50);
 	OnFwd(OUT_A+OUT_C);        //メガネ左レンズを作る
 	OnRev(OUT_C);
 	Wait(22);
 	OnRev(OUT_A);
 	Wait(30);
 	OnFwd(OUT_A+OUT_C);
 	OnRev(OUT_A);
 	Wait(22);
 	Off(OUT_A+OUT_C);
 	OnRev(OUT_B);
 }
 
 
 sub faceline()             //輪郭のサブルーチン
 {
 	OnFwd(OUT_B);
 	Wait(5);Float(OUT_B);      //ペンをゆっくり下す
 	OnFwd(OUT_A+OUT_C);       //前進
 	Wait(80);
 	Off(OUT_C);           //左に旋回
 	Wait(120);
 	OnRev(OUT_B);         //ペンを上げる
 	OnFwd(OUT_C);         //位置補正(機体移動)
 	Wait(48);
 	Off(OUT_A+OUT_C);
 	OnFwd(OUT_A);         //左回転
 	OnRev(OUT_C);
 	Wait(120);
 	OnRev(OUT_A);         //位置補正(ペン位置変更)
 	Wait(65);
 	OnFwd(OUT_B);         //ペンをゆっくり下す
 	Wait(5);Float(OUT_B);
 	OnFwd(OUT_A+OUT_C);      //前進
 	Wait(80);
 	OnRev(OUT_B);         //ペンを上げる
 	OnFwd(OUT_A+OUT_C);      //位置補正(機体移動)
 	Wait(54);
 	OnFwd(OUT_A);         //左回転
 	OnRev(OUT_C);
 	Wait(85);
 	OnRev(OUT_A);
 	Wait(65);
 	OnFwd(OUT_B);
 	Wait(5);Float(OUT_B);
 	OnFwd(OUT_A+OUT_C);
 	Wait(88);
 	Off(OUT_A+OUT_C);
 	OnRev(OUT_B);
 }
 
 
 sub nose()
 {
 	OnFwd(OUT_A+OUT_C);
 	Wait(34);
 	OnRev(OUT_C);
 	Wait(22);
 	OnRev(OUT_B);
 	OnFwd(OUT_C);
 	Wait(36);
 	OnRev(OUT_A);
 	Wait(22);
 	Float(OUT_B);
 	OnRev(OUT_C);
 	Wait(32);
 	OnFwd(OUT_B);
 	Wait(5);
 	Float(OUT_B);
 	OnRev(OUT_A+OUT_C);
 	Wait(29);
 	Off(OUT_A+OUT_C);
 }
 
 
 sub mouth()
 {
 	OnFwd(OUT_C);
 	OnRev(OUT_A);
 	Wait(20);
 	OnFwd(OUT_B);
 	Wait(5);
 	Float(OUT_B);
 	OnFwd(OUT_A);
 	OnRev(OUT_C);
 	Wait(60);
 	OnRev(OUT_B);
 }
 
 
 sub hair()
 {
 	repeat(3)
 	{
 		OnFwd(OUT_B);
 		Wait(5);
 		Float(OUT_B);
 		OnRev(OUT_A);
 		OnFwd(OUT_C);
 		Wait(60);
 		Off(OUT_A);
 		OnRev(OUT_B);
 		OnRev(OUT_C);
 		Wait(20);
 		OnFwd(OUT_B);
 		Wait(5);
 		Float(OUT_B);
 		OnRev(OUT_C);
 		OnFwd(OUT_A);
 		Wait(60);
 		Off(OUT_C);
 		OnRev(OUT_B);
 		OnRev(OUT_A);
  		Wait(20);
  	}
 } 
 
 task main()
 {
 	faceline();
 	OnFwd(OUT_A+OUT_C);
 	Wait(40);
 	Off(OUT_A+OUT_C);
 	OnFwd(OUT_A);
 	OnRev(OUT_C);
 	Wait(140);
 	OnRev(OUT_A);
 	Wait(38);
 	OnFwd(OUT_B);
 	Wait(5);
 	Float(OUT_B);
 	glasses();
 	OnFwd(OUT_A+OUT_C);
 	Wait(98);
 	OnRev(OUT_C);
 	Wait(139);
 	OnRev(OUT_A);
 	Wait(30);
 	OnFwd(OUT_B);
 	Wait(6);
 	Float(OUT_B);
 	nose();
 	OnRev(OUT_B);
 	OnFwd(OUT_A+OUT_C);
 	Wait(48);
 	mouth();
 	Wait(200);
 	OnFwd(OUT_C);
 	Wait(50);
 	OnRev(OUT_C);
 	Wait(260);
 	Off(OUT_A+OUT_C);
 	hair();
 	Off(OUT_A+OUT_C);	
 }




-王

#define turn_up OnFwd(OUT_B);
#define turn_down OnRev(OUT_B);Wait(4);Float(OUT_B);
#define go OnFwd(OUT_A);OnFwd(OUT_C);
#define back OnRev(OUT_A);OnRev(OUT_C);
#define tomaru Off(OUT_A+OUT_C+OUT_B);
#define tomaruAC Off(OUT_A+OUT_C);
#define backA OnRev(OUT_A);
#define backC OnRev(OUT_C);
 #define turn_up OnFwd(OUT_B);
 #define turn_down OnRev(OUT_B);Wait(4);Float(OUT_B);
 #define go OnFwd(OUT_A);OnFwd(OUT_C);
 #define back OnRev(OUT_A);OnRev(OUT_C);
 #define tomaru Off(OUT_A+OUT_C+OUT_B);
 #define tomaruAC Off(OUT_A+OUT_C);
 #define backA OnRev(OUT_A);
 #define backC OnRev(OUT_C); 
 
 sub down()                       //ペンを下げる
 {
 	turn_up;         
 	Wait(100);
 	turn_down;
 }
 
 sub megane()         //眼鏡を書くプログラム
 {
 	go;          
 	Wait(70);              //眼鏡の上の線
 	backA;
 	Wait(25);              //右の線
 	tomaru;
 	turn_up;
 	Wait(15);
 	go;Wait(55);
 	backC;Wait(25);
 	back;Wait(62);         //下の線を書くために調整
 	tomaru;
 	turn_down;Wait(50);tomaru;
 	back;Wait(28);
 	go;
 	backC;Wait(20);
 	turn_up;tomaruAC;Wait(50);tomaru;
 	go;
 	backA;Wait(20);
 	go;Wait(70);      //右のレンズ
 	backA;Wait(2);
 	back;Wait(80);
 	go;
 	backC;Wait(20);
 	turn_down;tomaruAC;Wait(50);
 	go;
 	backA;Wait(20);
 	back;Wait(24);
 	go;
 	backC;Wait(20);
 	turn_up;         //左のレンズ
 } 
 
 sub linkaku()
 {
 	back;Wait(60);tomaru;Wait(50);     //輪郭をかける状態に戻す
 	turn_down;Wait(50);
 	go;Wait(70);              //左の頬
 	Off(OUT_C);Wait(70);tomaru;
 	turn_up;
 	go;Wait(48);tomaru;
 	go;backC;Wait(110);tomaru;
 	back;Wait(53);tomaru;
 	turn_down;Wait(60);tomaru;        //顎の部分
 	go;Wait(60);
 	turn_up;
 	go;Wait(50);tomaru;
 	go;backC;Wait(154);tomaru;
 } 
 
 sub hana()
 {
 	go;backA;Wait(325);tomaru;     
 	back;Wait(94);tomaru;
 	go;backA;Wait(100);tomaru;
 	back;Wait(25);go;backC;Wait(73);tomaru;
 	go;Wait(44);tomaru;
 	turn_down;Wait(50);
 	go;Wait(25);
 	backC;Wait(8);tomaru;
 	turn_up;Wait(50);tomaru;      //鼻を書くいい位置につく
 	go;Wait(5);tomaru;
 	turn_down;Wait(50);
 	go;backC;Wait(20);        //鼻を一気/

sub down()
{
	turn_up;
	Wait(100);
	turn_down;
}

sub megane()
{
	go;
 	Wait(70);
	backA;
	Wait(25);
	tomaru;
	turn_up;
	Wait(15);
	go;Wait(55);
	backC;Wait(25);
	back;Wait(62);
	tomaru;
	turn_down;Wait(50);tomaru;
	back;Wait(28);
	go;
	backC;Wait(20);
	turn_up;tomaruAC;Wait(50);tomaru;
	go;
	backA;Wait(20);
	go;Wait(70);
	backA;Wait(2);
	back;Wait(80);
	go;
	backC;Wait(20);
	turn_down;tomaruAC;Wait(50);
	go;
	backA;Wait(20);
	back;Wait(24);
	go;
	backC;Wait(20);
	turn_up;
}

sub linkaku()
{
	back;Wait(60);tomaru;Wait(50);
	turn_down;Wait(50);
	go;Wait(70);
	Off(OUT_C);Wait(70);tomaru;
	turn_up;
	go;Wait(48);tomaru;
	go;backC;Wait(110);tomaru;
	back;Wait(53);tomaru;
	turn_down;Wait(60);tomaru;
	go;Wait(60);
	turn_up;
	go;Wait(50);tomaru;
	go;backC;Wait(154);tomaru;
}

sub hana()
{
	go;backA;Wait(325);tomaru;
	back;Wait(94);tomaru;
	go;backA;Wait(100);tomaru;
	back;Wait(25);go;backC;Wait(73);tomaru;
	go;Wait(44);tomaru;
	turn_down;Wait(50);
	go;Wait(25);
	backC;Wait(8);tomaru;
	turn_up;Wait(50);tomaru;
	go;Wait(5);tomaru;
	turn_down;Wait(50);
	go;backC;Wait(20);
}

sub kaminoke()
{
	repeat(5){
		go;backC;Wait(35);tomaru;
		turn_down;Wait(50);tomaru;
		go;backA;Wait(75);tomaru;
		turn_up;Wait(50);tomaru;
		go;backC;Wait(35);tomaru;
		go;Wait(3);tomaru;
	}
}

sub kaminoker()
{
	repeat(5){
		turn_down;Wait(67);tomaru;
		go;backA;Wait(200);tomaru;
		turn_up;Wait(67);tomaru;
		back;Wait(8);tomaru;
		go;backC;Wait(200);tomaru;
		go;Wait(2);tomaru;tomaru;
	}
}


task main()
{
	down();
	Wait(30);
	megane();
	go;Wait(58);
	backA;Wait(147);
	linkaku();
	go;Wait(48);
	kaminoke();
	turn_up;Wait(50);tomaru;
	go;backA;Wait(75);tomaru;
	back;Wait(7);tomaru;
	kaminoker();
	turn_up;Wait(50);tomaru;
	hana();
	turn_up;Wait(50);
	tomaru;
}


 		go;backA;Wait(200);tomaru;
 		turn_up;Wait(67);tomaru;
 		back;Wait(8);tomaru;
 		go;backC;Wait(200);tomaru;
 		go;Wait(2);tomaru;tomaru;
 	}
 } 
 
 
 task main()
 { 
 	down();
 	Wait(30);
 	megane();
 	go;Wait(58);
 	backA;Wait(147);
 	linkaku();
 	go;Wait(48);
 	kaminoke();
 	turn_up;Wait(50);tomaru;
 	go;backA;Wait(75);tomaru;
 	back;Wait(7);tomaru;
 	kaminoker();
 	turn_up;Wait(50);tomaru;
 	hana();
 	turn_up;Wait(50);
 	tomaru;
 } 
 
 
**実際にロボットが書いた似顔絵 [#r44cf612]


-松本

#ref(NEC_0025.jpg)




-王

#ref(CA31.jpg)


**反省点 [#wf053b0a]
-松本
今回はパートナーで共同作業をすることが全くできなかった。それに提出も遅れてしまったので、次回はこの2点の改善に加えもっと細かく動けるロボットと、プログラミングを作りたい。


-王
プログラミングを組むのに、時間がかかり、時間通りにできず、紙もたくさん無駄にした。
**コメントをよろしくお願いします。 [#l9ac5130]
FI まだ終わってないみたいなので、また後で見ます。

TAKA プログラムに説明を入れてください
- 似顔絵は手が込んでおり、とても良いです。あとは、二人目のプログラムをきちんと貼りなおすことと、説明を入れることを直せばOKです -- [[FI]] &new{2011-01-08 (土) 05:22:33};
- プログラムに説明を入れればOKです -- [[TAKA]] &new{2011-01-21 (金) 16:27:21};

#comment


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