Author Archives: graceliana@gmail.com

Summer Assignment 1314

Due date: September 10th, 2013

  1. It will be graded based on design and correct implementation of the specifications.
  2. It is due on September 10th, 2013.
  3. Attach pseudocode
  4. Attach a flowchart. Here are some basic flowhcart symbols you need to know: Screen Shot 2013-09-01 at 8.24.32 PM
  5. Implement the driver/test class.

Create class IntegerSet. Each object  of the class can hold integers in the range 0 through 100. A set is represented internally as an array of booleans. Array element a[i] is true if integer i is in the set. Array element a[j] is false if integer j is not in the set. The no-argument constructor initializes a set to the so-called “empty set” (i.e., a set whose array representation contains all false values).

Provide the following methods:

1. Method unionOfIntegerSets creates a third set which is the set-theoretic union of two existing sets (i.e., an element of the third set’s array is set to true  if that element is true in either or both of the existing sets; otherwise, the element of the third set is set to false).

2. Method intersectionOfIntegerSets creates a third set which is the set-theoretic intersection of two existing sets i.e., an element of the third set’s array is set to false if that element is false in either or both of the existing sets; otherwise, the element of the thirds set is set to true).

3. Method insertElement inserts a new integer k into a set (by setting a[k] to true).

4. Method deleteElement deletes integer m (by setting a[m] to false).

5. Method setPrint prints a set as a list of numbers separated by spaces. Print only those elements that are present in the set. Print — for an empty set.

6. Method isEqualTo determines if two sets are equal.

Write a program to test your IntegerSet class. Instantiate several IntegerSet objects. Test that all your methods work properly.

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.