LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische...

19
fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund Germany

Transcript of LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische...

Page 1: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

fakultät für informatik

informatik 12technische universität

dortmund

LEGO Mindstorm EV3

Robots

Jian-Jia Chen

Informatik 12

TU Dortmund

Germany

Page 2: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 2 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

LEGO Mindstorm EV3 Robot

Page 3: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 3 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

LEGO Mindstorm EV3 Components

Page 4: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 4 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

LEGO Mindstorm EV3 Components

4 output ports

(A, B, C,D)

Ultra sonic

Sensor

Gyro sensor

Touch sensor

motor

Lego NXT

control unit

USB port for

software upload

4 input ports (1, 2, 3, 4)

for connecting sensors

Colour/Light sensor

motor

Page 5: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 5 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Basic robot for lab

2 independently

controlled

wheels

1 ultra sonic sensor

The basic robot will

be extended by

additional sensors

and actuators during

the labs

Page 6: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 6 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Data flow programming using LabVIEW

LabVIEW programs = Graphs

Specification of operations and dependences

Can be executed in arbitrary sequence as long as data

dependences are met

we don‘t care about the precise sequential code needed for

each of the nodes.

Example:

Page 7: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 7 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Virtual instruments

VI = virtual instrument

VIs represented in 2 windows:

Front panel: user interface

Block diagram: functionality of the system

Page 8: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 8 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

LabVIEW NXT tool kit

Front panel irrelevant, since robots

have no “user interface“

Mindstorm EV3 programming:

Functions menu contains all required

features for programming EV3

Use only these functions

The other features are not available for

the Mindstorms EV3

Page 9: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 9 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Input

Touch sensor

reads in touch sensor data from

designated input port

Mode: pressed/released/bumped/count

Output: yes/no

Sound sensor

reads in sound sensor data from

designated input port

Output: volume in dB/dBA

Menu: Mindstorm Robotics => I/O =>

Sensor => Touch/Sound/Light/Ultrasonic/Rotation

Page 10: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 10 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Input

Light sensor

reads in light sensor data from

designated input portOutput: intensity (0-100)

Ultra sonic sensor:

reads ultrasonic sensor data from

designated input portOutput: distance (cm)

Menu: Mindstorm Robotics => I/O =>

Sensor => Touch/Sound/Light/Ultrasonic/Rotation

Page 11: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 11 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Comparison

Menu: Mindstorm Robotics => Programming =>Comparison

Essentially self-explaining

Result: Boolean

Exception: Select

2 1 Mux

Page 12: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 12 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Case-dependent data flow( control elements present in LabView)

Consists of several sub diagrams, only

one of which can be active

Click on the arrows next to the case label

to display a particular sub diagram.

The case selector serves as the input to

the case structure;

Possible data types: Bool, String, Integer.

Action to be performed designated by

additional elements within the case

structure

Right click opens context menu

Menu: : Mindstorm Robotics => Programming => Structures =>

Case Structure

Move from Functions-Palette into editing area using drag & drop

Case selector

Case label

Page 13: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 13 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Data flow loops

Sub diagram will be repeated

until Boolean condition is true

Condition is represented by

conditional terminal

Right allows selecting whether

iterations will stop or continue if

condition is true

The iteration terminal includes

the number of the actually

executed iteration

Menu: Mindstorm Robotics => Programming => Structures =>

While Loop

Conditional terminalIteration terminal

Page 14: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 14 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Output

Move Motors

Moves DC motors with either constant power or

constant speed

InputsMotors specifies which motor controller and port each motor is connected to.

NXT establishes the flow of the program. Wire the NXToutput of the previous VI in the program to the NXT input of this VI.

Power/Speed specifies the amount of power, from -100 to 100, with which you want to move the motors or the speed, in seconds, at which you want to move the motors.

Menu Mindstorm Robotics => I/O=> Move

Motors

Page 15: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 15 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Outputs

NXT establishes the flow of the program. Wire the NXT output of this VI to the NXT input of the next VI in the program

Page 16: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 16 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Output

Stop Motors

Stops DC motors immediately or slows to a stop,

depending on Brake or Coast

Menu: Mindstorm Robotics => I/O=>

Stop Motors

InputsMotors specifies which motor controller and port each motor is connected to.NXT establishes the flow of the program.

OutputsNXT establishes the flow of the program. Wire the NXT output of this VI to the NXT input of the next VI in the program

Page 17: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 17 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Display

DisplayWrites text on the NXT brick's screen given a line number (Line 1 = top of the screen, Line 8 = bottom of the screen) displays only strings.16 characters on a line

Menu: Mindstorm Robotics =>

I/O=> Display

This example writes "Hello World!" in the upper left-hand corner on the NXT brick's screen.

Page 18: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 18 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Downloading software

Download either via USB or Bluetooth

Terminal window

Find NXT/EV3

File =>Target to EV3 => Deploy

Menu: Tools => NXT/EV3 Terminal

Page 19: LEGO Mindstorm EV3 Robots - ls12- …ls12- · fakultät für informatik informatik 12 technische universität dortmund LEGO Mindstorm EV3 Robots Jian-Jia Chen Informatik 12 TU Dortmund

- 19 -technische universität

dortmund

fakultät für

informatik

p. marwedel,

informatik 12

Small example

Goal: robot moves forward until ultrasonic sensor detects a

obstacle 20 cm away from it. Terminate loop if

Comparison returns true