emig summer school - robotics - slideseitidaten.fh-pforzheim.de/daten/mitarbeiter/johannsen/... ·...

50
ROBOTICS 1 ROBOTICS Summer School EMIG – Engineers Made in Germany Robotics – An Interactive Introduction to Programming Robots Prof. Dr. Peer Johannsen

Upload: others

Post on 10-Jul-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

ROBOTICS

1

ROBOTICS

Summer School EMIG – Engineers Made in Germany

Robotics – An Interactive Introduction to Programming Robots

Prof. Dr. Peer Johannsen

ROBOTICS

2

ROBOTICS

• Prof. Dr. rer. nat. Peer Johannsen– Computer Science and Software-Engineering– School of Engineering– Department of Information Technology– Dean of Studies, Computer Engineering Degree Program– [email protected]

• Teaching and Research Interests– Applied and Theoretical Computer Science– Formal Logic– Software-Development, Programming Languages– Algorithms and Data Structures– Robotics and Robot Programming

• Certified Roberta Teacher– Fraunhofer IAIS Initiative „Roberta – Lernen mit Robotern“

(“Roberta – Learning with Robots”)

Who I am

Contact:

Pforzheim University School of Engineering

Department of Information TechnologyRoom T1.4.29

[email protected]

ROBOTICS

3

ROBOTICS

• School of Engineering– Department of Information Technology

• Bachelor Degree Programs– Mechatronics, Computer Engineering,

Electrical Engineering, Medical Engineering• Master Degree Program

– Embedded Systems

ROBOTICS

4

Computer Science and Robotics Lab

• 10 NAO H25 V4 Educational Humanoid Robots• Academic Cooperation with Aldebaran Robotics Paris• KUKA Youbot Omni Directional Mobile Platform• 5 DOF Manipulator with 2 Finger Gripper• LEGO Mindstorms NXT Robotics Kits• 3D Virtual Environment Simulator

ROBOTICS

5

• Lab Activities– Introductory and advanced lectures– Programming languages and programming

techniques– Robotics and robot programming– Student projects– Research projects– Thesis projects–

• Objectives– Using robots to spike an interest in

Computer Science and programming– Giving students the possibility to work on a

real robot in the classroom

ROBOTICS

6

ROBOTICS

Summer School EMIG – Engineers Made in Germany

Robotics – An Interactive Introduction to Programming Robots

or:How to think like an

Engineer

ROBOTICS

7

ROBOTICS

Case Study – Mobile Robot Platform KUKA youBot

Case Study – Humanoid Robot NAO

Case Study – Cube Solving Robot

Algorithms

Flowcharts

ROBOTICS

8

1. Grappler2. Platform3. Mobile unit with

four omniwheels

1. Clamps2. Gripper unit3. Rotating joint4. Upper arm5. Middle arm6. Lower arm7. Control unit8. Turntable

• Autonomous mobile robot platform withmounted Gripper

• Educational robot system modeled on real automotive robots

ROBOTICS

9

• Mobile Platform• Maneuverable 0 – 360 degrees• 4 Mechanum-Wheels (Omniwheels)

– A turning wheel causes a propelling force at an angle of 45 degrees to its rotational axis

– Direction of platform is determined by the vectorialsum auf the propelling forces of all wheels

ROBOTICS

10

• Moving forward or backward

– All 4 wheels turn in the same direction at the same speed

ROBOTICS

11

• Moving sideways

– Neighboring wheels are counter-rotating– All wheels run at the same speed

ROBOTICS

12

• Turning in place

– Left wheels are counter-rotating to right wheels– All wheels run at the same speed

ROBOTICS

13

• Moving at arbitrary angles

– Two diagonal wheels are turning in the same direction, the other wheels are locked– Angle is determined by the ratio of all wheel speeds

ROBOTICS

14

ROBOTICS

Case Study – Mobile Robot Platform KUKA youBot

Case Study – Humanoid Robot NAO

Case Study – Cube Solving Robot

Algorithms

Flowcharts

ROBOTICS

15

The NAO H25 V4 Robot

• Programable Humanoid Robot• 25 degrees of freedom• Lots of sensors and communication devices• Linux operating system• Manufactured by Aldebaran Robotics, Paris

– Start of development in 2006– First release version in 2008– V4 is the newest 2012 version

• Designed as an educational robotics systems• Used world-wide at universities and in research projects• Specialized in Man-Machine interaction• Own league in the Robot Soccer World Cup

ROBOTICS

16

Infrared Sensors

HIFI Speakers

Microphone

Touch Sensors

HD Digital Cameras

Ultrasound Sensor

Graplers

Gyro

PressureSensors

Bumpers 25 electronicallydriven Joints

2 Intel Atom Processors

WLAN

ROBOTICS

17

ROBOTICS

Case Study – Mobile Robot Platform KUKA youBot

Case Study – Humanoid Robot NAO

Case Study – Cube Solving Robot

Algorithms

Flowcharts

ROBOTICS

18

• Ernö Rubik– Hungarian designer an architect– Professor of Arts and Design at the University of Budapest

• Rubik‘s Cube– Invented in 1974– Means to train students in 3-dimensional thinking– World-wide commercial success from 1980 on

• Overall number of possible configurations:– 43.252.003.274.489.856.000 (ca. 43 * 1018)

• Overall number of humans who despaired:– Significantly higher…

ROBOTICS

19

• mIQube - A cube solving robot• Used as introductory example in the Computer Science classes of the Bachelor of

Mechatronics degree program• Based on the „Tilted Twister“ robot by Hans Andersson

– Swedish software engineer– Construction plans available at www.tiltedtwister.com

ROBOTICS

20

Color Sensor

DistanceSensor

3 Electric Motors

Turntable

Microcontroller

Grappler

ROBOTICS

21

Scan upperSurface

Initialize Sensors

Please give me a Cube!

CubePresent?

yes

no

All 6 sidesscanned?

Turn Cube

no

ComputeSolution

(Sequence ofmoves)

All Moves done?

Execute Move

yes

Done!

no

yes

ROBOTICS

22

• 3-Phase Algorithm

ROBOTICS

23

• Sub-Procedures

ROBOTICS

24

Quelle: Tom Werneck, der Zaubercube, Heyne

ROBOTICS

25

• Algorithm implemented in C– Middle edge correction

void middle_edge_correction(int[] cube){

if (upper_layer_correct(cube)){

if ((cube[front][bottom][middle] == cube[front][middle][middle]) &&(cube[front][top][middle] == cube[front][middle][middle]) &&(cube[bottom][top][middle] == cube[right][middle][middle]))

{turn(bottom, left, 90);turn_column(right, down, 90);turn(bottom, right, 90);turn_column(right, up, 90);turn(bottom, right, 90);turn(front, right, 90);turn(bottom, left, 90);turn(front, left, 90);

}}

}

ROBOTICS

26

• God‘s Algorithm– For each configuration, compute a solution of minimum length

• God‘s Number– Maximum number of moves that is sufficient for solving the cube from

an arbitrary starting configuration

ROBOTICS

27

ROBOTICS

Case Study – Mobile Robot Platform KUKA youBot

Case Study – Humanoid Robot NAO

Case Study – Cube Solving Robot

Algorithms

Flowcharts

ROBOTICS

28

ROBOTICS

Algorithms

• Definition– An algorithm is an effective method for solving a specific problem, described by a finite set

of step-by-step operations to be performed.

• Essential Building Blocks of Algorithms– Sequences of Instructions

• Order is well defined– Branching Points

• Depending on the evaluation of a test condition different branches of instruction sequences aretakewn

– Conditional Loops• Conditional repetition of sequences of instructions

• Programming Language– A means to specify an algorithm in a way that it can be understood and executed by a

machine or computer

ROBOTICS

29

ROBOTICS

Abu truefar Mohammed Ibn Musa Al-Khwarizmi

• Ca. 780 – 850 n. Chr.• Born presumably in the Persian town Khwarizm (now in

Usbekistan)• Scientist at the courtyard of caliph Harun al-Raschid in

Bagdad• Adoption of the East Indian numeral system (arabic

numerals)• Introduction of decimal notation of numbers• First usage of zero as a digit• „as-sifr“ (die Leere) („zero“, „chiffre“, „Ziffer“)• Most famous book: „Al Kitab al-muhtasar fi hisab al-gabr

w-almuqabala“• „A short book on computing by completion and

balancing“• Methods to solve linear and quadratic equations• „Al-gabr“, „to add sth., to complete sth.“, „Algebra“

ROBOTICS

30

ROBOTICS

Variables in Algorithms

• Variable– symbolic storage (memory) of a specific value– has a name (unique Identifier)– has a current value (can change over time)

• Read / Write access– current value can be obtained (read)– current value can be replaced by a new value (write)

• Mathematics vs. Computer Science– in math x = x + 1 is an equation without a solution– in a program x = x + 1is an assignment (value update), meaning „the new value of x is

the sum of its old value and 1

x

8

ROBOTICS

31

ROBOTICS

Case Study – Mobile Robot Platform KUKA youBot

Case Study – Humanoid Robot NAO

Case Study – Cube Solving Robot

Algorithms

Flowcharts

ROBOTICS

32

ROBOTICS

Flowcharts

• Graphical representation of Algorithms– Oval

• Start, Stop– Arrow

• Sequence– Rectangle

• Basic Operation– Diamond

• Branching Point– Parallelogram / Rhomboid

• Input / Output– Rectangle with bars

• Subroutine Call

• PAP-Designer, Free (Windows) Software– Download: http://friedrich-folkmann.de/papdesigner/Hauptseite.html

ROBOTICS

33

ROBOTICS

• Basic Operations

• Sequence of Operations

Flowchart

Flowchart

Operation

Operation 1

Operation 3

Operation 2

ROBOTICS

34

ROBOTICS

Flowchart

• Conditional Branching Point with Boolean Condition

Test Condition

Operation A Operation B

false

true

ROBOTICS

35

ROBOTICS

Flowchart

• Conditional Branching with multiple Cases

Test Condition

Operation B

Operation A1

Case 1

Operation A2

Operation An

Operation A3

Case 2

Case 3

Case n

ROBOTICS

36

ROBOTICS

• Conditional Branching Boolean Branching is sufficient

Operation B

Test resultequals case 1? Operation A1

true

false

Test resultequals case 2? Operation A2

true

false

Test resultequals case 3? Operation A3

true

false

Test resultequals case n? Operation An

true

false

ROBOTICS

37

ROBOTICS

Flowchart

• While Loop

Flowchart

• Do Loop

?

Operations

false

true

?

Operations

false

true

ROBOTICS

38

ROBOTICS

• Loop with Counter

i = 10 ?

Operations

false

true

i = 1

i = i + 1

Flowchart

ROBOTICS

39

ROBOTICS

Flowchart

• Special Case: Endless Loop

Operations

ROBOTICS

40

ROBOTICS

Flowchart

• Call Subroutine

Flowchart

• Return from Subroutine

Name (Parameter)

ROBOTICS

41

ROBOTICS

• Example

ROBOTICS

42

ROBOTICS

C-Program Flowchart

• Basic Operationens (Instructions)

C-Program Flowchart

• Sequences

Instruction

Instruction 1

Instruction 3

Instruction 2

<C-Instruction>;

<C-Instruction 1>;<C-Instruction 2>;<C-Instruction 3>;

ROBOTICS

43

ROBOTICS

C-Program Flowchart

• Blocks

Instruction 1Instruction 2Instruction 3

{<C-Instruction 1>;<C-Instruction 2>;<C-Instruction 3>;

}

ROBOTICS

44

ROBOTICS

Flowchart

• Branching Points (Conditional Execution of Instructions)

TestCondition

Instruction A1Instruction A2

Instruction B1Instruction B2

false

true

C-Program

if (<Test>){<C-Instruction A1>;<C-Instruction A2>;...

}else{<C-Instruction B1>;<C-Instruction B2>;...

}

ROBOTICS

45

ROBOTICS

Flowchart

• Conditional Skipping of Instructions

TestCondition

Instruction A1Instruction A2

false

true

C-Program

if (<Test>){<C-Instruction A1>;<C-Instruction A2>;...

}

ROBOTICS

46

ROBOTICS

Flowchart

• Case Selection

TestWelcher Case

liegt vor?

Instruction B

Instruction A1

Case 1

Instruction A2

Instruction An

Instruction A3

Case 2

Case 3

Case n

C-Program

switch (<Test>){

case <Case 1>:<C-Instruction A1>;break;

case <Case 2>:<C-Instruction A2>;break;

case <Case 3>:<C-Instruction A3>;break;

...case <Case n>:

<C-Instruction An>;break;

default:<C-Instruction B>;

...}

ROBOTICS

47

ROBOTICS

• Case Selection Binary Branching Points are always sufficient

Instruction B

Test resultequals Case 1? Instruction A1

true

false

Test resultequals Case 2? Instruction A2

true

false

Test resultequals Case 3? Instruction A3

true

false

Test resultequals Case n? Instruction An

true

false

if (<TestTest = Case 1>){<C-Instruction A1>;

}else if (<TestTest = Case 2>){<C-Instruction A2>;

}else if (<TestTest = Case 3>){<C-Instruction A3>;

}else if (<...>){

...

}else{<C-Instruction B>;

}

ROBOTICS

48

ROBOTICS

Flowchart

• While Loop

Flowchart

• Do Loop

B?

Instruction A

false

true

B?

Instruction A

true

false

C-Program

C-Program

while (<Test B>){<C-Instruction A>;

}

do {<C-Instruction A>;

}while (<Test B>);

ROBOTICS

49

ROBOTICS

Flowchart

• Loop with Counter

C-Program

for (<Variable = Anfangswert>;<Variable ≠ Endwert>;<Variable weiterzählen>)

{<C-Instruction>;

}

i = 10 ?

Operations

false

true

i = 1

i = i + 1

ROBOTICS

50

ROBOTICS

Flowchart

• Subroutine Call (Function)

Flowchart

• Return from Subroutine

Prozedurname(Parameter)

C-Program

C-Program

main(){

ggT(44, 12);}

ggT(<Parameter A>, <Parameter B>){

<C-Instruction 1>;<C-Instruction 1>;... return;

}