Presentation is loading. Please wait.

Presentation is loading. Please wait.

What you asked me to teach…

Similar presentations


Presentation on theme: "What you asked me to teach…"— Presentation transcript:

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

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

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: motors(0,0) motors(1, 0.5) motors(1, -0.5) motors(.25, -.25)

8 Scribbler Movements Myro also provides built in functions for the most common movements: forward(speed) backward(speed) turnLeft(speed) turnRight(speed) Stop()

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

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

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… Open a new window: Type in the commands Save the file (add a .py) 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 in Learning Computing with Robots.


Download ppt "What you asked me to teach…"

Similar presentations


Ads by Google