GUI Fingers

I was involved in a project with the Harvard Robotics Lab that focused on developing soft robotic fingers. I developed a Linux-based software application that could project a real-time 3D rendering of the soft robotic finger surface through a live-stream points streamed over the network. This system was considered to be ahead of its time in the field of soft robotics.

Untitled

![A screenshot of a 13x13 mesh of the robotic finger surface. The mesh refreshes every 30ms, or 30 frames per second, and can be rotated and translated with the mouse.

](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f09ee38a-f2a1-41f5-aa63-acc8b0b5846f/Untitled.png)

A screenshot of a 13x13 mesh of the robotic finger surface. The mesh refreshes every 30ms, or 30 frames per second, and can be rotated and translated with the mouse.

A robotic fingertip. A matrix dots the inner membrane.

A robotic fingertip. A matrix dots the inner membrane.

The FIFO stream (a file) stores the coordinates of the 13x13 matrix representing the finger surface. The coordinates are ordered from left to right, from top to bottom. To create the mesh, the points needed to be reordered to form triangles. Some points and lines are repeated.

The FIFO stream (a file) stores the coordinates of the 13x13 matrix representing the finger surface. The coordinates are ordered from left to right, from top to bottom. To create the mesh, the points needed to be reordered to form triangles. Some points and lines are repeated.

The files are read into three arrays of length 169 points, but to produce a mesh, their contents need to be reordered so that the lines connecting the sequential points will form triangles; this sequence is depicted above in Illustration 3. The mesh that results is an array of length 600 where some of the lines and points are repeated. Each row of the 13x13 mesh is called a 'strip.’

Challenges

Using a marker

In some of the preliminary tests, instead of a relatively-fixed image of the finger surface, the mesh oscillated like a frantic worm. The problem here is that the stream into the FIFOs is sometimes stopped in the middle of a mesh (169 points). When this happens, all subsequent readings contain a part of one mesh and a part of another mesh. To solve this, we transmit a marker—denoted by a -1.0e6 in each of the 3 FIFOs—to signal the start of each mesh. The code pulls from the FIFOs in search for the marker until it is found, and then loads the newest 169 points.

Making the application near real-time

The FIFO is emptied only when this application runs. Often times the application begins running with a history of old FIFOs that must first be cleared for the output mesh to be displayed in virtual real-time. There is a method, available(), that returns the number of bytes left in the FIFO. The code uses this method to see if there are 1704 bytes remaining in the FIFO. If not, the FIFO will quickly pull the old FIFO data out until only 1704 bytes remain. The 170 equals 169 floats plus 1 float for the marker.

Binary data: big endian vs. little endian

We encountered a peculiar problem when we tried to read the FIFOs with Java: points' values received from the FIFOs were enormous. The problem was that the code programmed in C streams out the FIFOs in a slightly different format than Java reads them. C follows the “little-endian” format for reading binary data whereas Java follows the “big-endian” format. That is, Java switches the first 2 bytes with the last 2 bytes in the 4 bytes representing a float variable type. To solve this, we downloaded a piece of code to automatically make this conversion.

Conclusion

In conclusion, the Linux-based software application that I developed for the Harvard Robotics Lab was ahead of its time in the field of soft robotics. The application projected a real-time 3D rendering of the soft robotic finger surface through a live-stream of points streamed over the network. I encountered and overcame several challenges, such as the need for a marker to signal the start of each mesh, making the application near real-time, and dealing with the differences in binary data format between C and Java. Despite these challenges, I was able to successfully develop a working application that contributed to the development of soft robotics technology.