CanHaptics Lab 2: Intro to Haply
The task for this lab was to play around with Haply, try and run the “Hello Wall” and create our own maze.
The setup was mostly straight forward. Thanks to the instructors and Haply people. I installed the IDEs, uploaded firmware, downloaded example codes, and was all set to run the “Hello Wall” example. Well, the first attempt didn’t go quite well and I was not receiving any haptic feedback. It was the motor power issue. After I properly connected the power adaptor, “Hello Wall” ran but I was getting an interface spanning both of my screens, hiding all the controls. Apparently, it was a Processing IDE’s preference issue where it was default set to run on two screens. (Thanks to Bradley for pointing that out!)
The other issue I faced during the initial runs is specifically related to my machine’s processing power. The moment my machine is overloaded with tasks, it freezes the Processing IDE which results in very unstable movement of Haply. Sometimes, Haply is jammed in a position and couldn’t move even after turning the power on and off. Re-uploading the firmware on the board seems to fix that problem. I would investigate further on this issue.
Apart from small glitches, the “Hello Wall” example ran flawlessly on my side. Sometimes, I forgot to put the end effector in a closed-default position before running the code, and it led to some unstable movements.
Designing a Maze
For designing the maze, I first explored several example files provided by Haply. They helped me understand the notations, functions, and structure of the source code. My initial step was to tweak some of the parameters in the code and see how it responded. This helped my understanding.
For the maze design, I combined the ideas provide in examples “Wall Physics” and “Maze Physics”. Using the first one, I tried creating different wall shapes, moved them around, played with the haptic tool avatar. I attempted to find an easier way to create a wall rather than typing precise positions, but could not find anything effective. So eventually, I designed this maze by making and shifting bounding walls, while doing precise position-calculation in my head.
For future, it might be interesting to design a function/plugin that assists in creating bounding walls using binary image or giving input through a scribing tool.
Traversing through this maze seemed super simple, so I decided to add few more elements; I picked those from the “Maze Physics” example. I inserted a start button, some reset blocks, and a water layer that dampens the movement; adding a certain amount of difficulty. Playing around with the dampening variable, I picked the value of 700; it gave a noticeable dampening response. An interesting effect can be felt at the boundary of the water layer and white space.
So, in the final maze, the user starts in white space, moves the haptic tool avatar (game ball) to the green circle to start the maze. The maze appears as soon as the game ball hovers over the circle. The user can now try to solve the maze. If the game ball touches the rex blocks, the maze restarts. Here is a demo video:
Overall, this lab was fun to get started with Haply. I did feel that the final source code is not super-efficient. As we proceed, I might spend some time optimizing and compacting it, so that there are less repeated blobs of code.
You can access the source code here. Have fun!