html5jロボット部

html5jロボット部の活動レポート、ロボットに関する情報発信(気づく限り)を行うブログです。

gortについて調べてみた

JavaScript for Robotics or Hardwareの初日担当ということで記事を書きます。

qiita.com

今回はGortというRobotOps(OpsはOperationの略で「運用」という意味)のコマンドラインツール についてちょっとだけ触れてみます。

なぜGortを知ったかというと、OSSのときに示LeapMotion DevelopersJPというコミュニティで作品を展示したのですが、
そこで代表のKatoさんがGortというのを使っていたので実際にどんなものかサイトをみてみました。

gort.io

とりあえずGetting Startedから

まずは、Getting Startedをやってみましょう。

ここにはこう書いています。


The Gort CLI provides many useful features on many hardware platforms, and has no other dependencies. You install Gort separately from any framework, which means you can use it to program Arduinos with the Firmata firmware also compatible with Cylon.js, Gobot, Artoo, & Johnny-Five. And more!

Scan
Bluetooth
Arduino
Particle
Digispark
Crazyflie
Klaatu
Help


Gort CLIは多数のハードウェアプラットフォームにほかへの依存性は無くいろんな機能を提供するものです。。 Cylon.jsやGobot、Artoo、Johnny-Fiveなどのフレームワーク、ライブラリフレームワークごとに個別にGortをインストールすることで、Firmata firmwareを使ったArduinoプログラムできるようになり、各々互換性があるらしいと。

ダウンロードなのですが、 今回はMacOS X版で行っています。

さてダウンロードしたら それを対象のファイルのあるディレクトリに入れます。 あとはハードウェアをつなぐだけ。

コマンドについて(VERSION:0.4.1)

以下のような感じでコマンドします。

$ gort [global options] command [optional arguments...]

コマンドについてはいかの種類があります。

コマンドの種類:
   scan         Scan for connected devices on Serial, USB, or Bluetooth ports
   bluetooth    Pair, connect, & unpair bluetooth devices.
   arduino      Install avrdude, and upload HEX files to your Arduino
   particle     Upload sketches to your Particle Photon
   digispark    Configure your Digispark microcontroller
   crazyflie    Configure your Crazyflie
   klaatu       barada nikto
   help, h      Shows a list of commands or help for one command

オプションはいかのような感じです。

GLOBAL OPTIONS:
   --help, -h           show help
   --version, -v        print the version

シリアルのデバイスとつなぐ場合は、

$ ./gort scan serial
/dev/cu.serial1         /dev/tty.serial1                                
/dev/cu.usbmodem14a31   /dev/tty.usbmodem14a31 

とコマンド打つと上記のように表示されます。

次はArduinoコマンドです。

$ gort arduino
使い方:
gort arduino install                                   # スケッチのアップロードを許可するAVRdude(Arduino)をインストール
gort arduino upload firmata [port]                    # ArduinoにFirmataのスケッチをアップロード。
gort arduino upload rapiro [port]                     # ArduinoにRapiroのスケッチをアップロード。
gort arduino upload [custom-firmware-filename] [port] #  Arduinoにカスタムスケッチをアップロード

アップロードする場合は以下のような感じです。

$ gort arduino upload firmata /dev/cu.usbmodem14a31                     
                                                                        
avrdude: AVR device initialized and ready to accept instructions        
                                                                        
Reading | ################################################## | 100% 0.00s                                                                       
                                                                        
avrdude: Device signature = 0x1e950f                                    
avrdude: reading input file "/var/folders/df/fj8pp4_53vv11zrjlddf6tb8000
0gn/T/138456267"                                                        
avrdude: writing flash (11452 bytes): 

Writing | ################################################## | 100% 1.84
s                                                                       
                                                                        
avrdude: 11452 bytes of flash written                                   
avrdude: verifying flash memory against /var/folders/df/fj8pp4_53vv11zrj
lddf6tb80000gn/T/138456267:                                             
avrdude: load data flash data from input file /var/folders/df/fj8pp4_53v
v11zrjlddf6tb80000gn/T/138456267:                                       
avrdude: input file /var/folders/df/fj8pp4_53vv11zrjlddf6tb80000gn/T/138
456267 contains 11452 bytes                                             
avrdude: reading on-chip flash data: 

Reading | ################################################## | 100% 1.47s                                                                       
                                                                        
avrdude: verifying ...                                                  
avrdude: 11452 bytes of flash verified                                  
                                                                        
avrdude done.  Thank you. 

という感じです。というわけで これからもう少し使うこんでみたいと思います。

以上ですが、 あれ!?JavaScriptじゃないの。。。という方、すみません、