2013年8月17日土曜日

Android タブレットで倒立振子

突然ですが,諸般の事情で Android タブレット(Nexus 7)を制御器としたセグウェイっぽい自走式倒立振子を作りました.忘れないうちに製作の要点をメモしておきます.後日気が向いたときに詳細な記事を書くかもしれません.
Android タブレットは内蔵するジャイロセンサで角速度を計測し,モータに印加する制御入力の計算を行います.腕のように見えるのはレゴブロックで作られたバンパーで転倒時と机からの落下時に液晶画面を守ります.

IOIO-OTG と HUB-ee Wheel による製作容易なハードウェア

ハードウェア的に特に重要な部品は IOIO-OTG と HUB-ee Wheel です.


上の写真が IOIO-OTG で,これを介して Android からモータを駆動することができます. いわゆる ADK と似たような機能を持ちますが小型であることをはじめとして,様々な面で扱いやすいと思います.


上の写真は HUB-ee Wheel で,一見タイヤに見えますが中にモータ・モータドライバ・エンコーダを内蔵している便利部品です.エンコーダがかなり粗く(4逓倍で128カウント/回転)カウンタを内蔵していない点が少し残念ですが,レゴブロックと簡単に結合でき,ハードウェアの製作を飛躍的に簡単にしてくれます.

また,今回は適当な Nexus 7 専用ケースに両面テープで電池などの部品とレゴブロック2本を接着し,あとはレゴブロックを嵌め合わせることで HUB-ee Wheels を固定し,バンパーなどを構築しています.


制御器の連続時間実装

ソフトウェア,つまり制御理論の面でやや特殊なのは制御器の連続時間実装を行っている点です.というのも,Android は非リアルタイムOSで一定周期でのジャイロセンサによる計測や制御入力の更新が困難だからです.実際 IOIOLib Application Framework で何も考えずに制御ループを回したときの実行間隔は以下のようになります.


概ね 5 ms 程度の間隔でループが回っているものの 20 ms 以上の間隔になることもしばしばあり,離散時間システムとしての実装には多少無理があることがわかります.

倒立振子のモデリングと制御器の設計は特に特殊なところはありません.

今後の課題

現状では IOIO-OTG がエンコーダのカウントをサポートしておらず,Androidのソフトウェアによる計数を行っているので,高速に移動したり制御周期が長くなったりするとエンコーダの取りこぼしが発生してしまいます.

本来なら Android 端末を使った自走式倒立振子のメリットとして,カメラやネットワークを簡単に利用できることが挙げられるべきですが,この問題のために制御周期への影響が大きいと考えられるこれらの機能が使いにくいのが残念なところです.

本格的に遊ぶためにはエンコーダ用のカウンタ回路を IOIO-OTG の外部に設けるべきであると考えられます.


12 件のコメント:

Unknown さんのコメント...

Dear Ichiro Maruta,
After watching your video, I think it is very interesting. And I also want to build a similar Android-based 2-wheel robot using similar hardware like yours (except using a Samsung Galaxy S3). However, I am just an amateur hobbyist and not experienced in java or other computer language. I cannot find Hub-ee wheel java library but only Arduino library. Can you share with me your Hub-ee wheel library and the Quadrature Encoders (sensor) java library?

카지노사이트 さんのコメント...

According to legal documents, in all five cases the fathers did not exercise parental authority and the Belgian administration threatened the children’s Congolese families with reprisals if they refused to let them go.
https://www.yert200.com

카지노사이트 さんのコメント...

According to the lawyer, the Belgian state’s strategy aimed at preventing interracial unions and isolating métis children, known as the “children of shame,” to make sure they would not claim a link with Belgium later in their lives.
https://www.shine900.com

카지노사이트 さんのコメント...

After independence, the legal documents claim that the children were left abandoned by both the State and the Church, and that some of them were sexually molested by militia fighters. The women have requested
https://www.gain777.com

카지노사이트 さんのコメント...

“This is not for the money,” lawyer Michelle Hirsch said. “We want a law that can apply to all so that the Belgian State recognizes the crimes committed and the suffering endured by métis children.”
https://www.kkr789.com

카지노사이트 さんのコメント...

A Palestinian driver struck and moderately wounded a member of Israel's paramilitary Border Police at a major checkpoint north of Jerusalem overnight, the police said Thursday.
https://www.aace777.com

카지노사이트 さんのコメント...

Palestinians have carried out dozens of stabbing, shooting and vehicular attacks in recent years, but Palestinians and rights groups
https://www.qqueen700.com

카지노사이트 さんのコメント...

In a separate incident, a Jewish settler attacked an Israeli military officer and a soldier with pepper spray near a settlement outpost in the occupied West Bank on Wednesday, the latest in a series of recent attacks by settlers on Israeli security forces and Palestinians.
https://www.rcasinosite.com

카지노사이트 さんのコメント...

The military said the two soldiers received medical treatment at the scene, without elaborating. It declined to say whether anyone was arrested in the attack, referring questions to police, who did not immediately respond to a request for comment.
https://www.hotgame8.com

카지노사이트
さんのコメント...

Thanks , I’ve recently been searching for information about this subject for ages and yours is the greatest I’ve came upon so far. That's a good post. You did a great job in this article. Very readable and intelligent. You even made it easy to understand and read. You have a real writing talent. thank you. 카지노사이트

Here is my website. Please visit my site and leave your comments.

سكس مترجم 2023 さんのコメント...

world, hoped of getting a spot in Britney’s fashion internship. But it looks like Britney has another job for her, acting as her slutty sex toy! The beautiful woman gets up from her office chair and points Naomi down on her knees

سكس ساخن さんのコメント...

the world, hoped of getting a spot in Britney’s fashion internship. But it looks like Britney has another job for her, acting as her slutty sex toy! The beautiful woman gets up from her office chair and points Naomi down on her knees , thank you for this article
سكس ساخن