27
(Icommand & Processing)

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

Embed Size (px)

DESCRIPTION

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

Citation preview

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

(Icommand & Processing)

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

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.

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

serial profile 지원하는 usb Bluetooth Dongle 필요

NXT 끼리의 연결◦ 동시에 3 개의 다른 NXT 와 연결 가능◦ 1 개와의 통신만 가능◦ 파일 전송 가능

Bluetooth 연동되는 다른 기기와도 연결 가능◦ 핸드폰◦ 조이스틱

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

NXT Bluetooth Dongle

Icommand & processind

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

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

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

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

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

FILE –> NEW PROJECT and select “Java Project”

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

Enter your project name (for example, “TestProcessing”) and select “finish”

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

FILE –> IMPORT –> GENERAL –> FILE SYSTEMClick Next.

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

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.”

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

BUILD PATH –> ADD TO BUILD PATHThe “core.jar” file should now appear with a jar icon.

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

FILE –> NEW –> CLASS

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

Enter in a class name “MyProcessingSketch” and click finish.

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

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.

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

Write setup() and draw()◦ and specify “public” for these Processing

functions.

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

RUN –> RUN AS –> JAVA APPLET

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

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

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

RUN –> RUN AS –> JAVA APPLICATIONFullScreen.

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

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

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

bluecove.jar 와 icommand.jarbluecove 는 Java API 로 지원되는 bluetooth library.

icommand 는 bluecove 를 이용해서 NXT 에 표준 명령을 전달하기 위한 API 를 제공 .

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

Bluetooth Bluetooth Communication

◦ RXTX : a native lib providing serial and parallel communication for the

Java Development http://www.rxtx.org/

◦ BlueZ : Official Linux Bluetooth protocol stack 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/

◦ ETC http://www.ecst.csuchico.edu/~juliano/Research/Blog/nxt.html

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

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(); // 연결을 끊음    }}

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

실행하기 전에 properties 파일로 NXT 와의 연결 정보를 주어야 한다 .◦ C:\Document and Settings\icommand.properties

각자의 윈도우 사용 계정 파일을 만들던가 아님 , 파일 없이 수행하면 에러가 나면서

자동으로 파일이 생성된다 .

nxt.btaddress=00165300d860nxtcomm.type=bluecovenxtcomm=COM5

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

Icommand◦ C:\icommand-0.6\docs\api\index.html

압축 풀어놓은 경로의 docs 폴더

Processing◦ http://www.processing.org/reference/

index_ext.html

http://folog.egloos.com/1296765 http://www.mostpixelsever.com/tutorial/

eclipse/

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

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

Processing – 키보드 값 제어 Icommand – 모터 제어

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

processing – reference

Input -> Keyboard -> keyPressed◦ Draw() 안과 밖의 차이점

안 : 계속 반복하면서 키보드의 눌림을 확인한다 . 밖 : 계속 누르고 있어도 반복되지 않기 때문에 한번만

누른것으로 된다 .