Category Archives: Class work

PClassic: Problem Set 4

Philadelphia Classic Spring 2014 Contest Problem Set

Screen Shot 2014-12-04 at 9.05.16 AM

Do problems 4 on in class and for homework.
Work with a partner. DO NOT LOOK FOR THE SOLUTIONS

Pay special attention to the following:
1. Make sure you read the instructions in the first 2 pages.
2. Read the problem many times before you get started.
3. Draft a plan on paper or a document before you start.
4. Test parts of the code before you develop the “whole” program.
5. Do not use outside help of any sort.
6. All students have to turn in the assignments to edmodo.com

One-hundred sixty sixth Day 1314 Lego robots

Screen Shot 2014-06-05 at 9.31.57 AM

DifferentialPilot

The DifferentialPilot class controls a vehicle that has two driving wheels, each with its own motor. It steers the vehicle by controlling the speed and direction of rotation of its motors. It is one of several Move Controllers that are based on different mechanical designs, but the differential steering design is the simplest.
The pilot object needs to know the wiring diagram of the robot, i.e. which ports the motors are connected to and whether driving the motors forward makes the robot move forward or backward (reverse). It also needs to know the diameter of the wheels and the width of the track, i.e. the distance between the centres of the tracks of the two wheels. DifferentialPilot uses the wheel diameter to calculate the distance it has traveled. It uses the track width to calculate how far it has rotated. Obviously, both parameters must be in the same units, but they can be anything you wish. With proper adjustment of these parameters, errors in distance traveled and angle of rotation can be held do 2% or perhaps less. This information is passed to the pilot constructor. DifferentialPilot is in the lejos.robotics.navigation package. The documentation for this class is here.

New Assignment: Use what you learned to make your robot follow an 8 shape pattern.

One-hundred fifty ninth Day 1314 Lego robots

May 21st, 2014

Classwork

Screen Shot 2014-05-21 at 11.50.15 AM

1. Write Program 3 – Accurate rotation control.
What the program should do

Display the program name and wait for a button press.
Rotate the motor 4 complete revolutions.
Display the tachometer reading on the on the LCD.
Rotate the motor to angle 0.
Display the tachometer reading on the on the LCD, next row
Wait for a button press.

2. Write Program 4 – Interrupting rotation.
What the program should do

Display the program number.
Start a rotation of 4 revolutions backward.
While the motor is rotating, display the tacho count.
When a button is pressed, stop the motor.
After the motor has stopped, display the tacho count in another row.
Wait for a button press.

3. Program 5: Regulating motor speed
What the program should do:

Display the program number as usual.
Set the speed of all 3 motors at 2 revolutions/sec.
Start all 3 motors rotating through 2 revolutions simultaneously.
Every 200 ms, display all 3 tacho count values in a row.
Repeat step 3, 8 times, using a different row each time.
Wait for a button press while you write down the array of numbers (perhaps in a spread sheet)

NOTE: Each member submit the work in edmodo.com

Homework: Finish reading the page for Controlling the Motors