Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic...

24
Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings

Transcript of Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic...

Page 1: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Robotics

Abstractions: Levels of language, world viewIntroduction to Lego Mindstorms

Build basic robotWrite & download program

Homework: postings

Page 2: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Levels of language

• Distinguish between – task: what you want to do– procedure: how you/your program directs

robot to do it

• Even procedure level distinguishes between– moving robot joints to get to an endpoint vs– moving robot joints

Page 3: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

World view

• What does the robot (you?) know about the work area?

• What are assumptions / constraints?

• Related to: how robust is it necessary to make the program / strategy

Page 4: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Levels of language: Task level

[Unconstrained]: block A somewhere on table, block B somewhere on table

PUT BLOCK A ON BLOCK B

[More constrained]: block A a specific place on the table, block B a specific place

PUT BLOCK A ON BLOCK B

Page 5: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Levels of language: Procedure

[Unconstrained]: block A somewhere on table, block B somewhere on tableLOCATE BLOCK ALOCATE BLOCK BPICK UP BLOCK AMOVE BLOCK A OVER TO CALCULATED POSITION ABOVE BMOVE BLOCK A TO CALCULATED POSITION ON B

[More constrained]: block A a specific place on the table, block B a specific placePICK UP BLOCK AMOVE BLOCK A OVER TO ABOVE BLOCK BMOVE BLOCK A DOWN UNTIL CONTACT

Page 6: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Levels of Language: joints, sensors, etc.

[Unconstrained]: block A somewhere on table, block B somewhere on tableInvoke vision system to locate block A and block B OR invoke search program ….Calculate joint positions for path to get to block ACalculate gripping positionSet joints so as to move block A over to calculated position above BSet joints so as to move/lower block A…possibly do move until touch

[More constrained]: block A a specific place on the table, block B a specific placeCalculate joint positions for path to get to block ACalculate gripping positionSet joints so as to move block A over to calculated position above BSet joints so as to move/lower block A…possibly do move until touch

Page 7: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Language, world view

• My choices of levels of language (task, procedure, robot joints) not the only ones

• Can pose higher levels and lower levels!

• These are general concepts to keep in mind. Will return to it.

Page 8: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Assembly is ….

• Challenging– Locating parts– Calculating trajectories– Allowing for variability– …

• Concept of ‘preserving orientation’

Page 9: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Exercise[s]

• Pick task and describe in task terms and in procedural terms– (Shoe tying)– Opening/unwrapping gift– Put on coat– Sharpening a pencil using automatic or

manual pencil sharpener– Cooking scrambled eggs– Building the basic Mindstorms robot!

ANSWER this on moodle!!!!

Page 10: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Lego parts

• Electronic– the Brick, motors, sensors, cables

• Structural– beams, other

• Connectors– some friction, some smooth

• Gears– transfer and/or change torque

• Miscellaneous– tires, Lego people, other

Page 11: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

NXT-G• Level of language is low.

– Note: considerable computation at motors and sensors

• You/your NXT-G program direct tribot actions directly: procedure, not task.

• Preview: – Task: hit the red ball– You will program: Procedure:

• move forward using certain motors until certain sensor indicates time to stop

• check light level to determine which ball• if red ball, move arm motor to swing

Page 12: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Lego Mindstorm NXT

• Create program using drag-and-drop of “blocks”– Iconic form of programming– Each icon/block has its own set of settings

(parameters) and (possibly) data links to be set

• Add comments. File/Save As (…save)• Then download program to NXT brick

– Compile and download. Any syntactic errors will be caught.

• Missing data link

– Failure if lack of space on the NXT brick• Will need to be conscious of space

Page 13: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Move block: initial setting

Motors B & C

75% power

1 Rotation

Brake after 1 rotation (not coast)

Page 14: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Important fact…

• You (the builder of the robot) must make sure that motor B and motor C do what you want. This depends on– Where/how you build– What port– External conditions

• The program doesn’t know anything. It just sends a signal to a port.

Page 15: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Direction now set to curve

Power at 25%

5 seconds

Coast after 5 seconds

Page 16: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

How…

• Do you get robot to travel specific distance?

• Use trial-and-error to set time or rotations

• Use feedback: keep computer connected to NXT and monitor rotations

• Next class!

Page 17: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Feedback information

Data links: input & output

Page 18: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Sound block

built-in sounds + capability for individual tones & sound files

WARNING: sound files are big.

Page 19: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Build

• Basic robot• NXT brick serves as main chassis• Carried around by wheels operated by 2

motors– Attached to appropriate ports

• Will add – Grabber– Sensors

• More programs

Page 20: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Today’s challenge

• Build basic robot

• Program to – Go forward, – Say “Have a nice day” ,– Turn around in a curve– Go back

Page 21: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Program has been saved on computer File/Save

Used comment writer to document action

Program consists of

Move block

Sound block

Move block (turning)

Move block

Page 22: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Comment

• Blocks may – Do something

• Make sound and wait for completion versus…• Turn motors for X rotations/degrees/seconds

– Start something• Start sound• Turn motors on unlimited (will do this next class)

– Actually, mostly blocks: Try to do something• Motors try to turn in rough terrain….

Page 23: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Go!

• Use directions in the kit.– Page 8 to 22 which is– Steps 1 to 17

• NOTE: step 14: putting in batteries has already been done• These kits use Lithium battery, which needs to be charged up.

– Turn on and try demo program– Write program and download

• DON’T MIX PARTS.– Be careful: especially with small pieces

• DON’T LOSE PARTS.• Need to be careful that cables are not in the way!• Make haste slowly.

Page 24: Robotics Abstractions: Levels of language, world view Introduction to Lego Mindstorms Build basic robot Write & download program Homework: postings.

Team work

• For this activity: everyone should be aware of all details.– Take turns.– Don’t assume you can’t do anything.

• For bigger projects, there may be specialists.