Presentation is loading. Please wait.

Presentation is loading. Please wait.

LEGO Mindstorms NXT Programming. 다양한 프로그램 언어와 인터페 이스 가능 C 언어 JAVA LabVIEW Visual Basic MS Robot Studio Robolab NXT-G.

Similar presentations


Presentation on theme: "LEGO Mindstorms NXT Programming. 다양한 프로그램 언어와 인터페 이스 가능 C 언어 JAVA LabVIEW Visual Basic MS Robot Studio Robolab NXT-G."— Presentation transcript:

1 LEGO Mindstorms NXT Programming

2 다양한 프로그램 언어와 인터페 이스 가능 C 언어 JAVA LabVIEW Visual Basic MS Robot Studio Robolab NXT-G

3 About Bluetooth Bluetooth 는 근거리 통신 규약으로 약 10m 정도 의 거리까지 통신이 가능하다. 장비별 식별 코드를 사용하므로 장비간 인증, 데 이터 보안 등의 특징과 네트워크, 시리얼, 오디오 등 다양한 서비스를 제공한다. NXT 에서는 PC to NXT, NXT to NXT 의 통신을 지원한다.

4 About Bluetooth 한 번에 한 개의 Bluetooth 장치와 통신이 가능하다. 한 번에 총 3 개 까지의 장치와 연결상태를 유지할 수 있 다. 자체 블루투스 장치 탐색 및 이전 접속된 장치 기억 기능 이 있다. 다른 블루투스 장치에 검색되도록 하거나 혹은 검색을 피 하도록 숨길 수 있다. 블루투스 장치만 개별적으로 전원 on/off 할 수 있다.

5 센서 종류와 모터 충전식 리튬폴리머 배터리 터치 센서 사운드 센서 라이트 센서 초음파 센서 엔코더 내장형 서보 모터 그래픽 LCD 및 블루투스 무선통신 내장 USB 2.0 지원 기존 LEGO RCX 용 디바이스 호환

6 Programming Languages NXT-G code NXC (and NBC) Robot C pbLua Java and others

7 NXT-G code LEGO ’ s development environment Graphical programming Based on National Instruments ’ LabView Great for quick programs Wonderful for kids to use … but a real pain for old geezers like me who grew up with text programming languages

8 NXT-G –National Instruments 사에서 개발한 그래픽 인터페이스를 가진 프로그램툴 – 이것을 사용해 플로우차트를 그리듯이 프로그램할 수 있 으며, 모터를 제어하거나 딜 레이를 주거나 소리를 만드 는 등의 일을 할수 있음 – 센서입력과 타이머를 이용한 프로그램이 가능하다. –NXT-G 는 프로그램이 매우 쉽다.

9 LabVIEWROBOLAB = Robolab 은 LabVIEW 기반으로 만들어 짐 ( 같은 구성 ) 현재 많은 대학교에서 프로그램의 기초 실습과목으로 LEGO 의 소프트웨어인 Robolab 을 배우고 있음 LabVIEW 기반의 ROBOLAB

10 ROBOLAB –Tufts University 에서 개발된 것으 로 Lego RCX 를 위해 처음 개발 – 현재 보강된 프로그램이 NXT 에서 사용가능 – 또 다른 그래픽 환경을 가진 프로 그램툴이다. NXT-G 보다 더 정교 한 프로그램이 가능 – 그래픽 환경의 프로그램툴 –ROBOLAB 은 National Instruments 의 LabVIEW 를 사용 해 만들어 짐 LabVIEW 는 NXT-G 와 함께 ROBOLAB 의 기반 –integer 와 floating 변수를 사용한 계산이 가능하다

11 ROBOTC –NXT 에 C 언어를 사용 –Carnegie Mellon University 의 Robotics Academy 에서 만들어짐 – 다운로드 : www.robotc.netwww.robotc.net –ROBOTC 는 강력한 실시간 디버거를 가지고 있으며 프 로그램과 디버깅에 효과적인 프로그램툴 –Not free (free trial, $30 download)

12 NXC... NOT EXACTLY C NXC(Not eXactly C) –C 언어와 비슷한 NXT 를 위한 프로 그램툴 (Free) C 언어와 유사, C 언어는 아님 –RCX 에 NQC 가 있다면, NXT 에는 NXC 가 있음 –NXC 는 NXT-G 와 동일한 펌웨어를 사용 사용자가 NXC 로 프로그램하거나 NXT-G 의 그래픽 환경에서 프로그 램하는 것 모두 가능 –interger 타입의 변수가 사용가능하 며 floating 타입의 변수는 쓸 수 없 음 –LCD 에 글자를 쓰기 적절하지 않음 –NXC 와 ROBOTC 는 실시간 디버 거를 가진 유일한 프로그램툴임

13 C base Programming(NXC) NXT 용 C 기반 환경인 NXC 와 유사한 형태로 C 언어 기반의 프로그램을 구현하 기 위한 개발 환경. 좌측의 예제는 삼각함수를 이용한 기하 학적 디스플레이로, 일반 C 어플리케이션 의 알고리즘도 얼마든지 구현할 수 있음

14 PBLUA –Lua 는 교육분야에서 주목받 고 있는 텍스트 기반의 언어 –pbLua 는 NXT 를 위한 Lua 의 모든 특성을 갖춘 프로그 램 –pbLua 를 사용한 프로그램은 ROBOTC 와 NXC 와 유사

15 NXJ – 자바기반의 NXT 프로 그램툴 –JAVA 표준을 따르지만 Class 라이브러리는 훨 씬 작음

16 Other languages Java and several other languages are reportedly in the works as well MS Robotic Studio also supports the NXT –Download a small client program to NXT –Actual control is on a PC http://www.teamhassenplug.org/NXT/NXT Software.htmlhttp://www.teamhassenplug.org/NXT/NXT Software.html

17 기타 개발 환경 Microsoft Robot Studio : 마이크로소프트 (MS) 가 로봇산업 확대를 위 해 선보인 상용 로봇 운영체계, 윈도우 기반 소프트웨어 플랫폼으로서 실제 또는 가상의 로봇 프로그램을 비교적 간단히 수행하며 아이로봇의 룸바 (Roomba), 레고 마인드스톰즈 NXT(LEGO Mindstorms NXT) 등의 여러 로봇에서 호환된다. 영리 목적이 아닌 경우 무료 공개 JAVA on NXT : LeJOS 라는 이름으로 불리우는 LEGO 용 JAVA 는 JDK 1.5 이상과 LeJOS 프로그램을 통해 구현할 수 있다.

18 로보랩 S/W 의 구성과 기본활용

19 ROBOLAB 의 실행

20 펌웨어 다운로드 화살표를 클릭해서 자신의 NXT 이름이 나오면 V 표시 클릭

21 펌웨어 다운로드 펌웨어 다운로드 (PC 의 운영체제 설치의 개념 ) 약 20 여초 소요됨 펌웨어가 설치된 후 사용자는 자신 의 프로그램 입력 가능

22 로보랩 프로그래밍

23 로보랩 프로그램 창 패널 창 다이어그램 창 VI 함수 팔레트

24 RoboLab Work Space Remember to use Context Sensitive Help!

25 Programming Levels Pilot Level –Uses basic interface where programs are built using a click-and-choose interface Inventor Level –Provides a more open-ended, icon-based environment Investigator Level –Uses Pilot and Inventor programming to incorporate data collection into projects

26 Storyboarding Advantages of using a storyboard: –Makes it easier for younger students –Gives students a concrete plan to use at the computer –Checks individual understanding –Comes in handy when there is a lack of computers –Forces students to plan ahead and think objectively

27 Elements of a Program Beginning and end of program Motion Duration Speed Sensing the environment

28 Programming Always start an Inventor program with this command. (Change BeginNXT icon) Always end an Inventor program with this command.

29 Motion Choosing the correct icon: –Look at the arrows –Look at the port the motor is connected to on the RCX Motor A Forward Motor A Reverse Motor B Forward Motor B Reverse Motor C Forward Motor C Reverse

30 Duration The icons used to assign duration are called Wait Fors. Wait Fors: Wait for 1 second Wait for 2 seconds Wait for 4 seconds Wait for 6 seconds

31 Checkpoint

32

33 Stop Icons Because we want to stop both A and C motors, we will choose the stop A, B, C icon and place it at the end of our program. Stop AStop BStop CStop A, B, C

34 A Complete Program Congratulations! –You have now storyboarded your first robotics program.

35 From Storyboard to Computer Let’s go back to our computer.

36 Writing a new program Click on the Programmer button. You should then see the Inventor login screen.

37 ROBOLAB Environment Set up your screen in Inventor 4 so that it looks like the screen to the right.

38 ROBOLAB Environment There are two major pallets that contain most of the icons and commands you need to build a program. If you cannot see these pallets, you can find them under the Show drop down list. Tools Functions

39 WaitFor Palette

40 ROBOLAB Environment Click and drag the icons from the Function pallets to the blue screen space.

41 Tool Pallet 로보랩 사용법 ( 커서 ) VI 선택, 배치, 드래그 등에 사용 (Space Key 누르면 호출됨 ) VI 와 VI 간 와이어링에 사용 (Space Key 누르면 호출됨 ) 텍스트 입력에 사용 (Tab Key 누르면 호출됨 )

42 ROBOLAB Environment On the tools pallet, find the button that looks like a spool of wire.

43 Downloading the Program Click the white arrow on the ROBOLAB screen.

44 Testing the Program Put your NXT on the floor and press the Orange Button.

45 Troubleshooting Question: Why won’t this program work?

46 Troubleshooting Answer: The wiring is not correct. Always check for bad wires or missing wires. Bad WireMissing Wire

47 Troubleshooting Question: This program is supposed to turn on Motor A for four seconds, then turn off the motor. What’s wrong?

48 Troubleshooting Answer: There was no Stop Motor icon.

49 RoboLab Class Mission 1: To drive using a Timer “ With power level 3, Go straight for 2.5 seconds and stop ” 엔진출력 3 으로 2.5 초간 직진 후 멈춤 Broken arrow  Just right button click  Select (Error list) Ctrl+B  Delete Broken arrows

50 VI (Visible Item) Visible Item  Terminal – 분홍색 : 프로그램 흐름 – 청색 : 정수값 – 황색 : 실수값 – 갈색 : 컨테이너 ( 변수 ) – 녹색 : 입출력 포트

51 로보랩 사용법 (VI) 분홍 : 프로그램의 흐름 녹색 : 입 / 출력 포트 청색 : 수치값 ( 정수 ) 황색 : 수치값 ( 유리수 ) 갈색 : 컨테이너 ( 변수 )

52 Modifiers Palette

53 Modifiers – Select Command – Click in Diagram Window to Place Command – Wire Command Connections Forward Motor A Power Level 5

54 Context Help Just point an icon in question

55 Touch sensors

56 RoboLab Mission 2: Bumper Car Storyboard –Goes straight and stops when the bumper is hit Program –Turn motors B and C –Turn off motors B and C, when a touch sensor (Input 1) is pressed NXT 의 입력포트 (1,2,3) 를 선택한다 Wait for push Wait for Let’s Go NXT Click Fork (default: 10 번 ) NXT Touch and Release Fork

57 Answer

58 Example 모터 B, C 를 전진하다 터치센서가 눌리면 2 초간 후진하여 정지시킴

59 Light Sensors Low light level = low voltage level Bright light level = high voltage level The photo-transistor acts like a valve for electricity. The more light energy it senses, the more electricity flows. Photo-transistor

60 Light Sensors Light sensors are found under the “Wait For” icon in the Functions Palette Wait for light default: 55 이상 range: 1~100 Wait for dark default: 55 이하 range: 1~100 Wait for lighter (Default: 5% increase) Wait for darker (Default: 5% decrease) Light Sensor Fork Default: 55

61 RoboLab Mission 3: Board Edge Detection Robot must stop when it detects the edge of the white board Testing Light Sensors Use Black ‘ View ’ Button to read data from the light sensor –Measures the level of light as a number between 0% (total darkness) and 100% (very bright)

62 Answer Darker than 30 Brighter than 60

63 Sound Sensor Robot must stop when it detects the volume to in crease by the cutoff value –Wait for Louder –Default value : an increase of 30% –Wait for Quieter –Default value : an decrease of 30% –Wait for Loud –Default value : 70db 이상 –Wait for Quiet –Default value : 70db 이하 Sound Sensor Fork Default: 55 Range: 1(quiet)~100(loud)

64 Sound Sensor Example 직진을 하다 소리가 현재소리보다 40% 이 상 커지면 멈춤

65 Ultrasonic Sensor Robot must stop when it detects the distance that is less than a start value –Forward Distance x –Default: 20cm 이상 (1cm~200cm) –Reverse Distance x –Default: 20cm 이하 (1cm~200cm) – Distance Sensor Fork (default: 20cm)

66 Ultrasonic Sensor Example 직진을 하다 앞에 장애물이 30cm 이하가 되면 멈춤

67 RoboLab Mission 4: Making Turns Storyboard –Go straight for 1 seconds and turn right 90 degrees and go straight for 2 seconds and stop Program ?? –Is it easy to make 90 degree turns? –Mark the stop location and rerun –Does it stop at the same point? –Why not? –How do we make our robots go straight? –Very important for many missions

68 Tips: Making Right Turns stop Method 1: Left motorRight motor Method 2: Left motorRight motor

69 Making Turns Turn left: Spin left: (point turn) Face left: Left wheel Right wheel Left wheelRight wheel stop

70 Answer??

71 Ex 4-1: Go forward 1.5 seconds and come back by spinning left Spinning 180 degrees? Is it accurate?

72 Advanced Bumper Car NXT 포트 B, C 의 모터를 이용해 Bumper Car 를 전진 시키다. Bumper 에 의해 입력포 트 1 에 연결된 터치센서가 눌러지면 모터 B, C 의 방향을 1 초간 반전시켜 Bumper Car 가 후진하였다가 오른쪽으로 회전하게 한 다 음 다시 전진.

73 Reference –http://utah4h.org/htm/featured- programs/robotics/robolab-tutorial/http://utah4h.org/htm/featured- programs/robotics/robolab-tutorial/ –http://www.robofest.net/http://www.robofest.net/ –http://inside.catlin.edu/site/msrobotics/html/do wnloads.htmlhttp://inside.catlin.edu/site/msrobotics/html/do wnloads.html


Download ppt "LEGO Mindstorms NXT Programming. 다양한 프로그램 언어와 인터페 이스 가능 C 언어 JAVA LabVIEW Visual Basic MS Robot Studio Robolab NXT-G."

Similar presentations


Ads by Google