空飛ぶロボットのつくりかた

ロボットをつくるために必要な技術をまとめます。ロボットの未来についても考えたりします。

pythonでparrot mamboを飛ばしてみる

www.parrot.com

pymamboのセッテイング

https://github.com/amymcgovern/pymambo 👈 最高のライブラリ

の手順を実施

bluepyのインストール

sudo pip install bluepy

bluepyのissue

  1. /usr/local/lib/python3.5/dist-packages/bluepy

  2. make

Bluepy-helper not being built · Issue #158 · IanHarvey/bluepy · GitHub

So.. I did a fresh install of raspbian (debian stretch). I have installed python3-pip (pip3 version 9.0.1) install of bluepy (pip3 install bluepy) Then, when i run my program (that uses bluepy), i had trouble to access the device (a TI CC2650) So, i went in /usr/local/lib/python3.5/dist-packages/bluepy i run make some compilations are done then, i restart my program : it works well. Cheers, Sylvain

飛ばしてみる

$ python demoTricks 

f:id:robonchu:20171014174527p:plain

便利関数。これでだいたい飛ばせるYO。

    def fly_direct(self, roll, pitch, yaw, vertical_movement, duration):
        """
        Direct fly commands using PCMD.  Each argument ranges from -100 to 100.  Numbers outside that are clipped
        to that range.
        Note that the xml refers to gaz, which is apparently french for vertical movements:
        http://forum.developer.parrot.com/t/terminology-of-gaz/3146
        :param roll:
        :param pitch:
        :param yaw:
        :param vertical_movement:
        :return:
        """

        my_roll = self._ensure_fly_command_in_range(roll)
        my_pitch = self._ensure_fly_command_in_range(pitch)
        my_yaw = self._ensure_fly_command_in_range(yaw)
        my_vertical = self._ensure_fly_command_in_range(vertical_movement)
        command_tuple = self._get_command_tuple("Piloting", "PCMD")

        start_time = time.time()
        while (time.time() - start_time < duration):
            self.characteristic_send_counter['SEND_NO_ACK'] = (self.characteristic_send_counter['SEND_NO_ACK'] + 1) % 256
            packet = struct.pack("<BBBBBBBbbbbI", self.data_types['DATA_NO_ACK'],
                                 self.characteristic_send_counter['SEND_NO_ACK'],
                                 command_tuple[0], command_tuple[1], command_tuple[2], 0,
                                 1, my_roll, my_pitch, my_yaw, my_vertical, 0)

            self._safe_ble_write(characteristic=self.send_characteristics['SEND_NO_ACK'], packet=packet)
            #self.send_characteristics['SEND_NO_ACK'].write(packet)
notify = self.drone.waitForNotifications(0.1)

今後

楽しみ♪

PARROT MAMBO FPV | Parrot Store Official

参考:

ノンプログラマでもコピペでOK!JavaScriptを使ってDroneを飛ばそう | 飛んでるあいつ

いまアツいJavaScript!ゼロから始めるNode.js入門〜5分で環境構築編〜

GitHub - sandeepmistry/noble: A Node.js BLE (Bluetooth Low Energy) central module