1 / 58

曾吉弘

機器人新視界 NXC 與 NXT. 曾吉弘. 今天要談什麼. NXC -針對 LEGO 量身訂作的 C 語言 BricxCC -簡單好用的程式環境 讓機器人動起來 程式結構 感應器 馬達 進階 I/O 控制. 台北教育大學 玩具與遊戲設計 碩士 A Study of Developing the Technological Curiosity Inventory and Its Application to LEGO Hands-on Learning. 政治大學 資訊管理 學士 現於台灣大學 土木工程學系 康仕仲老師研究室

Download Presentation

曾吉弘

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 機器人新視界 NXC與NXT 曾吉弘

  2. 今天要談什麼 • NXC-針對LEGO量身訂作的C語言 • BricxCC-簡單好用的程式環境 • 讓機器人動起來 • 程式結構 • 感應器 • 馬達 • 進階I/O控制

  3. 台北教育大學 玩具與遊戲設計 碩士 A Study of Developing the Technological Curiosity Inventory and Its Application to LEGO Hands-on Learning. 政治大學 資訊管理 學士 現於台灣大學 土木工程學系 康仕仲老師研究室 專任機器人研究助理 Educational Robot tutorial and curriculum design Mobile Robot Robotarm 阿吉是誰

  4. CAVE做過什麼 • 2009出版 機器人新視界: NXC與NXT, 使用 C語言來控制LEGO NXT智慧型主機 • 2008成立CAVE 小小原始人 科學創意工坊, 致力推動高階機器人教育. 使用C, Java, LabVIEW等程式語言. • 2000~2007 貝登堡國際 資深機器人講師

  5. CAVE要做什麼 • 預計出版: Comprehensive LEGO Silver book:  LEGO機構口袋書 • 預計出版: Darkside of  LEGO NXT: LabVIEW killer apps. • 預計出版: Java being: leJOS on NXT • Work on I2C devices • 持續舉辦下午茶會

  6. 怎麼找到CAVE • Blog : CAVE + LEGO • Youtube : allelujahnissin • Picasa : allelujahnissin • facebook : allelujahnissin

  7. 台灣大學土木系電腦輔助工程組 教育用機器人 – LEGO NXT PC-based robot Robotarm 服務型機器人 康老師研究室

  8. LEGO MindStorms NXT

  9. NXT與RCX比較 NXT RCX • 上市時間 • 處理器 • 記憶體 • 傳輸方式 • 連接線 • I/O端子 • LCD • 電力方式 1999 Hitachi H8/3292 微控制器 8K ROM 32KRAM 紅外線傳輸 2 wire connector system 3個輸入端,3個輸出端 43個顯示單位 3號電池x 6 RCX 2.0可外接電源 2005 32位元ARM7微處理器,8位元輔助處理器 256 K快閃記憶體, 64 K RAM4 K快閃記憶體, 512 B RAM USB 2.0 (PC – NXT),藍芽 6 wire digital platform. 4個輸入端,3個輸出端 64 x 100像素的可程式化液晶顯示面板 3號電池x 6 充電鋰電池

  10. Mindstorms (NXT-G)

  11. Robolab

  12. RobotC

  13. NXJ (Java)

  14. LabVIEW

  15. NXC NXT-G 程式介面 適用年齡 取得方式 支援其他感應器 上手難易 功能性 除錯 文字式(BrixCC) 12歲以上 免費下載 http://bricxcc.sourceforge.net/ 有 有一定門檻 強大 常常需要 圖像式 8歲以上 依產品附上 有 簡單 中等 幾乎不用 NXC與NXT-G比較

  16. Programming interface Graphical Text based NXC RobotC Java Others: PbLua, php… • NXT-G • MicroSoft • Robotic Developer Studio • National Instruments • LabVIEW NXT toolkit

  17. Brief comparison MSRDS LabVIEW 功能 Java NXC NXT-G 學習難度

  18. Not eXactly C by John C. Hansen. Bricx Command Center (FREE!) C-based language Highly integrated with 3rd party I/O devices. NXC

  19. NXT介面介紹 USB 連接埠 輸出端(馬達) • 藍芽 • USB • 名稱 • 執行狀態圖示 • 電池 圖示 確定/開啟 發聲器 選擇 返回/關機 輸入端(感應器)

  20. Bricx Command Center

  21. Important settings and interfaces • Preferences • compiler, font, code completion. • Direct control • Watching the brick • Brick Joystick • NXT Explorer • NXT Screen

  22. First Robot http://ldd.lego.com/

  23. First Program

  24. F5 Compile F6 Download F7 Run

  25. Macro

  26. Repeat loop

  27. Nested loop

  28. Control Structure and Variable

  29. Variable

  30. while

  31. do while

  32. SENSORS

  33. Touch sensor • 語法:SetSensorTouch(S1); 33

  34. Sound sensor • 語法:SetSensorSound(S2); 35

  35. 36

  36. Ultrasonic sensor • 語法:SetSensorLowspeed(S4); 37

  37. 38

  38. Rotation sensor 語法:RotateMotor(OUT_Port , Speed , Degree); Give a try! x = 180?

  39. Light sensor • 語法:SetSensorLight(S3); 40

  40. 41

  41. 第六章大大小小的任務 • task start Precedes() mutex Acquire() 與Release() • subroutine sub FunctionName (data type varible) • inline function inline int B( 參數) { statements return x; }

  42. Macro 我們已經知道如何用define 來定義一個常數,現在我們還可以用define 來定義任何一個程式片段。

  43. 第七章 馬達面面觀 NXC的馬達指令可分為4大類: 1.unregulated 2.speed regulation 3.synchronized 4.tachometer-limited

  44. 怎麼停 大不同 Off(); Float(); = Coast(); 使用Off()時,NXT會在瞬間施加一個反向電流給馬達來達到煞車的效果。但如使用Float()的話,NXT只有停止對馬達的供電,但馬達本身因為旋轉而具有轉動慣量而會再轉動一點點才停下。

  45. 無控制模式(unregulated) OnFwd(); OnRev();

  46. 控制模式(regulation) OnFwdReg(輸出端,速度,控制模式); OnRevReg (輸出端,速度,控制模式);

  47. 控制模式的參數 OUT_REGMODE_IDLE OUT_REGMODE_SPEED OUT_REGMODE_SYNC

  48. 速度控制模式(speed regulation) OnFwdReg(OUT_C, 40, OUT_REGMODE_SPEED);

  49. 同步模式(synchronized) OnFwdReg(OUT_AC, 40, OUT_REGMODE_SYNC);

More Related