|Assignment 01: Arduino, Sensors, and Servos|
The NYU computer store has received about 100
Arduino boards on 01/23. Get yours before Tuesday!
In addition to the Arduino, you will need the following parts
(one set of part for two students is OK).
You can either get the Arduino kit box (but the store doesn't have
many of them left), or you can buy the necessary items spearately from
the computer store:
You also need resistors, wires, and a small DC motor. You can get
assorted resistors from the computer store and wires from Radio Shack
(two block north of the classroom on Broadway), but you can also use
one from the lab. The equipment is set up on a set of tables in the
south-west corner of the 12th floor.
- 1 dual H-bridge integrated circuit
- 3 CDS cells (light sensors)
- 1 standard servo
- 1 prototyping breadboard
- 2 flex sensor
The TA is Pierre Sermanet [pierre.sermanet [at] gmail [dot] com].
Koray Kavukcuoglu [koray [at] cs [dot] nyu [dot] edu] will also be
present in the class on 01/27 and 01/29.
The projects for 01/27 and 01/29 are:
- reading analog values from the CDS cells (connecting
a resistor as a voltage divider)
- reading analog values from the flex sensors (connecting
a resistor as a voltage divider)
- controlling a servo: you must generate a pulse between 1.0
and 2.0 millisecond every 50 millisecond to control the servo.
The width of the pulse determines the positon of the servo arm.
- control the servo position using the flex sensor.
- connect 2 or 3 CDS cells to the arduino, stick the prototyping
breadboard on the servo arm (using double-sided tape), and control
the servo to orient the board in the direction of highest
- Extra credit: Implement a proportional controller with dead band,
i.e. the speed with which the servo is rotated should be proportional
to the "error" signal. The error is the difference between the ouputs
of the left and right light sensors (sensors should probably
be calibrated during the startup phase).
|Assignment 02: PWM speed control|
Control the speed of a DC motor using Pulse Width Modulation.
controlling an electric DC motor: connect the H-bridge chip and
control the speed of the motor using Pulse-Width Modulation using
the AnalogWrite() function of the Arduino.
|Assignment 03: following a line with the 3pi robot|
3PI robot: calibrating the reflective light sensors.
Get this sample code that reads the line sensors
3PI robot: line following with proportional controller.
Extra credit for implementing a PID controler.
Super extra credit for winning the race.
|Assignment 04: 3pi dead reckoning|
3PI robot: dead reckoning and driving home. The robot must follow a line,
detect the end of the line, and return to the starting point (or as close
to it as possible).
You must write a function with the following prototype:
"void update_position(int ml, int mr, long dt, long *x, long *y, long *theta)"
where ml and mr are the motor speeds, dt is the time interval during which
these speeds are valid (in milliseconds), and x, y, and theta are pointers
to the coordinates and heading variables of the robot (to be updated
by the function.
you will need trig functions as well as functions to convert the motor speeds
to robot speed and rotation.
To help you with this, we are providing the following .h file, which contains
trig functions, as well as functions to convert 3pi motor speeds
to linear and rotational speeds: 3pi_kinematics.h.
Add the file to your directory, and add '#include "3pi_kinematics.h"'
to your program.
The file provides four functions:
- long Sin(long a): return 1000 times the sin of angle a (in degrees).
- long Cos(ling a): return 1000 times the cos of angle a (in degrees).
- long motor2speed(int v): return the speed of the robot in 1/10 mm/s
given the average motor speed of the two wheels.
- long motor2angle(int mleft, int mright): return the rotational speed
of the robot in degrees per second, given the motor speeds of the left
and right wheels.
Note that the speed and rotation functions have been calibrated on a particular
robot. Your own robot may have slightly different characteristics.
Also note that the estimates are not likely to be accurate if the
speed changes abruptly.
Detect a tennis ball and drive the rovio to it, stopping a few cm before it.
You need Lush, which runs on Linux and Mac.
You also need the Lush Rovio library.
First, you need to estimate the distance from the rovio to the ball.
Using the diagram below, find the formula that relates gives x from L,
where x is the distance to the ball, and L is the difference between
row number of the bottom of the ball in the image, and the middle row
of the image.
Next, you need to calibrate the distance driven by the rovio
when it receives driving commands.
The rovio drives for a short time for each command it receives. If
you don't keep sending driving commands at a fast rate, it will
stop. If you want to stop it right away, send it a stop command.
See the rovio-lib.lsh file for examples.
Get your rovio to play soccer!
The goals are bright red. You must be able to detect the goal
so you can drive between the goal posts.
The strategy is to turn around to find the ball, orbit around
the ball until the goal is visible, and drive towards the goal.