Presentation is loading. Please wait.

Presentation is loading. Please wait.

(Icommand & Processing). NXT The NXT is the brain of a MINDSTORMS® robot. It's an intelligent, computer- controlled LEGO® brick that lets a MINDSTORMS.

Similar presentations


Presentation on theme: "(Icommand & Processing). NXT The NXT is the brain of a MINDSTORMS® robot. It's an intelligent, computer- controlled LEGO® brick that lets a MINDSTORMS."— Presentation transcript:

1 (Icommand & Processing)

2 NXT The NXT is the brain of a MINDSTORMS® robot. It's an intelligent, computer- controlled LEGO® brick that lets a MINDSTORMS robot come alive and perform different operation.

3  serial profile 지원하는 usb Bluetooth Dongle 필요  NXT 끼리의 연결 ◦ 동시에 3 개의 다른 NXT 와 연결 가능 ◦ 1 개와의 통신만 가능 ◦ 파일 전송 가능  Bluetooth 연동되는 다른 기기와도 연결 가능 ◦ 핸드폰 ◦ 조이스틱

4 NXT Bluetooth Dongle Icommand & processind

5

6  Download and install Eclipse ◦ http://www.eclipse.org/downloads/ http://www.eclipse.org/downloads/

7  Download and install Processing ◦ http://www.processing.org/download/index.html http://www.processing.org/download/index.html

8 FILE –> NEW PROJECT and select “Java Project” Create a new project.

9 Enter your project name (for example, “TestProcessing”) and select “finish” Create a new project.

10 FILE –> IMPORT –> GENERAL –> FILE SYSTEM Click Next. Import the Processing libraries.

11 Click browse and find the “lib” directory inside the Processing application folder. “C:\processing – 0135\lib” Select the file “core.jar” inside the lib folder. Click “finish.” Import the Processing libraries.

12 BUILD PATH –> ADD TO BUILD PATH The “core.jar” file should now appear with a jar icon. Import the Processing libraries.

13 FILE –> NEW –> CLASS Create a class and write your code.

14 Enter in a class name “MyProcessingSketch” and click finish. Create a class and write your code.

15  After selecting finish, you’ll see the following code :  Import the core Processing library : ◦ “import processing.core.*;”  PApplet is the parent Processing class that allows us to have access to all the Processing goodies.

16  Write setup() and draw() ◦ and specify “public” for these Processing functions.

17 RUN –> RUN AS –> JAVA APPLET Run.

18 마우스가 클릭된 시작점과 끝점의 좌표를 이용한 line drawing JAVA APPLET

19 RUN –> RUN AS –> JAVA APPLICATION FullScreen. JAVA APPLICATION

20  Download  http://sourceforge.net/projects/nxtcommand/ http://sourceforge.net/projects/nxtcommand/

21 bluecove.jar 와 icommand.jar bluecove 는 Java API 로 지원되는 bluetooth library. icommand 는 bluecove 를 이용해서 NXT 에 표준 명령을 전달하기 위한 API 를 제공. Import the Icommand jar file

22 Bluetooth  Bluetooth Communication ◦ RXTX :  a native lib providing serial and parallel communication for the Java Development  http://www.rxtx.org/ http://www.rxtx.org/ ◦ BlueZ :  Official Linux Bluetooth protocol stack  http://www.bluez.org/download/ http://www.bluez.org/download/ ◦ Bluecove  a Java library for Bluetooth (JSR-82 implementation) that currently interfaces with the Mac OS X, WIDCOMM, BlueSoleil and Microsoft Bluetooth stack  http://www.bluecove.org/ http://www.bluecove.org/ ◦ ETC  http://www.ecst.csuchico.edu/~juliano/Research/Blog/nxt.html http://www.ecst.csuchico.edu/~juliano/Research/Blog/nxt.html

23 import icommand.nxt.Motor; import icommand.nxt.comm.NXTCommand; public class TestNXT { public static void main(String[] args) { NXTCommand.open(); // 블루투스 연결 초기화 Motor.B.setSpeed(100); // 속도 //Motor.B.forward(); Motor.B.rotate(360); // 한바퀴 Motor.B.stop(); // 정지 NXTCommand.close(); // 연결을 끊음 } }

24  실행하기 전에 properties 파일로 NXT 와의 연결 정보를 주어야 한다. ◦ C:\Document and Settings\icommand.properties  각자의 윈도우 사용 계정  파일을 만들던가 아님, 파일 없이 수행하면 에러가 나면서 자 동으로 파일이 생성된다. nxt.btaddress=00165300d860 nxtcomm.type=bluecove nxtcomm=COM5

25  Icommand ◦ C:\icommand-0.6\docs\api\index.html  압축 풀어놓은 경로의 docs 폴더  Processing ◦ http://www.processing.org/reference/index_ext.ht ml http://www.processing.org/reference/index_ext.ht ml  http://folog.egloos.com/1296765 http://folog.egloos.com/1296765  http://www.mostpixelsever.com/tutorial/ecli pse/ http://www.mostpixelsever.com/tutorial/ecli pse/

26  키보드 4, 8, 6, 2 버튼을 누르는 동안 nxt 가 움직 이게 해보자. ◦ 4 번 키 – 왼쪽으로 회전 ◦ 8 번 키 – 앞으로 전진 ◦ 6 번 키 – 오른쪽으로 회전 ◦ 2 번 키 – 뒤로 후진  Processing – 키보드 값 제어  Icommand – 모터 제어

27  processing – reference  Input -> Keyboard -> keyPressed ◦ Draw() 안과 밖의 차이점  안 : 계속 반복하면서 키보드의 눌림을 확인한다.  밖 : 계속 누르고 있어도 반복되지 않기 때문에 한번만 누른 것으로 된다.


Download ppt "(Icommand & Processing). NXT The NXT is the brain of a MINDSTORMS® robot. It's an intelligent, computer- controlled LEGO® brick that lets a MINDSTORMS."

Similar presentations


Ads by Google