Code Monkey home page Code Monkey logo

manufacturingpractice2_a2's Introduction

機械工作実習2で制作するロボットのためのプログラム

プログラムの用途

岡山大学機械システム系学科システムコースの機械工作実習2の授業にて制作するロボットに使用するプログラム

動作環境

Raspberry PI

Raspberry PI 2 model B を使用する.(無線LANの使用も考えているため,Raspberry PI 3 model B も考慮する)

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 9.4 (stretch)
Release:	9.4
Codename:	stretch

Python3

$ python3 --version
Python 3.5.3

準備

ハードウェア

PinOut

詳細は pinout_manual を参照すること.

回路図

下の回路は,設計に問題があり,Raspberry Pi 本体を破壊する恐れがあるため,この設計のままで使用しないこと

schematic

ソフトウェア

スクリプトのダウンロードと追加パッケージのインストール

以下のコードをコピペする.

mkdir -p $HOME/Git && \
cd $HOME/Git && \
sudo apt install -y python3-pygame python3-gpiozero git && \
git clone https://github.com/sik103/ManufacturingPractice2_A2.git && \
sh ManufacturingPractice2_A2/install.sh

Arduino

Arduino promini にスケッチをアップロードする.スケッチは ManufacturingPractice2_A2_ard_sketch_GitHub を参照すること.

gdriveの設定と音源のダウンロード

著作権等の問題により,GitHubへの音源の保存が難しいと思われるため,音源はGoogle Driveに入れ,テスト環境と本番環境を同期化させる.詳細は gdrive_manual を参照すること.

その他のRaspberry PIの設定方法

詳細は rpi_manual を参照すること.

動作内容

  1. 光(火の元)を開始
  2. fire_and_conveyor
    1. スイッチ(センサー1)を押したら
      1. 音,光(サイレン)を開始:開始時間動作時間
        • 光:豆電球等で,クレーン車の上に
      2. ベルコン(モータ1)を開始:開始時間動作時間
        • モータドライバ
    2. クレーンが倒れる
      1. クレーンを倒す(モータ2): 開始時間動作時間
        • 糸を緊張させておいて,モータを若干回転させる
      2. ストッパーを外す(モータ3): 開始時間動作時間
        • サーボモータで制御
  3. explode_and_escape
    1. センサー(センサー2)でスタート
      1. 音(爆発音)と光(LED2) :開始時間動作時間
      2. ジャンプ(モータ4):開始時間動作時間
        • リレーを介して,ゴムを離す -> ガウス砲
  4. 一定時間後に光(火の元)を停止

太字: setting_time.json

注意事項

  • 開始時間はすべて センサー を基準にする.(動作部がボールの動きと一致しないため)

オプション

  • sh start.sh に使用する.
  • 詳細
    • --finishtime, -t: 動作時間を計測する.
    • --saveoutput, -s: 標準出力をファイルに記録する.
    • --waitforenter, -e: Raspberry PI のセンサーの代わりにキーボードの Enter キーを使用する.
    • --no-loop, -nl: スクリプトを一回だけ動作させる.
  • 使用例
    • $ sh start.sh -t -e: 動作時間を測定し,実行時に出力された標準出力をファイルに記録する.

その他のマニュアル

  • モータドライバについて:tb6612fng_manual を参照すること
  • Debug 時などに使えるUbuntuのコマンドなど:ubuntu_manualを参照すること

参考文献

Raspberry Piで音楽(wav/mp3)ファイルを再生する方法 python編

google drive を コマンドから使うgdrive が早くて便利

RaspberryPi 3 コマンドで音量を上げる(ラジオをテレビで再生→音量不足→コマンドで音量UP)

音源

効果音ラボ

manufacturingpractice2_a2's People

Contributors

muneue-suwa avatar

manufacturingpractice2_a2's Issues

underrun occurred

ボタン2のあとに

$ python3 main.py
...
ALSA lib pcm.c:8306:(snd_pcm_recover) underrun occurred
...

上記のようなメッセージが表示される.

start.sh bug

$ cat mp2_cron_20181205_073323.log 
  File "/home/pi/Git/ManufacturingPractice2_A2/start.sh", line 3
    CMDNAME=`basename $0`
            ^
SyntaxError: invalid syntax

loop などについて

  • 再帰的に main.py を呼び出す
  • recovery.py の呼び出し
  • status_led の点灯(待機中)、点滅(動作中)
  • -noloop True, -nl True (arguments) と条件文で変更

PinFig の更新

基板の作成にともなうPinFigのアップデート
設定ファイルと,shutdown_button.py の中身

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.