The programming behind machine-powered knitting is getting a much-needed rewrite
Author: Matty Wasserman
Date: 01.17.24
Machine knitting, the automated manufacturing process of making textiles and garments out of yarn, is an integral component of industrial manufacturing. But the programming behind these knitting machines — in essence, how they are coded to knit sweaters, shirts, socks, or blankets to specific measurements — is extremely complex.
Altering knitting commands and designing new ones is a laborious, inefficient, and error-prone process — one that Megan Hofmann, an assistant professor at Khoury College, has become all too familiar with after years of research in the space. Hoping to ease these hurdles, Hofmann took it upon herself to create a new baseline framework, and to make it free and available to everyone.
Over the past year, Hofmann has led a group of researchers in developing KnitScript, a domain-specific machine knitting scripting language based on Python. In October, the group — which includes Carnegie Mellon University’s Lea Albaugh and Scott Hudson, as well as the University of Washington’s Tongyan Wang and and Jennifer Mankoff — presented their research paper, KnitScript: A Domain-Specific Scripting Language for Advanced Machine Knitting, at the ACM Symposium on User Interface Software and Technology.
While KnitScript is primarily being used by Hofmann’s research collaborators, students, and local partners for now, her vision for it is far wider.
“Much in the same way that programming languages are the bottom-layer infrastructure for all of the software we use, I imagine that this will be used for just about everything in machine knitting,” Hofmann said. “This is not the endpoint or the design tool itself; this is what lets us build tools on top of it. Everything from fashion to the medical industry would be building their own design tools on top of this language.”
Previously, programmers had two workaround solutions to tailor knitting machines to their desired patterns and algorithms. They could use template-based design tools that came integrated with the machine, which limited the originality of designs, or they could use low-level assembly programming tools, which were complicated to build and difficult to scale. Now KnitScript provides a foundational, industry-standard language, lays the groundwork for further advanced knitting techniques, and simplifies the training and adoption process for programmers.
“The existing framework for these machines was so locked into what individual companies produced with their tools, and there wasn’t an easy way to bring in someone who had a computational background. If someone wanted to program with machine knitting, they needed to dedicate six months to learning how to use the equipment,” Hofmann said. “Now, they just need a few practice coding problems.”
Hofmann first pinpointed this need as a doctoral student at Carnegie Mellon University, where she blended machine knitting and medical making to create customized assistive devices for people with disabilities, earning a SIGCHI Outstanding Dissertation Award in the process. Through that project and others, Hofmann found herself tweaking and adapting the machines’ underlying programming over and over again. Eventually, it clicked that her work from these projects could be developed into a broader programming language, eliminating the treacherous process altogether.
“It took me a number of years to get to that point of familiarity,” Hofmann said. “I essentially rebuilt the toolset that underlies this language three or four times in the process of building other tools for other research projects, until I felt like I had settled down on a consistent structure.”
But while the idea of a domain-specific programming language felt obvious to Hofmann, it wasn’t being widely pursued. So in the spring of 2022, she conducted a user study to introduce the concept to other researchers, and received extremely positive feedback.
“It was not intended to be a research project initially,” Hofmann said. “But as soon as we had a working tool that our team was using, and the other collaborators I had were using it, we thought, ‘Oh, there’s really something meaningful and important here.’ We wanted to get it out into the community.”
Aside from Hofmann’s students and the ACT (Accessible Creative Technologies) Lab she heads at Khoury College, Hofmann’s collaborators at the University of Washington, Carnegie Mellon University, and the Massachusetts Institute of Technology have also adapted the software. She hopes more researchers and students nationwide will adopt the technology, and to spur this, KnitScript’s full documentation and library is publicly available and easy to install on PyPi, a Python software repository.
“We wanted to make this really, really easy to get started with, and get it into the hands of as many people as we can,” Hofmann said.
But for KnitScript to jump from academia to ubiquitous industry use, it must also be integrated with industrial manufacturers, including makers of clothing, customized medical devices, and advanced textiles. Hofmann is already partnering with organizations in the Boston area to use KnitScript in their design processes, which she hopes will build industry awareness of KnitScript’s value and malleability.
“There’s a huge variety of companies interested in manufacturing advanced textiles, and all of them need this kind of toolset. Many of them have been doing this in-house, and they’ve been struggling with it because it’s really hard to find anyone with this expertise,” Hofmann said. “Being able to work with them and get them into KnitScript means they’re going to be building their software and their advances on top of it.”
As the demand for customization and design sophistication continues to grow in the advanced textile space, Hofmann sees KnitScript’s benefits increasing as she and her collaborators continue to evolve it.
“We’re still adding new data structures, different presentations, and new ways of detecting common errors. But it’s really a pluggable and scalable project; we can expand on it just like with any other programming language,” Hofmann said. “And as we have more of a community understanding of the machine knitting space and what this community needs, we’ll continue advancing KnitScript in the direction it needs to go.”