2017a/Member/oshimin/Mission2
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[2017a/Member]]
*課題2&br;17T2037H 押見 洋土 [#m18339e3]
#br
#contents
#hr
**課題2 [#b4ac2d64]
[[課題2:http://yakushi.shinshu-u.ac.jp/robotics/?2017a...
#ref(2017a-mission2.png)
私の担当ルートは上図の番号順になる
**ロボット [#w9358c78]
今回の課題においてEV3の弱点は車輪幅の大きさであった。カ...
#ref(DSC_0528.JPG)
私達の班はその弱点を最小限にとどめるために、二つのモー...
#ref(DSC_0529.JPG)
#ref(DSC_0527.JPG)
**プログラム [#qe1ea633]
#!/usr/bin/python3
# -*- coding:utf-8 -*-
import ev3dev.ev3 as ev3
import time
mR=ev3.LargeMotor('outA')
mL=ev3.LargeMotor('outB')
t0=time.time()#一方向のカーブ時間
t1=time.time()#交差点判定の最低時間間隔を保つための時間
t2=time.time()#交差点での動作を司る時間
cs=ev3.ColorSensor('in3')
tsR=ev3.TouchSensor('in1')
tsL=ev3.TouchSensor('in2')
modeA = 0#カーブの方向を決定する型
modeB = 1#modeAに前回のカーブの方向をフィードバックする...
modeC = 0#交差点の番号をカウントする変数
変数の定義とモータ、センサの導入
mL.run_timed(time_sp=2000,duty_cycle_sp=50,speed_sp=100,...
mR.run_timed(time_sp=2000,duty_cycle_sp=50,speed_sp=100,...
time.sleep(2)
初めのスタート地点から無条件で前進する。このスタートを...
for loop in range(100000):
if tsR.value()==1 or tsL.value()==1:
break
for文で動作をループさせ、タッチセンサに反応があると緊急...
if cs.value()>55 and cs.value()<=60:
mL.run_forever(duty_cycle_sp=50,speed_sp=120)
mR.run_forever(duty_cycle_sp=50,speed_sp=120)
t0=time.time()
t2=time.time()
閾値を設定して、走行の角度を4パターン用意した。必要なと...
elif cs.value()>37 and cs.value()<=55:
カラーセンサ(37,55]の時
if modeC==3 or modeC==2:
mL.run_forever(duty_cycle_sp=50,speed_sp=60)
mR.run_forever(duty_cycle_sp=50,speed_sp=100)
t0=time.time()
t2=time.time()
チェックポイント??の時、左に小さく軌道を修正
elif modeC!=2 and modeC!=3:
mL.run_forever(duty_cycle_sp=50,speed_sp=100)
mR.run_forever(duty_cycle_sp=50,speed_sp=60)
t0=time.time()
t2=time.time()
??以外で、右に小さく軌道を修正
elif cs.value()>26 and cs.value()<=37:
カラーセンサ(26,37]の時
if modeC==3 or modeC==2:
mL.run_forever(duty_cycle_sp=50,speed_sp=0)
mR.run_forever(duty_cycle_sp=50,speed_sp=100)
t0=time.time()
t2=time.time()
チェックポイント??の時、左に旋回
elif modeC!=2 and modeC!=3:
mL.run_forever(duty_cycle_sp=50,speed_sp=100)
mR.run_forever(duty_cycle_sp=50,speed_sp=0)
t0=time.time()
t2=time.time()
??以外の時、右に旋回
elif cs.value()>14 and cs.value()<=26:
カラーセンサ(14,26]の時
if modeC==3 or modeC==2:
mL.run_forever(duty_cycle_sp=50,speed_sp=-70)
mR.run_forever(duty_cycle_sp=50,speed_sp=100)
t0=time.time()
t2=time.time()
チェックポイント??の時、左に急旋回
elif modeC!=2 and modeC!=3:
mL.run_forever(duty_cycle_sp=50,speed_sp=100)
mR.run_forever(duty_cycle_sp=50,speed_sp=-70)
t0=time.time()
t2=time.time()
??以外の時、右に急旋回
if time.time()-t0<=1.8:
modeA=modeB#フィードバック
if modeA==0 and cs.value()>60 and modeC!=3 and mo...
mL.run_forever(duty_cycle_sp=50,speed_sp=100)
mR.run_forever(duty_cycle_sp=50,speed_sp=25)#...
modeB=0
elif modeA==1 and cs.value()>60 and modeC!=3 and ...
mL.run_forever(duty_cycle_sp=50,speed_sp=25)
mR.run_forever(duty_cycle_sp=50,speed_sp=100)...
modeB=1
elif modeA==0 and cs.value()>60:
if modeC==2 or modeC==3:
mL.run_forever(duty_cycle_sp=50,speed_sp=...
mR.run_forever(duty_cycle_sp=50,speed_sp=...
modeB=0
白い地点にいるとき、一定時間内は黒線を探知するまで旋回...
elif cs.value()<=60 and cs.value()>17 and time.ti...
ev3.Sound.play('tyokkaku.wav')
mR.stop()
mL.stop()
time.sleep(1)
modeC+=1
t2=time.time()
設定した時間範囲内に2回黒線上に乗ったとき直角と判断する。
elif cs.value()>60:
if modeA==1:
mL.run_forever(duty_cycle_sp=50,speed_sp=100)
mR.run_forever(duty_cycle_sp=50,speed_sp=0)#...
modeB=0
elif modeA==0:
mL.run_forever(duty_cycle_sp=50,speed_sp=0)
mR.run_forever(duty_cycle_sp=50,speed_sp=100)...
modeB=1
t2=time.time()
白の旋回が一定時間を超えると逆向きに旋回する。こちらはm...
if cs.value()<=14 and time.time()-t1>3:
while time.time()-t2<=1:
mL.stop()
mR.stop()
modeC += 1
交差点と判断すると各チェックポイントでカウント用変数(m...
while time.time()-t2>1 and time.time()-t2<=3:
if modeC==1:#?
ev3.Sound.play('tziro.wav')
mL.run_timed(time_sp=210,duty_cycle_sp=50...
mR.run_timed(time_sp=210,duty_cycle_sp=50...
ポイント?の動作:右に直角に曲がる
elif modeC==2 or modeC==7:??
ev3.Sound.play('tziro.wav')
mL.run_timed(time_sp=400,duty_cycle_sp=50...
mR.run_timed(time_sp=400,duty_cycle_sp=50...
ポイント??の動作:左に黒線を横切ってサークルの左側へ移動
elif modeC==3 or modeC==8:??
ev3.Sound.play('tziro.wav')
mL.run_timed(time_sp=400,duty_cycle_sp=50...
mR.run_timed(time_sp=400,duty_cycle_sp=50...
while time.time()-t2>2 and cs.value()>70:
mL.run_forever(duty_cycle_sp=50,speed...
mR.run_forever(duty_cycle_sp=50,speed...
ポイント??の動作:ポイントの黒線を通り抜け、右側に方向...
elif modeC==4 or modeC==9:??
ev3.Sound.play('tziro.wav')
mL.run_timed(time_sp=800,duty_cycle_sp=50...
mR.run_timed(time_sp=800,duty_cycle_sp=50...
ポイント??の動作:ポイントの黒線を通り抜け、左側に直角...
elif modeC==5 or modeC==6 or modeC==10:??? ...
ev3.Sound.play('kousaten.wav')
mL.run_timed(time_sp=500,duty_cycle_sp=50...
mR.run_timed(time_sp=500,duty_cycle_sp=50...
t0=time.time()
t1=time.time()
ポイント???の動作:ポイントの黒線を通り抜ける。
#ref(route.png)
黒線上に乗った場合に交差点と判断する。閾値でだいぶ線か...
各々のポイントの動作をする。似た形状のポイントは動作も...
elif cs.value()<=14 and time.time()-t2<=3:
mL.run_forever(duty_cycle_sp=50,speed_sp=100)
mR.run_forever(duty_cycle_sp=50,speed_sp=-70)
t0=time.time()
t2=time.time()
チェックポイントと判断してから一定時間は次のチェックポ...
mR.stop()~
mL.stop()
**結果 [#da8c3c0d]
まだ一周できていない。番号で示すと?までは一度だけ走って...
**反省 [#v62a1365]
?までは行ったが、そこまでもかなり成功率は低く、調整だけ...
カウント変数を用いる際にwhile文を用いると一度に複数カウ...
pythonにおいて、for文ではシークエンスオブジェクト(オブ...
今回のfor文では黒線を感知し、run_timedで白面に出るまで...
for文の繰り返し数が100000と多いのは、run_forever等の動...
今回は次の課題があるためこれ以上の調整は難しいためここ...
問題の原因を明確にするためにもwhileからforへの変更など...
**考察 [#e7f98fd0]
前半のチェックポイント以外の部分をwhileで囲み、チェック...
終了行:
[[2017a/Member]]
*課題2&br;17T2037H 押見 洋土 [#m18339e3]
#br
#contents
#hr
**課題2 [#b4ac2d64]
[[課題2:http://yakushi.shinshu-u.ac.jp/robotics/?2017a...
#ref(2017a-mission2.png)
私の担当ルートは上図の番号順になる
**ロボット [#w9358c78]
今回の課題においてEV3の弱点は車輪幅の大きさであった。カ...
#ref(DSC_0528.JPG)
私達の班はその弱点を最小限にとどめるために、二つのモー...
#ref(DSC_0529.JPG)
#ref(DSC_0527.JPG)
**プログラム [#qe1ea633]
#!/usr/bin/python3
# -*- coding:utf-8 -*-
import ev3dev.ev3 as ev3
import time
mR=ev3.LargeMotor('outA')
mL=ev3.LargeMotor('outB')
t0=time.time()#一方向のカーブ時間
t1=time.time()#交差点判定の最低時間間隔を保つための時間
t2=time.time()#交差点での動作を司る時間
cs=ev3.ColorSensor('in3')
tsR=ev3.TouchSensor('in1')
tsL=ev3.TouchSensor('in2')
modeA = 0#カーブの方向を決定する型
modeB = 1#modeAに前回のカーブの方向をフィードバックする...
modeC = 0#交差点の番号をカウントする変数
変数の定義とモータ、センサの導入
mL.run_timed(time_sp=2000,duty_cycle_sp=50,speed_sp=100,...
mR.run_timed(time_sp=2000,duty_cycle_sp=50,speed_sp=100,...
time.sleep(2)
初めのスタート地点から無条件で前進する。このスタートを...
for loop in range(100000):
if tsR.value()==1 or tsL.value()==1:
break
for文で動作をループさせ、タッチセンサに反応があると緊急...
if cs.value()>55 and cs.value()<=60:
mL.run_forever(duty_cycle_sp=50,speed_sp=120)
mR.run_forever(duty_cycle_sp=50,speed_sp=120)
t0=time.time()
t2=time.time()
閾値を設定して、走行の角度を4パターン用意した。必要なと...
elif cs.value()>37 and cs.value()<=55:
カラーセンサ(37,55]の時
if modeC==3 or modeC==2:
mL.run_forever(duty_cycle_sp=50,speed_sp=60)
mR.run_forever(duty_cycle_sp=50,speed_sp=100)
t0=time.time()
t2=time.time()
チェックポイント??の時、左に小さく軌道を修正
elif modeC!=2 and modeC!=3:
mL.run_forever(duty_cycle_sp=50,speed_sp=100)
mR.run_forever(duty_cycle_sp=50,speed_sp=60)
t0=time.time()
t2=time.time()
??以外で、右に小さく軌道を修正
elif cs.value()>26 and cs.value()<=37:
カラーセンサ(26,37]の時
if modeC==3 or modeC==2:
mL.run_forever(duty_cycle_sp=50,speed_sp=0)
mR.run_forever(duty_cycle_sp=50,speed_sp=100)
t0=time.time()
t2=time.time()
チェックポイント??の時、左に旋回
elif modeC!=2 and modeC!=3:
mL.run_forever(duty_cycle_sp=50,speed_sp=100)
mR.run_forever(duty_cycle_sp=50,speed_sp=0)
t0=time.time()
t2=time.time()
??以外の時、右に旋回
elif cs.value()>14 and cs.value()<=26:
カラーセンサ(14,26]の時
if modeC==3 or modeC==2:
mL.run_forever(duty_cycle_sp=50,speed_sp=-70)
mR.run_forever(duty_cycle_sp=50,speed_sp=100)
t0=time.time()
t2=time.time()
チェックポイント??の時、左に急旋回
elif modeC!=2 and modeC!=3:
mL.run_forever(duty_cycle_sp=50,speed_sp=100)
mR.run_forever(duty_cycle_sp=50,speed_sp=-70)
t0=time.time()
t2=time.time()
??以外の時、右に急旋回
if time.time()-t0<=1.8:
modeA=modeB#フィードバック
if modeA==0 and cs.value()>60 and modeC!=3 and mo...
mL.run_forever(duty_cycle_sp=50,speed_sp=100)
mR.run_forever(duty_cycle_sp=50,speed_sp=25)#...
modeB=0
elif modeA==1 and cs.value()>60 and modeC!=3 and ...
mL.run_forever(duty_cycle_sp=50,speed_sp=25)
mR.run_forever(duty_cycle_sp=50,speed_sp=100)...
modeB=1
elif modeA==0 and cs.value()>60:
if modeC==2 or modeC==3:
mL.run_forever(duty_cycle_sp=50,speed_sp=...
mR.run_forever(duty_cycle_sp=50,speed_sp=...
modeB=0
白い地点にいるとき、一定時間内は黒線を探知するまで旋回...
elif cs.value()<=60 and cs.value()>17 and time.ti...
ev3.Sound.play('tyokkaku.wav')
mR.stop()
mL.stop()
time.sleep(1)
modeC+=1
t2=time.time()
設定した時間範囲内に2回黒線上に乗ったとき直角と判断する。
elif cs.value()>60:
if modeA==1:
mL.run_forever(duty_cycle_sp=50,speed_sp=100)
mR.run_forever(duty_cycle_sp=50,speed_sp=0)#...
modeB=0
elif modeA==0:
mL.run_forever(duty_cycle_sp=50,speed_sp=0)
mR.run_forever(duty_cycle_sp=50,speed_sp=100)...
modeB=1
t2=time.time()
白の旋回が一定時間を超えると逆向きに旋回する。こちらはm...
if cs.value()<=14 and time.time()-t1>3:
while time.time()-t2<=1:
mL.stop()
mR.stop()
modeC += 1
交差点と判断すると各チェックポイントでカウント用変数(m...
while time.time()-t2>1 and time.time()-t2<=3:
if modeC==1:#?
ev3.Sound.play('tziro.wav')
mL.run_timed(time_sp=210,duty_cycle_sp=50...
mR.run_timed(time_sp=210,duty_cycle_sp=50...
ポイント?の動作:右に直角に曲がる
elif modeC==2 or modeC==7:??
ev3.Sound.play('tziro.wav')
mL.run_timed(time_sp=400,duty_cycle_sp=50...
mR.run_timed(time_sp=400,duty_cycle_sp=50...
ポイント??の動作:左に黒線を横切ってサークルの左側へ移動
elif modeC==3 or modeC==8:??
ev3.Sound.play('tziro.wav')
mL.run_timed(time_sp=400,duty_cycle_sp=50...
mR.run_timed(time_sp=400,duty_cycle_sp=50...
while time.time()-t2>2 and cs.value()>70:
mL.run_forever(duty_cycle_sp=50,speed...
mR.run_forever(duty_cycle_sp=50,speed...
ポイント??の動作:ポイントの黒線を通り抜け、右側に方向...
elif modeC==4 or modeC==9:??
ev3.Sound.play('tziro.wav')
mL.run_timed(time_sp=800,duty_cycle_sp=50...
mR.run_timed(time_sp=800,duty_cycle_sp=50...
ポイント??の動作:ポイントの黒線を通り抜け、左側に直角...
elif modeC==5 or modeC==6 or modeC==10:??? ...
ev3.Sound.play('kousaten.wav')
mL.run_timed(time_sp=500,duty_cycle_sp=50...
mR.run_timed(time_sp=500,duty_cycle_sp=50...
t0=time.time()
t1=time.time()
ポイント???の動作:ポイントの黒線を通り抜ける。
#ref(route.png)
黒線上に乗った場合に交差点と判断する。閾値でだいぶ線か...
各々のポイントの動作をする。似た形状のポイントは動作も...
elif cs.value()<=14 and time.time()-t2<=3:
mL.run_forever(duty_cycle_sp=50,speed_sp=100)
mR.run_forever(duty_cycle_sp=50,speed_sp=-70)
t0=time.time()
t2=time.time()
チェックポイントと判断してから一定時間は次のチェックポ...
mR.stop()~
mL.stop()
**結果 [#da8c3c0d]
まだ一周できていない。番号で示すと?までは一度だけ走って...
**反省 [#v62a1365]
?までは行ったが、そこまでもかなり成功率は低く、調整だけ...
カウント変数を用いる際にwhile文を用いると一度に複数カウ...
pythonにおいて、for文ではシークエンスオブジェクト(オブ...
今回のfor文では黒線を感知し、run_timedで白面に出るまで...
for文の繰り返し数が100000と多いのは、run_forever等の動...
今回は次の課題があるためこれ以上の調整は難しいためここ...
問題の原因を明確にするためにもwhileからforへの変更など...
**考察 [#e7f98fd0]
前半のチェックポイント以外の部分をwhileで囲み、チェック...
ページ名: