障害物回避走行プログラム

Files at this revision

API Documentation at this revision

Comitter:
tomotsugu
Date:
Wed Jul 22 03:30:03 2020 +0000
Parent:
4:3de68a2ed879
Child:
6:5c1ffbe1635b
Commit message:
avoidance

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jul 22 03:26:41 2020 +0000
+++ b/main.cpp	Wed Jul 22 03:30:03 2020 +0000
@@ -47,13 +47,13 @@
     while(1){
         Thread::signal_wait(0x1);       // シグナル待ち
         SC = watch();
-        if(SC < limit){                 // 前方20cm以内に障害物がある場合
+        if(SC < limit){                 // 正面20cm以内に障害物がある場合
             run = STOP;                 // 停止
         }
         servo.pulsewidth_us(1925);      // サーボを左に40度回転
         thread_sleep_for(25);           // 250ms待つ
         SLD = watch();
-        if(SLD < limit){                // 左斜め20cm以内に障害物がある場合
+        if(SLD < limit){                // 左前20cm以内に障害物がある場合
             run = STOP;                 // 停止
         }
         servo.pulsewidth_us(2400);      // サーボを左に90度回転
@@ -67,7 +67,7 @@
         servo.pulsewidth_us(925);       // サーボを右に40度回転
         thread_sleep_for(25);           // 250ms待つ
         SRD = watch();
-        if(SRD < limit){                // 右斜め20cm以内に障害物がある場合
+        if(SRD < limit){                // 右前20cm以内に障害物がある場合
             run = STOP;                 // 停止
         }
         servo.pulsewidth_us(500);       // サーボを右に90度回転