250a Haptics Lab Force-stick

From CCRMA Wiki
Revision as of 17:58, 19 October 2010 by Eberdahl (Talk | contribs) (Part 3: Damping (Optional))

Jump to: navigation, search

Haptics Lab Using The Force-Stick for Music 250a

The goal of this lab is to introduce active force feedback. Each haptic effect can easily be coupled to a sound because the feedback loop is controlled directly in 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 haptic feedback enabled. Are there some that simply cannot be played without haptics?

Feel The Motors

Find the foam-core board that has motors mounted on it and try them out.

For the DC motors, connect one alligator clip to the 6V supply on the Triple Output Power Supply from Hewlett Packard, and connect the other alligator clip to ground, which is labeled COM. Careful! Don't use the 18V supply instead--you could burn out the motors! By adjusting the +6V knob, you can change what voltage you are applying to each of the DC motors. Which way does the solenoid pull? What are small motors good for and what are large motors good for?

For the AC motors, use the Tektronix Function Generator. Try sine waves in the audible range 20Hz-20kHz on the white-colored AC motor. For it to be loud, it needs to be connected to something that can vibrate. Try changing the sound by coupling it to the foam core or the violin body or something else. The other, smaller AC motor can be used to vibrate objects with iron or steel in them or magnets. Try to use it to vibrate the magnet glued to the foam core. Try to use it to vibrate the violin string directly, which contains some steel inside it. (Hint: You will have to place it very closely to the string without touching the string.) Do you know at which frequencies the violin string responds the most?

Setup the Force-Stick with CCRMA@Satellite

  • Login to ccrma@satellite as usual using ssh from the Terminal program ssh -X ccrma@192.168.1.105 with the password temppwd


  • Install the lab firmware ~/250a/HSP/haptics_firmware/haptics_firmware.pde using the Arduino software.



  • Make sure that you are using the alsa sound driver rather than jack!
  • Install the new and improved .pdsettings file on your CCRMA linux account according to the directions on this page.
  • You may wish to verify that no one has changed the wiring on your machine in the MAXLAB.
    • The Falcon should be connected over USB to the machine by way of a USB hub.
    • A -30V DC power supply should be plugged into the Falcon. The power supply has a yellow band on the end of the plug.
  • If you need to make a 250a directory, type

~> mkdir ~/250a

~> mv ~/Desktop/Falcon-pd-linux.zip ~/250a

  • Unzip the files by typing

~> cd ~/250a unzip Falcon-pd-linux.zip

  • Run qjackctl& and click the Start button to start the Jack audio server on ccrma@satellite.
  • Start pd and choose File|Path...
    • Add the paths /home/user/ccrma/250a/HSP/palette and /home/user/ccrma/250a/HSP/models
    • Make sure that you hit Apply and then the OK button to confirm.


Touch-a-wall

  • Open the patch ~/250a/HSP/models/Touch-a-wall.pd
  • Read the text of the patch so that you can understand how the layout of the patch relates to the equivalent mechanical system of the Force Stick being connected by a conditional link contact~ to ground.
  • Turn on audio by clicking on compute audio
  • Verify that by moving the Force Stick back and forth, you can make the hslider shown in the patch change.
    • Hint: Remember that rotary encoders don't necessary know where 0 is--they just choose zero as being the position when the program first starts.
    • To zero the rotary encoder for the force stick being held in the middle, first rotate the force stick to the center, and then press the reset RST button on the Arduino.
    • Now hold the force stick in one hand, while you turn the power on for the motor amplifier board by switching the toggle switch to the ON position.
    • You should be able to feel a soft "wall" when you move the force stick to the right of the center position. (If not, then check your setup.)
    • Because of the spring action of the contact~ link c, the force increases when you move to the right. However, if you move far enough to the right, then the motors can no longer increase the force level any further due to mechanical limitations.
    • Try decreasing the stiffness of the contact~ link to 150 N/m. How does this feel?
  • When you are done with the patch, turn the motor amplifier board off again.

Note: Systems with feedback can become unstable if the right conditions arise. This is why it is a good idea to turn off the motor amplifier board when you are not using the system. (Otherwise, consider what can happen with a public address system if you leave it alone and it starts to squeal/howl.)

Wiggle-a-mass

  • Close any other open patches, and then open ~/250a/labs/HSP/Wiggle-a-mass.pd
  • Read the patch and notice how the layout of the patch matches the equivalent mechanical system of a Force Stick connected by a springy link~ to a virtual mass.
  • On the left, the position of the Force Stick is shown with an hslider, and on the right the position of the virtual mass m is shown with an hslider.
  • Turn on the motors and wiggle the Force Stick back and forth. Can you feel the virtual mass?
  • What happens if you change the virtual mass from 0.6kg to 0.3kg?
  • What happens if you change the damping in the link~ from 1 N/(m/s) to 0 N/(m/s)?
  • Is it a bad idea to make the damping negative?

Pluck-a-string~.pd

  • First try interacting with the string without any haptic force feedback. Then turn on the power to the motor amplifier board and try to pluck the string. Is it easier to play with or without haptic feedback?
  • Clicking on the bang in the main patch will cause an impulse to be send into the string. What do you have to do with the Force Stick in order to be able to feel the impulse?
  • Open up the subpatch to have a look inside.
  • Try to imagine what it would look like if the delread~ and delwrite~ pairs were bypassed? Again, the layout of the patch should provide some indication for the equivalent mechanical model.
  • Optional: How could you change either of the DWG-end~ objects to increase the fundamental frequency of the string's sound?

Part 4: Haptic Landscapes (Optional)

The patch restricts the motion of the Falcon grip to the Y-axis using springs in the X-axis and Z-axis. The force in the Y-axis is a function of the Y-position. The function is specified by a user-editable graphical array. At the center of the array, a horizontal slider (hslider) shows the Y-position of the Falcon. The example below specifies two equilibrium points, toward which the Falcon grip is pushed by the motors.

Forceprofile.png

  1. Close the current patch and open force-profile.pd.
  2. On a separate sheet of paper, copy the graphical array and draw X's over the equilibrium points.
  3. On the reverse of the separate sheet of paper, draw a force profile resulting in three equilibrium points, test it in Pd, and draw X's over the equilibrium points.
  4. Experiment with some other force profiles.



Part 5: Virtual Mass On Spring

Now the Falcon grip is connected to a virtual mass by way of a spring.

  1. Close the current patch and open bounce-perc.pd.
  2. Before enabling haptics, manipulate the motion of the virtual mass and listen to the synthesized sound.
  3. Now enable haptics by holding down the center button on the end of the Falcon grip.
  4. Reduce the damping to zero. What is the difference between enabling haptics and not having it enabled?
  5. Is it easier to control the motion of the virtual mass with haptics enabled?



Part 6: Virtual Bowed String

Actually you are enabled to bow a horizontal, virtual surface.

  1. Close the current patch and open bowed-string.pd.
  2. Try bowing the virtual surface.
  3. Note that you can stop the "string" from vibrating if you hold the bow gently against the surface.
  4. Is it easier to bow if it exerts a damping force on you? You can check by adjusting the BOW-STRING DAMPING slider.
  5. Every time you press a key, the note played by the model changes.



Part 7: Build Your Own

Make your very own musical controller using the Falcon and one of the above patches as a starting point. Here are some ideas, but feel free to follow your own interests:

  1. Try to impart kinetic energy from your body into a physical model of an instrument.
  2. Make a record scratching interface allowing you to feel the record.
  3. Can you make a sphere that exerts a spring force on the musician if the musician ever tries to press into it? What sort of music would you put to that?
  4. Can you program the haptic interface so that it allows you to feel a texture?
  5. Make the virtual mass in part 5 increase if the "number of objects" parameter is increased.

Make us proud. (And be ready show off your controller at the next lab session!)