2015年12月29日 星期二

Raspberry Pi: Pi 2 with Pi Mapper update

since: 2015/12/29
update: 2016/02/18
reference:
1. PiMapper
2.
openFrameworks
3. Raspberry Pi: Pi 2 with Pi Mapper ---- 1/3
4. Raspberry Pi: Pi 2 with Pi Mapper ---- 2/3
5. Raspberry Pi: Pi 2 with Pi Mapper ---- 3/3


A. 更新版本:
     1. Raspberry Pi 2: Raspbian Jessie OS (Release date: 2015-11-21)
     2. openFrameworks: v0.9.0 for linuxarmv7

-----------------------------------------------------------------------------------------------

B. 安裝作業系統影像檔:
    1. 主要參考: Raspberry Pi: Pi 2 with Pi Mapper ---- 1/3

    2. 更新部分:
        a. 下載 Raspbian 映像檔, 版本為: Raspbian Jessie (Release date: 2015-11-21)

        b. 安裝好 Pi 後, 登入系統預設為桌面環境.

        c. 可以直接在 Pi 的組態設定中, 設定自動使用 pi 帳號登入文字模式.
           $ sudo raspi-config

           > 3 Boot Options

           > B2 Console Autologin Text console, automatically logged in as 'pi' user 

-----------------------------------------------------------------------------------------------

C. 安裝 openFrameworks
    1. 主要參考: Raspberry Pi: Pi 2 with Pi Mapper ---- 2/3

    2. 更新部分:
        a. download openFrameworks 0.9.0 linuxarmv7 distribution
$ cd
$ curl -O http://www.openframeworks.cc/versions/v0.9.0/of_v0.9.0_linuxarmv7l_release.tar.gz
$ mkdir openFrameworks
$ tar vxfz of_v0.9.0_linuxarmv7l_release.tar.gz -C openFrameworks --strip-components 1

        b. Install packages
$ cd /home/pi/openFrameworks/scripts/linux/debian
$ sudo ./install_dependencies.sh

        c. compile openFrameworks
$ make Release -j4 -C /home/pi/openFrameworks/libs/openFrameworksCompiled/project

        d. 不需要再額外增加 Raspberry Pi 2 makefiles
            說明: makefiles 預設已經是 Pi 2 的了, 連結也移除了


        e. 也不需要設定環境變數來告知編譯器使用 4 核與使用 armv7 來編譯

        f. 編譯範例與執行
$ cd /home/pi/openFrameworks/examples/graphics/polygonExample
$ make
$ make run

        g. 在 Pi 上新增專案方式: 
$ cp -R /home/pi/openFrameworks/examples/empty/emptyExample /home/pi/openFrameworks/apps/myApps/myRpiApp
$ cd /home/pi/openFrameworks/apps/myApps/myRpiApp
$ make
$ make run

-----------------------------------------------------------------------------------------------

D. 安裝 Pi Mapper
     1. 主要參考: Raspberry Pi: Pi 2 with Pi Mapper ---- 3/3

     2. 更新部分:
         a. 下載軟體:
$ cd ~/openFrameworks/addons
$ git clone https://github.com/kr15h/ofxPiMapper.git

         b. 安裝相依軟體:
$ git clone https://github.com/jvcleave/ofxOMXPlayer.git && git clone https://github.com/bakercp/ofxIO.git

         c. 編譯與執行:
$ cd ~/openFrameworks/addons/ofxPiMapper/example
$ make
$ make run

         d. create a symbolic link:
$ ln -s ~/openFrameworks/addons/ofxPiMapper ./PiMapper 
-----------------------------------------------------------------------------------------------

E. 在 Mac 上安裝 Pi Mapper
     1. 先安裝好 openframeworks 
         http://openframeworks.cc/download/

     2. 安裝 Pi Mapper:
         $ cd /Lanli/RD/project/openFrameworks/of_v0.9.0/addons        
         $ git clone https://github.com/jvcleave/ofxOMXPlayer.git

         $ git clone https://github.com/bakercp/ofxIO.git
         $ git clone https://github.com/kr15h/ofxPiMapper.git
  
-----------------------------------------------------------------------------------------------

F. 在 Mac 上建立你的 Pi Mapper 專案

     1. 執行 projectGenerator app
         .... of_v0.9.0/projectGenerator-osx/projectGenerator.app

     2. 設定內容:  
         Project name: myPiMapper
         Addons:
ofxPiMapper, ofxIO, ofxXmlSettings, ofxGui
          > Generate

         說明: ofxOMXPlayer 只會在 Pi 上用到, 在此處不需要加入.

     3. 新增成功後, 按下 "Close", 並關閉 projectGenerator app

     4. 完成後, 可以在 of_v0.9.0/apps/myApps/ 目錄下看到:  
         myPiMapper 專案資料夾, 底下有二個接著會用到的檔案:
         addons.make ---- 編譯時會 addons 的內容
         myPiMapper.xcodeproj ---- Xcode 專案檔

     5. 用文字編輯器開啟 addons.make 檔案, 於最後面增加 ofxOMXPlayer   
         說明: ofxOMXPlayer 為 Raspberry Pi 上 openFrameworks 的 video player

     6. 開啟 myPiMapper.xcodeproj 專案檔:
         a. 於 src 目錄下新增以下檔案:
             CustomSource.h, CustomSource.cpp
             CrossSource.h, CrossSource.cpp


         b. 將 of_v0.9.0/addons/ofxPiMapper/example/src 下的所有程式原始碼,
             覆蓋到 of_v0.9.0/apps/myApps/myPiMapper/src 下的所有程式原始碼.

     7. 拷貝 of_v0.9.0/addons/ofxPiMapper/example/bin/data 下的所有檔案與資料夾:
         defaultSurfaces.xml
         sources

         到
of_v0.9.0/apps/myApps/myPiMapper/bin/data
  
     8. 確認在 Mac 上編譯與執行成功後, 即可將整個 myPiMapper 資料夾上傳到 Pi 的
         ~/openFrameworks/apps/myApps 目錄下


     9. 建立 soft link 並編譯執行:
         $ cd
         $ ln -s ~/openFrameworks/apps/myApps/
myPiMapper ./myPiMapper
         $ cd myPiMapper
         $ make
         $ make run


-----------------------------------------------------------------------------------------------
G. openFrameworks 0.9.2
     1. 參考:
         a. http://openframeworks.cc/setup/raspberrypi/
         b. http://openframeworks.cc/setup/raspberrypi/raspberry-pi-getting-started/


     2. 說明:
         On the Raspberry 2 although it's architecture is arm7 raspbian only supports arm6 by now

     3. 安裝步驟:
$ curl -O http://openframeworks.cc/versions/v0.9.2/of_v0.9.2_linuxarmv6l_release.tar.gz
$ sudo chmod 777 of_v0.9.2_linuxarmv6l_release.tar.gz
$ mkdir of_v0.9.2
$ tar vxfz of_v0.9.2_linuxarmv6l_release.tar.gz -C of_v0.9.2 --strip-components 1
$ cd /home/pi/of_v0.9.2/scripts/linux/debian
$ sudo ./install_dependencies.sh

$ sudo ./install_codecs.sh
$ make Release -C /home/pi/of_v0.9.2/libs/openFrameworksCompiled/project

    4. Install PiMapper
$
cd ~/of_v0.9.2/addons
$ git clone https://github.com/kr15h/ofxPiMapper.git
$ git clone https://github.com/jvcleave/ofxOMXPlayer.git && git clone https://github.com/bakercp/ofxIO.git
$
git clone https://github.com/jvcleave/ofxRPiCameraVideoGrabber 
  (for example-camera used)


    5. 內建相機模組: fixed bug for
example-camera: check addons.make file
ofxPiMapper
ofxIO
ofxXmlSettings
ofxGui
ofxRPiCameraVideoGrabber
ofxOMXPlayer


    6. Reuse the example app by copying it to your apps directory

$ cd
$ cp -R of_v0.9.2/addons/ofxPiMapper/example of_v0.9.2/apps/myApps/
$ cd of_v0.9.2/apps/myApps
$ mv example PiMapper
$ cd
$ ln -s /home/pi/of_v0.9.2/apps/myApps/PiMapper ./PiMapper
$ cd PiMapper
$ make
$ make run

-----------------------------------------------------------------------------------------------
H. 備份與回復 Pi SD 卡資料:
     1. 參考:
         備份與回復樹莓派 Raspberry Pi 的 MicroSD 記憶卡 - G. T. Wang


     2. 備份:
         $
diskutil list ---> 查詢 SD 卡的磁碟代碼
            ex: /dev/disk1

         $ sudo dd if=/dev/rdisk1 of=~/Desktop/ofx_0.9.2_PiMapper.img bs=1m

     3. 回復:         

    $ sudo dd if=~/Desktop/ofx_0.9.2_PiMapper.img of=/dev/rdisk1 bs=1m

     4. Windows 方式:
         工具:
Win32 Disk Imager

沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。