目次
*課題 [#c91852e8]
以下のURLを参照~

#contents
http://yakushi.shinshu-u.ac.jp/robotics/?2014a%2FMission1

&ref(2014a/Member/monodoll/Mission1);
* ロボット本体 [#xf595224]
あいうえお~
あいうえの~
** ドライブベース [#p178c258]
** アーム [#mee5f692]
*ロボット本体 [#hfe8e336]

*プログラム [#r6b0823e]
**ライントレース [#xd49af0d]

#define bri 55
#define s1 30
#define s2 25
#define onRL(x,y) OnFwd(OUT_A,x);OnFwd(OUT_C,y);
#define go onRL(s1,s1);
#define left1 onRL(s2,-s2);
#define left0 onRL(s2,0);
#define right0 onRL(0,s2);
#define right1 onRL(-s2,s2);
#define step 1
#define nMAX 300
#define short_break Off(OUT_AC); Wait(500);

task main()
{
  SetSensorLight(s3);
  int nonline = 0;
  int line =0;

  while (true) {

    while (nonline < nMAX) {
      if(line > 500) {
      short_break;
      left1;
      until(SENSOR_3 < 45);
      left1;
      until(SENSOR_3 > 55);
      sort_break;
      line = 0;
      nonline = 0;   }

      if(SENSOR_3 < bri -26){
      left1;
      nonline = nonline++;
      line = 0;             }

      else if (SENSOR_3 < bri -14){
      left0;
      nonline = nonline++;
      line = 0;                   }

      else {
        if(SENSOR_3 < bri -9){
        go;                  }
        else if(SENSOR_3 bri +5){
        right0;
        line = 0;               }
        else {
        right1;
        line++;}

      nonline =0;}

    Wait(step);
  }

  short_break;
  right1;
  Wait(nMAX*step);
  onRL(s1,s1);
  Wait(200);
  short_break;
  nonline = 0;
  line = 200;
  }
}


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