130 likes | 254 Views
Scribbler Movements. Sec 9-3 Web Design. Objectives. The student will: Understand the basic movement commands for the Scribbler Know how to create and execute a series of commands. Scribbler Movements. If you look at the scribbler from the bottom you will notice that it has 3 wheels.
E N D
Scribbler Movements Sec 9-3 Web Design
Objectives The student will: • Understand the basic movement commands for the Scribbler • Know how to create and execute a series of commands
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
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.
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)
Scribbler Movements • Myro also provides built in functions for the most common movements: • forward(speed) • backward(speed) • turnLeft(speed) • turnRight(speed) • Stop()
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)
Draw a Square • There is no way to tell the robot to move 5 feet or to turn right 90o • For Bucky .29 works the best for the turn but that might not be right for your robot. forward(1, 1) turnLeft(1, .29) forward(1, 1) turnLeft(1, .29) forward(1, 1) turnLeft(1, .29) forward(1, 1) turnLeft(1, .29)
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.
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 • Run the module:
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.
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.
Rest of Today • 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.