顯示具有 Wireless 標籤的文章。 顯示所有文章
顯示具有 Wireless 標籤的文章。 顯示所有文章

2011年3月31日 星期四

Using LabVIEW to acquire iPhone accelerometer data

Here’s another oldie but goodie … sometime last year I wrote code to acquire iPhone accelerometer data.  It’s the same concept as using LabVIEW to acquire Wii accelerometer data, but a little simpler since all you need is to get your PC connected to your iPhone via wifi.  You also need an app such as Accel Pro or iSensor, these apps can stream and broadcast your iPhone accelermeter data through UDP protocol.  I personally recommend Accel Pro over iSensor, the newest version of iSensor (1.01) has a bug that disable the Z axis values, but hey, you can’t really expect maintenance for a free app.  Although Accel Pro is $4.99, it’s got some more functionality than iSensor such as filtering and datalogging, so it’s worth taking a look.  However, Accel Pro doesn’t include compass data like iSensor, that’s a shame.

*Caution: Some apps may claim the ability to stream UDP data, but you might have to take a look at the UDP packet protocol for the app.  Just so happens that these 2 apps have almost the same protocol, for example:

ACC: 376153408593b159a8b5f0b75b29d642694394c0,173429.723,-0.091,-0.743,-0.634

So everything before the first comma is pretty much garbage, the second number appears to be a clock or a counter of some sort, and then comes the X, Y, Z, and compass data.

Be sure to switch broadcast mode on your iPhone app from “broadcast” to “unicast”, this seems to give the best performance.  You can download the LabVIEW 2009 code from below (right click on the link, then click “save as”.)  The code is just a variation of a LabVIEW UDP shipping example.  Enjoy!

[image[17].png]

http://groups.google.com.tw/group/riobotics/web/UDP%20Receiver%20for%20iSensor%20app.vi

-John

2010年6月14日 星期一

當iPhone遇上LabVIEW,會擦出什麼樣的火花?

大家都知道,現在風靡全球的iPhone已經是無微不至,無孔不入,幾乎世界上的每個應用都有個iPhone程式,但是iPhone拿來控制機器人? 這我好像還沒聽說過。既然LabVIEW的連接能力這麼大,我們就來看看LabVIEW能不能夠跟iPhone結合在一起,我們先想辦法來讀取到iPhone的三維加速規和電子羅盤好了。

曾經我有在App Store搜尋過關鍵字LabVIEW,但是唯一的程式是個叫做VIRemote的app,那時候在NI為了做一些實驗,我們就狠心的把這個爆貴的程式買了下來(你有聽過美金19.99的app嗎? 這些人還蠻囂張的。) 雖然它功能蠻豐富,除了擷取加速規以外(沒有compass),還可以當作一個你在PC上跑的LabVIEW程式的”遙控”,就像遠端桌面那種概念一樣,在iPhone裡就會看到一個比較小但是跟PC螢幕上的front panel一樣的程式。不過它跑起來還有點麻煩,因為還要另外再下載一些專屬它的VI才能用。

http://itunes.apple.com/tw/app/viremote/id344980935?mt=8

為了幫各位節省各位荷包裡辛苦存的Coco,小弟我終於找出了一個便宜(免費)又方便的方法來擷取iPhone的加速規和電子羅盤資料。首先,先下載一個叫做iSensor的app:

http://itunes.apple.com/tw/app/isensor/id353118286?mt=8

image

它能夠透過UDP的方式直接用字串把資料透過無線網路送出來。接下來,只要你的電腦和Iphone有在同個網域,就可以接收到iPhone的字串。設定上,記得要把Network打開,Unicast或Multicast都可以用(印象中好像Unicast會比較快一點,不過要指定PC的IP。) 你可以用LabVIEW內建的UDP Receiver範例程式,或者是直接下載我修改過後的版本來用,要注意UDP port要跟app那邊設一樣就好了。

image

http://groups.google.com.tw/group/riobotics/web/UDP%20Receiver%20for%20iSensor%20app.vi

(補充: 若進到link不能下載,請按右鍵再按另存新檔)

接下來大家就可以發揮想像力,看看可以用在哪種應用。。。 這似乎比多年前LabVIEW控制Wii搖桿的程式碼還要刺激!

-John

2009年6月5日 星期五

CompactRIO 機器人移動平臺

這是我們之前跟北科大車輛系蕭耀榮老師配合的合作計劃,CompactRIO 在此能夠整合無線網路,PDA遙控,甚至Wii遙桿來控制馬達平臺。來看看哦!