Pico Wiki Driver, -Raspberry Pi Pico W によるBot Computing その1-

114 Views

March 12, 24

スライド概要

Pico Wiki Driver は Raspberry Pi Pico Wで使うことができる PukiWikiのAPIである。従来、Raspberry Pi で実装していた Bot Computing を Pico Wiki Driver を利用して, Raspberry Pi Pico W でも実装しようとしている。その現状について述べる。

シェア

またはPlayer版

埋め込む »CMSなどでJSが使えない場合

関連スライド

各ページのテキスト
1.

Pico Wiki Driver, -Raspberry Pi Pico W による Bot Computing その1山之上卓 福山大学 IPSJ IOT 64, No.26, 3/12, 2024

2.

目次 • • • • • • • • 何を作ったか? …Pico Bot 1. はじめに 2. Wiki Iot/Bot Computing 3. Pico Wiki Driver 4. Pico Bot 5. 開発中の障害 6. 関連研究 7. おわりに

3.

何を作ったか?…Pico Bot • Youtubeのビデオ… youtube, 「pico bot の紹介」で検索

4.

目次 • • • • • • • • 何を作ったか? …Pico Bot 1. はじめに 2. Wiki Iot/Bot Computing 3. Pico Wiki Driver 4. Pico Bot 5. 開発中の障害 6. 関連研究 7. おわりに

5.

1. はじめに 1/3 • IoT利用拡大 • Wiki IoT/Bot Computingを開発中 – Wiki を使って人間と機械が協調す るIoTシステム • Pico Bot – Wiki IoT/Bot ComputingのEdge システム(Wiki Bot) – Wiki Bot として安価な Raspberry Pi Pico W を利用

6.

1. はじめに 2/3 • Wiki IoT/Bot Computing – 一種の並列計算機構 – 演算装置群….Wiki Bot (Pico Bot) • IoTのエッジ端末, Raspberry Pi Pico を使って作成 – 記憶装置はインターネット上に分散配置されたWiki ページ • プログラムもデータもここに格納

7.

1.はじめに 3/3 • (予稿の方には書いていませんが) • IoT演習という授業を担当することになりました • 学生に、できれば一人1つのEdgeシステムを割り当てて演習させたい ->安価なEdge システム必要->Pico W • サーバ及びIoTシステムは教える側が慣れているものを使いたい (本来は標準的な物が良いはずなのだが) ->Wiki IoT/Bot Computing

8.

目次 • • • • • • • • 何を作ったか? …Pico Bot 1. はじめに 2. Wiki Iot/Bot Computing 3. Pico Wiki Driver 4. Pico Bot 5. 開発中の障害 6. 関連研究 7. おわりに

9.

2. Wiki Iot/Bot Computing (1/2)

10.

2. Wiki Iot/Bot Computing (2/2)

11.

目次 • • • • • • • • 何を作ったか? …Pico Bot 1. はじめに 2. Wiki Iot/Bot Computing 3. Pico Wiki Driver 4. Pico Bot 5. 開発中の障害 6. 関連研究 7. おわりに

12.

3. Pico Wiki Driver • Pico Bot – Pico WでPuki Wikiのページを読む – そこに書かれたスクリプトに従って動作 – 動作結果を元のPuki Wiki のページに書き戻す. • Pico Wiki Driver (class pico_wiki_driver) – Pico WでPuki Wiki のページの読み書きを行うAPI – Pico BotはPico Wiki Driver を利用

13.

3. Pico Wiki Driver • 独自にHTMLのパーサーを作成・利用…Seleniumはなさそう • class pico_wiki_driver – – – – def def def def __init__(self,url,page): … オブジェクトの作成 set_url(self,url): … アクセスするページのURLを設定 set_page(self,page): … アクセスするページを設定 get_url(self): … 現在オブジェクトがアクセスしているURLを取得

14.

3. Pico Wiki Driver – def get_html(self): … 現在アクセスしているページのHTMLを取得 – def get_wiki_page(self): …現在アクセスしてページの, Wiki の部分(HTML)を取得… CRUDのR – def replace_wiki_page(self,new_body): …現在アクセスしているページのWiki のソースを, 新しい Wiki のソース(new_body) で置き換える…. CRUDのUとD – def get_wiki_source(self): …現在アクセスしているページのWiki のソースを取得する…. CRUDのR

15.

目次 • • • • • • • • 何を作ったか? …Pico Bot 1. はじめに 2. Wiki Iot/Bot Computing 3. Pico Wiki Driver 4. Pico Bot 5. 開発中の障害 6. 関連研究 7. おわりに

16.

4. Pico Bot • Pico Bot – PukiWikiページに書かれたスクリプトを繰り返し実行 • スクリプトの中身 – 現URIと、そのサーバに障害が発生した場合のURI – 実行BotのID と、そのBotに障害が発生した場合のBot (未 実装) – Botがこのページを読む間隔 … command: set read_interval=<ミリ秒> – Botがこのページを実行する間隔 … command: set exec_interval=<ミリ秒> – Bot がこのページに実行結果を書く間隔 – 実行結果の最大行数 … command: set report_length=<行 数>

17.

4. Pico Bot • スクリプトの中身(続き) – MicroPython プログラムの記述 • command: py <プログラム名> … command: end <プログラム名> • この間の行に、py: <MicroPythonのプログラム の1行> – MicroPython プログラムの実行 • command: run <プログラム名> – スクリプトと実行結果の切れ目 • result:

18.

4. Pico Bot • スクリプトのPython プログラムの例 – Pico WのLEDを1.5秒間点灯し、消えるとき にPull Up している14番ピンのHigh, Low の 情報をresult: 以下の行に追加 command: py test py: from machine import Pin py: import time py: led=Pin(‘LED’, Pin.OUT) py: sw01 = Pin(14, Pin.IN, Pin.PULL_UP) …

19.

4. Pico Bot … py: led.on() py: time.sleep(1.5) py: v=sw01.value() py: led.off() py: line="device=sw, Date="+self.Pico_Time.get_now()+", v="+str(v) py: self.write_line(line) py: self.send_result() command: end test

20.

目次 • • • • • • • • 何を作ったか? …Pico Bot 1. はじめに 2. Wiki Iot/Bot Computing 3. Pico Wiki Driver 4. Pico Bot 5. 開発中の障害 6. 関連研究 7. おわりに

21.

5. 開発中の障害 • • • • • USBケーブルの接触不良 突然、MicroPico が動かなくなる … Conda のpath? メモリ不足 … GC等で対処 Value Error … try: … except: で対処 Execute 関数の実行環境 … local={‘self’:self} で対処

22.

目次 • • • • • • • • 何を作ったか? …Pico Bot 1. はじめに 2. Wiki Iot/Bot Computing 3. Pico Wiki Driver 4. Pico Bot 5. 開発中の障害 6. 関連研究 7. おわりに

23.

6. 関連研究 • Obniz – 実行プログラムの場所:自分のPC, Java Script vs. Pico Bot … PukiWiki のMicroPython など – 実行場所:自分のPC Vs. Pico Bot … Raspberry Pi Pico W • Mbed – Webでプログラミング、オブジェクトをPCにダウンロードして、書き 込み

24.

目次 • • • • • • • • 何を作ったか? …Pico Bot 1. はじめに 2. Wiki Iot/Bot Computing 3. Pico Wiki Driver 4. Pico Bot 5. 開発中の障害 6. 関連研究 7. おわりに

25.

6. おわりに (1/2) • Wiki IoT/Bot Computing のEdge システムにRaspberry Pi Pico Wを導入 • 今までのWiki IoT/Bot Computing とWikiのスクリプトの書式変 更 – Javaのconvention->Python のconvention – 独自プログラミング言語->MicroPython • Web Scraping

26.

6. おわりに (2/2) • 今後 – セキュリティ

27.

謝辞 • JSPS科研費基盤研究(C) JP21K11858 • 福山大学研究プロジェクト

28.

ちょっと宣伝 • 4/27-4/28, Maker Faire Kyoto 2024 @けいはんなオープンイノベーションセンター – 福山大学Makers, テレポートドレッサーなど出展 • 2024年度、前期・後期に、CGの世界的権威の西田友是先生 の講義。聴講制度で聴講可能。 – 申込期限は前期3/31、後期8/31