Notes on the hardware for KDC Assignment 4
In this assignment you are to operate a simple robot consisting of a motor with
a piece of wood attached to form a single-joint pendulum. The stations
is at the back of the REL to your right as you enter. If someone from
another class is sitting at the desk, politely ask them to let you use it.
To operate the robot:
Pick up the power strip with the blue tape on it and make sure it
is switched off.
Plug the power strip into the blue extension cable hanging beneath. The
computer is also plugged into that cable. If other students in the lab have
used all of the outlets, ask one of them to clear out.
- Get ready to run your program.
When you are running your program, keep one finger on the power
strip's off switch at ALL TIMES.
When you are done with your program, UNPLUG the power
strip from the extension cord so it can't accidentally be turned on.
The pendulum motor and its amplifier are connected to a Sensoray 626
I/O board in several ways:
- The 626 reads a digital incremental position encoder on the end of the
motor with 1000 ticks/revolution.
- The 626 reads an analog tachometer in the motor housing to get a velocity
reading.
- The 626 sends a control voltage in the range -10V...+10V to the amplifier.
This tarball contains sample code for operating
the hardware for assignment 4.
Build and run the sample program by the following:
cd demo1dof
make
./sample -t 500
The options are:
- -t
- Target position encoder value. Note that 0 is set to the position
of the pendulum when the program starts, and the value continues increasing
(decreasing) cumulatively with each revolution - it does not wrap around to 0.
- -k
- Position servo gain. This should be at most 0.1 for safety.
- -b
- Velocity servo gain. This should be at most 0.01 for safety.
- -l
- File to log time, position, velocity, and applied voltage. Time
is a floating point number in seconds.
- -v
- Enable verbose mode. Prints status to stderr once per second.
Safety is a real issue with this assignment. The amplifier puts out
a lot of juice, and a buggy program can cause the pendulum to spin
with frightening force. Try the following for a taste of what can go
wrong:
./sample -t 4000
Always be ready with the power strip to turn off the amplifier. Do
not rely on Control-C to kill a runaway program. If someone else in
the lab has plugged their laptop in to the power bar at your pendulum
station, tell them to plug in somewhere else. UNPLUG WHEN YOU ARE
DONE. DO NOT GO NEAR THE PENDULUM WHEN IT IS RUNNING.
You can use the file demo1dof/sample.cc as a base
for your own development. Find the comment
/* DO YOUR STUFF HERE */
...
/* FINISH YOUR STUFF */
Accounts
The machine has accounts in the form
user00
with passwords pw00
. The machine is
not connected to the network, so you must get your files on and off with
a USB flash drive.
-- Matthew McNaughton