Lab 6 HAPTICS
The goal of this lab is to introduce some simple one-dimensional active
force-feedback using a motor and encoder. We start with a small
knob but invite you to attach other physical "handles" like
a larger knob, a lever, etc. Each haptic effect can be coupled to
a
sound by sending OSC to Pd. Different haptic effects suggest
different
sounds; different sounds suggest different effects. What are the
most interesting mappings. Which are appropriate, controllable,
even "expressive". Try each sound control with and without the
motor turned on. Are there some that simply cannot be played
without haptics?
PROFILES - First we compute forces as a function of just position: for
every encoder position, there is a specific force. Think of it as
a profile or landscape -- a resisting force feels like pushing
something up a slope, as the force increases,
the slope
increases. Think of the
spring-centering of motortest.c is a "valley", wall.c has no force
until you reach the wall, bumps.c and detents.c are all variations of
force as "slope". Textures can be rendered as series of
bumps. Stability: A
very stiff wall is hard to make "stable": first, the
encoder and force values are discrete making for "stair steps" or
"zippers" and the calculations in fixed-point reducing resolution, more
importantly the update rate must be high. You can explore various
resolutions and rates.
TIME - Forces that vary in time can be pre-programmed (tick.c). A
short positive then negative force, if it is quick enough feels like a
click. When pressing against a spring, a click simulates a
contact being made.
DYNAMICS - We can increase the apparent "mass" - giving the knob a
twist, gets it going. You can simulate simple mass-spring
oscilators (think of it as a pendulum). Without measuring force
(we only measure position) we cannot reduce the "mass" or
"damping". The human hand acts as a "damper" stabilizing an
oterwise oscillating system; the hand can also be a spring-mass coupled
with the virtual spring-mass just like a drum stick bouncing on a snare.
FRICTION - can be simulated with a combination of texture, dynamics and
even pre-programmed
0. Set up
a. wire Motor power (twisted pair) to
MotorBoard screw terminals (+ to A+, -
to A-)
b. wire encoder (grey cable) to Protoboard 8-pin
connector (which should already be connected Green to C0,
White to
D2)
c. use 15v wall supply and make sure it goes from
solderless bread board to
MotorBoard (GND, +POWER)
d. unplug speaker (Blue) from D5 if it is not already
e. jumper AVR ten-pin (PORTD) to MotorBoard (PORT X)
f. plug in LCD display
g. load Lab6 on to your 250a directory
~> cd
~> cp -r
/usr/ccrma/web/html/courses/250a/lab6/programs 250a/lab6
1. motortest (spring-centering)
a. run "motortest.c" (cd ~/250a/motortest then
make
load).
~>cd ~/250a/lab6/programs/motortest
~>make
load
b. The LCD should display
Encoder: and Duty
i) Try moving the knob left and
right.
ii) What is the maximum duty?
![spring centering](spring.jpg)
2. wall
a. run "wall.c"
~>cd ~/250a/lab6/programs/wall
~>make
load
b. Look at the code for wall.c.
i) Make the wall "stiffer"; what
if it's too stiff?
ii) Make the walls further appart or
closer together.
3. wallbang (sending osc message to pd)
a. run "wallbang.c"
~>cd ~/250a/lab6/programs/wallbang
~/250a/lab6/wallbang>make
load
b. run "wallbang.pd"
~/250a/lab6/wallbang>pd wallbang.pd
c. Look at the code for wallbang.c.
i) How might you send the
amplitude (e.g. send "duty" to become "frequency")?
ii) By varying the wall stiffness can
you get an intentional bounce?
4. bumps and detents. plucks and friction.
A "bump" is a slope up to a round top and a
slope down on the other side.
A "pluck" is a slope up like a wall but followed by
an abrupt drop in force at the top.
Stick-slip "friction" is many small plucks in a row.
a. run "detent", "detents" and "pluck".
b. can you make a "bump" instead of a "detent"?
c. think of sending some OSC messages at the right
time/positions.
d. vary W, D, S to match the sounds from Pd.
![detent](detent.jpg)
5. tick
a. run "tick.c"
~>cd
~/250a/lab6/programs/tick
~/250a/lab6/tick>make
load
b. Look at the code for tick.c
i) Make the ticks longer, larger,
more frequent.
6. walltick
a. run "walltick.c"
~>cd
~/250a/lab6/programs/walltick
~/250a/lab6/walltick>make
load
b. run "snare.pd"
~/250a/lab6/wallbang>pd Snare.pd
c. what is the "right" place (distance
into the
wall), magnitude, etc.
d. try matching the wall stiffness and the tick to
different sounds.
7. pendulum
8. spring, mass and damping
references:
<~/avrlib/ccrma/osc.h>
<~/avrlib/ccrma/osc.c>
not included in <~/avrlib/docs/>
see schematics and manual for MotorBoard on Pascal's site: AVR boards
motor data sheet: <~/Lab6/RelianceMotor.jpg>