![Page 1: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/1.jpg)
Barclays Mobile Robotics
Hour 1
Overview Session
![Page 2: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/2.jpg)
What is a Robot ?
• From Wikipedia• A robot is a mechanical or virtual artificial agent, usually an electro-
mechanical machine that is guided by a computer program or electronic circuitry. • Robots can be autonomous or semi-autonomous and range from
humanoids such as Honda's Advanced Step in Innovative Mobility (ASIMO) and TOSY's TOSY Ping Pong Playing Robot (TOPIO) to industrial robots, collectively programmed swarm robots, and even microscopic nano robots. • By mimicking a lifelike appearance or automating movements, a robot
may convey a sense of intelligence or thought of its own.
![Page 3: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/3.jpg)
What is a Robot ?
• From The Oxford English Dictionary• A machine capable of carrying out a complex series of actions
automatically, especially one programmable by a computer:
![Page 4: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/4.jpg)
What is a Robot
![Page 5: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/5.jpg)
What is a Robot – The Future ?
• What do you think a robot is ?• Could a robot replace your teacher ?
![Page 6: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/6.jpg)
Using Robotics To Learn Programming• At Barclays we have found that using small robots teaches
programming in a way that helps everyone understand the basics• We will be using these robots from 4tronix• 3 different challenges• Programming at the end of the session - create your own robot zoog
on the screen
![Page 7: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/7.jpg)
Icebreaker
• Ever wanted to be an app ? Now is your chance
![Page 8: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/8.jpg)
Introducing the Robot
• How the Robot works• How to upload code• How to change code
![Page 9: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/9.jpg)
Introducing the Robot – The IDE
• Where you write code• Save your sketch – the
app
![Page 10: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/10.jpg)
Introducing the Robot – The Sketch
• The sketch is the app• void loop()• Curly bracket {}• Semicolon ;• Functions – command• Arguments to function• Debug print
void loop(){ Serial.println(“In the loop"); forward(1000,255,255); halt(0); reverse(1000,255,255); halt(0); }
![Page 11: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/11.jpg)
Introducing the Robot
• Plug the robot into the laptop with the USB Cable• Load and run BRC_Move sketch• Make some changes to see what happens
![Page 12: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/12.jpg)
Barclays Mobile Robotics
Hour 2
Move Challenge 1
![Page 13: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/13.jpg)
Barclays Mobile Robotics
Hour 3
Shape Challenge 2
![Page 14: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/14.jpg)
Barclays Mobile Robotics
Hour 4
The Auto Challenge
![Page 15: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/15.jpg)
The if instruction
• You can use the if instruction also called a statement to execute code if something is true• Each sketch for the advanced challenge contains a working if – for
example
If ( leftObstacleSensor() == true ){
//Execute this block of code within the curly bracketshalt(0);reverse(0,255);
}
![Page 16: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/16.jpg)
Active Sensor - Ultrasonic
![Page 17: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/17.jpg)
Passive Sensor - Motion
• Motion Sensors can detect movement – they look for IR / Heat
![Page 18: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/18.jpg)
Passive Sensor – Light/IR
• Light Sensor can detect Light – Or Infra Red. Used a lot in Robotics for position and distance calculation
![Page 19: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/19.jpg)
Laser Range Finders
• Laser Range Finders send out a laser beam. The beam bounces off its target and the light comes back and the sensors can measure the time difference.• This is a very accurate measurement. Expensive to buy
![Page 20: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/20.jpg)
Barclays Mobile Robotics
Hour 5
The Line Follower
![Page 21: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/21.jpg)
Quick Revise on the if instruction
• You can use the if instruction also called a statement to execute code if something is true• Each sketch for the advanced challenge contains a working if – for
example
If ( leftObstacleSensor() == true ){
//Execute this block of code within the curly bracketshalt(0);reverse(0,255);
}
![Page 22: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/22.jpg)
Passive Sensor – Light/IR
• Light Sensor can detect Light – Or Infra Red. Used a lot in Robotics for position and distance calculation
![Page 23: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/23.jpg)
Barclays Mobile Robotics
Hour 6
Robots with Line Follower – Speed Challange
![Page 24: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/24.jpg)
Line Follower Track
• Line follower track – robot uses sensors to track line• Your code to keep robot on the
line and get it from start to finish
![Page 25: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/25.jpg)
Barclays Mobile Robotics
Hour 7
Programming With Processing
![Page 26: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/26.jpg)
Software and programming
• First Programmable Computer – 1944 – World War II helped to break Codes• Colossus• Mainframes • Desktop PC• Smartphones• Credit Cards• Google Glass• What Next ?
![Page 27: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/27.jpg)
Software and programming
• Computing Power has doubled every 18 months since 1980• A Cray XMP in 1990 cost 20 Million Dollars• Same computer in 2014 costs $200 dollars and is still 10 times more
powerful• If we had same comparisons with Aeroplanes – then you could by a
jumbo jet for the same cost as a pizza• Computing power in 20 years will be astonishing
![Page 28: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/28.jpg)
Software – Lets Code
![Page 29: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/29.jpg)
The Screen Grid
• Pixel
![Page 30: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/30.jpg)
0 1 2 3 4 5 6 7s
The Screen Grid• X Direction
![Page 31: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/31.jpg)
01234567
The Screen Grid• Y Direction
![Page 32: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/32.jpg)
0 1 2 3 4 51234
The Screen Grid• Coordinate• (X,Y)• 5,4
![Page 33: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/33.jpg)
0 1 2 3 4 5 6 712 ?3 ?4 ?567
The Screen Grid• Coordinate• (X,Y)• (6,3)• ????
![Page 34: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/34.jpg)
The Screen Grid• Coordinate System of
Screen could be 1280 x 1024• (X,Y)• (600,700)• ????
1280
1024
![Page 35: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/35.jpg)
Software – Lets Code
• Open Processing on Laptop• Get to first Screen• This is an IDE• This is where you will write code• Called a Sketch• Save the Sketch• Open an Example
![Page 36: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/36.jpg)
Software – Lets Code
• Example – Open the Bounce Sketch and have a look and run
![Page 37: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/37.jpg)
Software – Lets Code
• Have a look at the code – can you see how to make the ball get smaller or bigger ?• Faster or slower ?• Have a look and see what you
think – use the stop button and restart when you have made a change in the code
![Page 38: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/38.jpg)
Software – Lets Code
• Software programs are procedural • Real Life Demo! You are Sketch!• See how programs are procedures – one instruction then another • In a Loop
![Page 39: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/39.jpg)
Software – Lets Code
• Lets look at writing a few lines of code – create a new sketch and type these lines• size(500,500);• ellipse(100,100,50,50);• Now run
![Page 40: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/40.jpg)
Software – Lets Code
• Syntax is important – this sets the size of the window
size(500,500);
![Page 41: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/41.jpg)
Software – Lets Code
• Syntax is important – draw a circle
ellipse(100,100,50,50);
![Page 42: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/42.jpg)
Software – Lets Code
• We can change colour and size of lines.• Colour can be set by the fill
command• size(300,300);• fill(0);• ellipse(100,100,40,50);• fill(255);• ellipse(140,140,40,50);
![Page 43: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/43.jpg)
Software – Lets Code
• Some commands can set the colour• fill• If you use single number 0 is black
and 255 is white• If you use a triplet with RGB Red
Green Blue• 255,0,0 is red• fill(255,0,0);• ellipse(100,100,20,20);• Draws an circle that is red
![Page 44: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/44.jpg)
Software – Lets Code
• We can change colour and size of lines.• Colour can be set by the fill
command• size(300,300);• fill(0,255,0);• ellipse(100,100,40,50);• fill(255,0,255,0);• ellipse(140,140,40,50);
![Page 45: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/45.jpg)
Software – Lets Code
• Different commands • line(x1,y1,x2,y2);• stroke(34); ( Line Colour)• strokeWeight(3);• rect(x1,y1,l,w);• background(255);• Use these to make something!• http://processing.org/tutorials/
![Page 46: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/46.jpg)
// zoog
size(200,200);background(255);smooth();ellipseMode(CENTER);rectMode(CENTER);
// Bodystroke(0);fill(150);rect(100,100,20,100);
// Eyesfill(0); ellipse(81,70,16,32); ellipse(119,70,16,32);
// Legsstroke(0);line(90,150,80,160);line(110,150,120,160);
![Page 47: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/47.jpg)
Software – Lets Code
• Lets look ad Sketch Structure so we can build more advanced sketches
void setup(){}void draw(){}
![Page 48: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/48.jpg)
Software – Lets Codevoid setup() { // Set the size of the window size(200,200); }
// draw() loops continuously until you close the sketch window.void draw() { // Draw a white background background(255); // Set CENTER mode ellipseMode(CENTER); rectMode(CENTER);
// Draw Zoog's body stroke(0); fill(150); rect(100,100,20,100);
Type the first part into a new sketch
Save it!
![Page 49: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/49.jpg)
Software – Lets Code
// Draw Zoog's head stroke(0); fill(255); ellipse(100,70,60,60);
// Draw Zoog's eyes fill(0); ellipse(81,70,16,32); ellipse(119,70,16,32);
// Draw Zoog's legs stroke(0); line(90,150,80,160); line(110,150,120,160);}
Don’t Forget the Curly Bracket!
Then Run it – don’t forget to save it you
will need it
![Page 50: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/50.jpg)
Software – Lets Codevoid setup() { size(200,200);}
void draw() { background(255);
stroke(0); fill(175); rectMode(CENTER); rect(mouseX,mouseY,50,50); }
![Page 51: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/51.jpg)
Software – Lets Code
• Go back to zoog sketch and see if you can use mouseX and mouseY to move bits of zoog around• Hint – you can write mouse+10 like • ellipse(mouseX+10,mouseY,100,100);
![Page 52: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/52.jpg)
Software – Lets Code
• Variables allow us to use names rather than values. • We can modify the values when the
sketch is running• mouseX is a variable
![Page 53: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/53.jpg)
Software – Lets Code// Declare and initialize two integer variables at the top of the code.int circleX = 100;int circleY = 100;
void setup() { size(200,200); smooth();}
void draw() { background(255); stroke(0); fill(175); // Use the variables to specify the location of an ellipse. ellipse(circleX,circleY,50,50);}
Copy this code to a new sketch
Change the 100 values and see what
happens
![Page 54: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/54.jpg)
Software – Lets Code
• The if statement means you can test for a value and then only execute the code you need• Great for sensors on robots – if the sensor is on – then go forward
If ( test ) {
Execute this code(value);}
![Page 55: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/55.jpg)
Software – Lets Code
• The test can be greater than, less than, equal to AND OR and any combination you like:
If ( mouseX > circleX ) {
fill(255);ellipse(100,100,20,20);
}
![Page 56: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/56.jpg)
Software – Lets Code
• These are the most popular if tests
If ( mouseX > circleX ) - Great thanIf ( mouseX < circleX ) - Less thanIf ( mouseX == circleX ) - EqualsIf ( mouseX != circleX ) - Does NOT EqualsIf ( mouseX == circleX && mouseY == circleY) - ANDIf ( mouseX == circleX || mouseY == circleY) - OR
![Page 57: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/57.jpg)
Software – Lets Codefloat r = 150;float g = 0;float b = 0;
void setup() { size(200,200);}
void draw() {
background(r,g,b); stroke(255); line(width/2,0,width/2,height);
If (mouseX > width/2) { r = 255; } else { r = 0; }}
Type this in – what happens ????
Change things around
![Page 58: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/58.jpg)
END OF BARCLAYS MOBILE ROBOTICS COURSEWe hope you enjoyed it!
![Page 59: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/59.jpg)
ResourcesResource Slides – see notes
![Page 60: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/60.jpg)
1 - GOTO CENTRE OF ROOM
2 - MOVE FORWARD 2 STEPS
3 - TURN 90 DEGREES LEFT
4 - MOVE FORWARD 3 STEPS
![Page 61: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/61.jpg)
5 - IF CLEAR AHEAD MOVE 1 STEP
6 - IF NOT CLEAR TURN 180 DEGREES
7 - MOVE FORWARD 2 STEPS
8 - GO BACK TO FIRST INSTRUCTION
![Page 62: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/62.jpg)
Laptop Build
• 12 Laptops for 24 Pupils• Xubuntu• Arduino• Basic Shape• Basic Line Follower• Basic Follow• Basic Avoid
• Processing
![Page 63: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/63.jpg)
Arduino
• 12 Arduino Boards – not all lessons required• 12 Ultrasonic Sensors• 12 Bread boards• 24 LED / Resistors• Ultrasonic Sketch provided to get distance and light LED• Circuit Design and Build Instructions
![Page 64: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/64.jpg)
Processing
• Installed software• Prewritten Sketches
![Page 65: Barclays Mobile Robotics Hour 1 Overview Session](https://reader035.vdocuments.net/reader035/viewer/2022070410/56649f155503460f94c2a7ad/html5/thumbnails/65.jpg)
Final Challenges
• Shape follow – robots x 6 Cables and Wheels • Laptops 6• A3 / Flipcharts sheets for flow diagrams• 2 x A0 sheets with line follower. • 2 x Obstacles – could be TBC• For follower use a pupil!