⟵ back to lab


Lab 3





For Lab 3, I used a node based programming language and environment called TouchDesigner which is used to manipulate real-time multimedia content. Transformations are performed by nodes (rectangular blocks) where the output and/or properties of one node can become the input to another node, nodes are chained together to create a pipeline (reminiscent of functional programming).

I chose to use TouchDesigner because I've found it to be useful for real-time signal processing and has unique features which I thought could be interesting to explore with the Haply. I modified my code from Lab 2 to have Processing send and receive OSC messages to and from a TouchDesigner program, where I do force calculations. Processing sends the device's position and listens for torque data from TouchDesigner.

I started by attempting to build a PID controller in TouchDesigner, which has nodes to calculate derivatives and integrals. I was able to create a controller but unable to reach a stable state after spending a lot of time tweaking the gain values. I speculate there was too much delay when calculate the derivative/integral which create lag in the PID feedback loop between TouchDesigner, Processing, and the Haply. However, the process was very insightful and I felt I understood PID control better from tweaking gain values through TouchDesigners responsive and visual interface.

My original and final words were:
  1. Bird (dynamic object) -> Fly (dynamic object)
  2. String (dynamic object) -> Grate (region)
  3. Handwriting (region)

Link to the code (requires TouchDesigner to open .toe file).

The let image is the TouchDesigner "code" which contains all three movements (switched through keyboard). Below are the movements on the Haply and their corresponding TouchDesigner nodes.

Movement 1: Fly

Original word: Bird -> final word: Fly

I wanted to convey the movement of a bird in flight because I think it is an interesting combination of locally random but overall focused and smooth movement. I imagined the bird as the end effector. To create the movement I varied the x and y force using sin and cos functions with varying magnitude, frequency, and speed that would change over time, which I combined these with noise functions. I found the final movement to be more jittery and erratic than I expected which is how my word became Fly, which was more characteristic of the final result.

I designed the movement with the user holding onto the end effector in mind. I realize when the user is not holding the effector, the Haply maxes out to the edge of the task space quickly. This helped me understand the usefulness of having PID control.

Movement 2: Grate

Original word: String -> final word: Grate

I originally wanted to simulate the feeling of plucking a string because I am creating a musical instrument for my group project. I experimented with different wave types (square, sine, triangle) functions and used the end effector's x position to shift their phase. This gave the feeling of "strumming" as the user moved the end effector horizontally.

I found using the square wave create an interesting texture and sound that reminded me of running a hard object across a metal grate. I found mapping movement as a function of the x position to be useful in shaping the texture of the force.

Movement 3: Handwriting

Original and final word: Handwriting

I wanted to recreate the feeling of handwriting. I held attached a pen to the end effector to simulate a writing grip, which added realism. I used a sum of sine functions to produce vertical force as a function of the x position, so when the user moved the Haply horizontally, the pen would move up and down. I found adding sine waves of different frequencies helped create a feeling of scribble but with varied rhythm of cursive writing. Similar to Movement 1, without pressing on the pen, the Haply quickly maxed to the edge of the task space.

Overall I was most satisfied with the Handwriting movement but found the Grate movement to be the most unexpected. Some lessons I learned were the usefulness of periodic shaping functions in producing dynamic and varied textures, which I noticed a similarity to sound synthesis. I found combining these functions and having them be a function of the Haply's position produced more complex and dynamic movements.

With Movements 1 and 3, I noticed by holding onto the end effector, I was acting as a PID controller, stabilizing the system, and part of the feedback loop. This reminds me of the field of Cybernetics where biological and mechanical systems share common processes through feedback loops. I think it is interesting to think of the user as a component of the loop. Although I was disappointed I could not implement PID control in TouchDesigner, it helped me understand feedback control more, which will definitely help me for Lab 4 and my group project.

© Derrek Chow 2022