Presentation is loading. Please wait.

Presentation is loading. Please wait.

How to link the robot and the computer (Bluetooth) How to turn on and off How to connect the adaptor Fluke card connection Sec 9-2 - Getting Started How.

Similar presentations


Presentation on theme: "How to link the robot and the computer (Bluetooth) How to turn on and off How to connect the adaptor Fluke card connection Sec 9-2 - Getting Started How."— Presentation transcript:

1 How to link the robot and the computer (Bluetooth) How to turn on and off How to connect the adaptor Fluke card connection Sec 9-2 - Getting Started How to make the robot move How to turn How to stop Control the speed Sec 9-3 - Scribbler movements How to create functions and methods How to program in Python Sec 9-4 - Simple Functions (names) How to create functions and methods How to program in Python Sec 9-5 - Functions with Parameters and Return Values How to program in Python Sec 9-6 - Creating and Using Modules How to program in Python Sec 9-7 - Simple Python Loops How to use the sensors Sec 9-8 - Variables What you asked me to teach…

2 How to take a picture Sec 9-9 - Taking Pictures How to know when you lost target How to find colors How to sense when you hit something Sec 9-10 - Making Decisions in Python How to find colors Sec 9-11 - Image Processing and Perception What you asked me to teach…

3 Scribbler Movements Sec 9-3 Web Design

4 Objectives The student will: Understand the basic movement commands for the Scribbler Know how to create and execute a series of commands

5 Scribbler Movements If you look at the scribbler from the bottom you will notice that it has 3 wheels. – The small wheel is for support only – The large wheels are motorized. Each wheel has it own motor. – You can control each motor individually. motors( Left, Right) Left and Right are in ranges from -1.0 to 1.0 Negative numbers turn the motor backward 1.0 is the max speed of the motor. Think of the numbers as % of total speed

6 Scribbler Movements - motors() Examples: – motors(1.0, 1.0) – move forward – motors(-1.0, -1.0) - move backward – motors(1.0, 0) – tight circle to the right – motors(1.0, -1.0) – spin (turn) to the right Note the action will continue until another command (i.e. stop() ) is issued.

7 Scribbler Movements - motors() What do think will happen with the following commands: 1.motors(0,0) 2.motors(1, 0.5) 3.motors(1, -0.5) 4.motors(.25, -.25)

8 Scribbler Movements Myro also provides built in functions for the most common movements: 1.forward(speed) 2.backward(speed) 3.turnLeft(speed) 4.turnRight(speed) 5.Stop()

9 Scribbler Movements Another version of the commands accepts a second argument (parameter) which is the amount of time in seconds. 1.forward(SPEED, SECONDS) 2.backward(SPEED, SECONDS) 3.turnLeft(SPEED, SECONDS) 4.turnRight(SPEED, SECONDS)

10 Draw a Square forward(1, 1) turnLeft(1,.28) forward(1, 1) turnLeft(1,.28) forward(1, 1) turnLeft(1,.28) forward(1, 1) turnLeft(1,.28) There is no way to tell the robot to move 5 feet or to turn right 90 o For Arty.28 works the best for the turn but that might not be right for your robot.

11 Translate and Rotate translate(speed) moves the robot forward or back. rotate(speed) turns the robot left. move(TRANSLATE_SPEED, ROTATE_SPEED) will perform a translate and rotate at the same time. The result will be a circle.

12 Executing a Series of Commands If you would like to type a series of commands and have them executed all at once then you can… 1.Open a new window: 2.Type in the commands 3.Save the file (add a.py) 4.Run the module:

13 IDLE Tips – Command History You can repeat a previous command by using IDLE's command history feature: – ALT‐p retrieves previous command – ALT‐n retrieves next – You can also click your cursor on any previous command and press ALT‐ENTER to repeat that command.

14 Summary Many different ways to move your robot. – motors(), forward(), backward(), turnLeft(), turnRight(), move(), stop(), etc. You can type in a series of commands, save them and then have the IDLE shell execute those commands.

15 First Assignment Experiment with your robot to make a octogon: Make the side a movement of 0.5 seconds (keep the octagon small). The robot should end up roughly where it started and facing the same direction as when it started. Once you have the commands that make a octagon, show it to me. Read pages 21-26 in Learning Computing with Robots.


Download ppt "How to link the robot and the computer (Bluetooth) How to turn on and off How to connect the adaptor Fluke card connection Sec 9-2 - Getting Started How."

Similar presentations


Ads by Google