Functionality of KnitWeb Application

Hi Everyone,

In this blog post I will show what are the functionalities implemented in KnitWeb application. First of all let us look into why there is a web application to get a knitting job done. It’s simple. Going for a web application is the best way to acheive platform independence among all the knit app firmware. So the if the hardware level functionality can be abstracted out to a separate library then the web application can use that and provide a common interface to all different knitting application platforms. This is what we have been doing in this GSoC, to provide a common platform and interface for all open source knit app solutions.

So let’s look at the KnitWeb Functionality. KnitWeb consists of two major components, KnitWeb front end and KnitWeb back end logic. KnitWeb front end consists of a pattern editor for edit loaded patterns to workspace, Simulator for show knitting progress and a drawing tool for draw a pattern from scratch. Therefore Pattern editor component is used for easily edit the pattern before send for knitting.

Knitting Simulator is used for render knitting progress to the user with a enhanced user experience. It also consists of main controls for knitting job which user can start/pause/stop a job while knitting.

KnitWeb Drawing tool is used to generate a pattern from a scratch. It provides basic drawing tools including pencil, line, basic shapes and color palette. It also used for replicate a pattern from a existing pattern or a image. Then user can export it to the workspace to continue knitting job.

Pattern Editor Usage

Pattern editor gives following functionality to the users

  • Loads the pattern according to number of rows and columns(stitches) to the editor. Pattern is pixelated as the defined number of rows and columns.

Screenshot from 2015-08-25 08:42:41

  • Select pattern area using square/free hand tools. Then edit colour values of selected area.

Screenshot from 2015-08-25 08:57:28Screenshot from 2015-08-25 08:59:53

  • Show colour regions of selected area/whole pattern and easily edit their colour values.

Screenshot from 2015-08-25 09:08:03

  • Configure machine type and Available ports before creating a knit job. In this step knit web client is communicating with the knit lib server to get those information. After that user can click proceed knitting button to create a knit job.

Knitting Simulator Usage

Screenshot from 2015-08-25 12:14:40

  • Knitting simulator provides knitting progress to the user with enhanced user experience. Current knitting progress is shown to the user as above and also with a progress bar.
  • Knitting simulator window consists of other meta data input needed for configure knitting pattern(knitpat) file such as Start Line, Start Needle, Stop Needle, Number of colours used etc.

Screenshot from 2015-08-25 12:19:33

Drawing Tool

Screenshot from 2015-08-25 12:25:19

  • Drawing tool is used to generate a pattern from scratch or design patterns by replicating image or a texture.
  • After editing finished pattern can be exported to the workspace.

Apart from the above mentioned components edited patterns at the pattern editor can be downloaded as a image file. Also multi-language translation is added by @shiluka to the knit web interface. following is the translation for german language

.Screenshot from 2015-08-25 09:36:08

This sums up the most critical functionalities of knitweb application. I would like to continuously contribute to FashionTec as this inspired me to research and do things that I have not done before. :).

Also here is a little demo on the functionality of knit web. demo link

Thank You 🙂

Continue ReadingFunctionality of KnitWeb Application

KnitWeb Localization

  • Post author:
  • Post category:FOSSASIA

Why Localization important

Localization is the process of adapting, translating and customizing a product for a specific locale or cultural conventions. Localization distinguishes a good web front end from a truly successful one. Today English is a priority language to be learning to use computers. Having Localization we can gain benefits such as, no need to local users to learn English first, Reduce amount of training and localization brings additional value. Localization To improve localization community of volunteers needs to get together and first establish a guiding set of terms to guarantee accurate and consistent translation. Community is the strongest part for an Open Source project. Translation process can be improved by making sure that efforts in translations are consistent and structured. So the lots of local users can enjoy KnitWeb and hopefully become a part of the community.

How Localization work on KnitWeb

KnitWeb construct elements of the interface using JavaScript dynamically. Retrieve the correct localized string in JavaScript is the most important part for localize an app like KnitWeb. For the Localization I used 3 types of files i.e. languge.properties, locles.ini and l10.js.

.properties files (en.properties, ge.properties): These files contain the translations of strings used in the KnitWeb. Each line is the translation of a single string in “name=value” format; name is an identifier for this string, It is used to map the string; value is the translation of the string in particular language.

Inside ge.properties

#Inputs
input_port=Port
input_machine=Maschine:

Inside si.properties

#Inputs
input_port=කවුළුව
input_machine=යන්ත්‍රය:

locales.ini : locales.ini includes which is the default language in case app does not support current language, what type of other locales KnitWeb supports and the location of the each translated file.

l10n.js: JavaScript library. Automatic localization of strings appearing in your app’s HTML. Provides a JavaScript API your app can use to retrieve localized strings( get, getLanguage, setLanguage, getDirection)

global_translate_german
Localization – German
global_tranlate_sinhala
Localization – Sinhala
Continue ReadingKnitWeb Localization

Importance of the test cases for the KnitLib

Having test cases is very important especially for a library like KnitLib because using test cases; we can clearly test particular fields.  In KnitLib, test cases show the information of how the KnitLib should be checked. Also test cases help for new contributors to understand about the KnitLib.

There are several test cases for the current KnitLib implementation such as tests on ayab communication, tests on ayab image, tests on command line interface, tests on KnitPat module and tests on knitting plugin.

For an example in ayab communication there are several important functions have been tested. Test on closing serial port communication, test on opening serial port with a baud rate of 115200 which ayab fits, tests on sending start message to the controller, tests on sending line of data via serial port and tests on reading line from serial communication.  Most of these tests have been done using mock tests. Mock is a python library to test in python.  Using mocks we can replace parts of our system with mock objects and have assertions about how they have been used. We can easily represent some complex objects without having to manually set up stubs as mock objects during a test.

It is very important to improve further test cases on the KnitLib because with the help of good test cases we can guarantee that the KnitLib’s features and functionalities should be working great.

Regards,

Shiluka.

Continue ReadingImportance of the test cases for the KnitLib

Knitting machine abstractions for Knitlib

Hello, during the last weeks we have been working on Knitlib and Knitpat, a knitting machine control library and a standardized format that allows for exchange and storage of patterns.

In order to achieve a common platform for knitting machine development we have the need to abstract away implementation details that can difficult the generic usage of the lib, while keeping extensible and powerful control features. Among the most important abstractions developed for Knitlib is the Knitting Machine Finite State Machine, an abstract representation of the procedures needed to operate a knitting machine.

BaseKnittingPlugin
BaseKnittingPlugin, the basis of knitlib’s machine knitting controller plugins.

The architecture of Knitlib allows for easy integration of different knitting machine plugins for varied use cases, hardware, and software protocols. All functions of the plugin are non blocking except for .knit(), which is blocking due to the physical interaction needed in order to execute this command. To ease usage and to enable more versatile behaviour from the .knit() function, without limiting the interaction facilities needed for operation, the callback infrastructure allows for blocking and non-blocking callbacks from the Plugin to the machine operator (the Knitlib client), such as Information, Warnings, Error Notifications or Mechanical Required Actions (moving spools, switches, needles, etc). Callbacks abstract away the notification and interaction paradigms from the plugin, allowing for simpler behaviour, a more elegant design and ease of testing. Callbacks also allow for future plugins to not take care into implementing user interfaces, but to focus on functionality.

The pending remaining challenge is to standardize configuration options, flags and settings in order to allow for UI that respond to each plugin requirements and options, and to specify which features are supported on each machine plugin. Insofar, most of the standardization has been done on Knitpat, but some specifications such as physical resource assignation (Serial Ports, input streams, etc) are still to be implemented soon.

Thank you, and I hope this article helps you to understand the software architecture and design patterns of the implementation of Knitlib.

Regards,

Sebastian

Continue ReadingKnitting machine abstractions for Knitlib

Importance of a pattern editor for knitting applications

Hi Everyone, I am Sameera Gunarathne who is a participant for GSoC ’15 for FossAsia under fashion and technology. I am developing web based GUI for knitting applications. Today I am going to talk about importance of integrating a pattern editor inside knitting applications and little bit about my work on the pattern editor implementation.

Why knitting application should have a pattern editor? It’s to simply give the user capability of doing all the editing work on the pattern before it is sent for knitting. Therefore user will be able to proceed the whole knitting process using one application. User doesn’t have to use a separate application to edit the pattern and then import the pattern to the knitting software to get knitting done. Also most these pattern editor applications are commercially available which means user has to pay for the application and its updates. So that’s extra money. Some examples for available pattern editor softwares are knitbird , envisioknit , stitchmastery  etc.

KnitBird application
KnitBird application

So what about open source knitting machine software with a feature rich pattern editor? Cool right. I am working on integrating feature rich pattern editor for the knitting web application that I am developing for FossAsia this GSoC. Following features are already added to the pattern editor implementation.

  • Getting a loaded pattern to a pixelated grid to give user a easily editable interface.[1]
  • Pixelated pattern can be generated from available yarn colours that used for knitting.[2]
  • Cropping tool for load necessary parts from the pattern.[3]
  • Rectangular/Free Hand selection of loaded pattern.[4]
  • Editing colour details of a selected area of the pattern.[5]
  • Drawing tool for the loaded pattern. [6]

User is given capability to regenerate the pattern according to the available yarn colours for the knitting. This functionality allows user to understand how the actual knitting output will be there with the available yarn colours. Below are the some of screen shots of current implementation.

Loaded pattern in pixelated grid
[1] Loaded pattern in pixelated grid
Pixelated pattern can be generated from available yarn colours
[2] Pixelated pattern can be generated from available yarn colours
Cropping tool
[3]Cropping tool
Rectangular selection
[4]Rectangular selection
Free Hand selection
[4]Free Hand selection
Editing colour details of a selected area
[5]Editing colour details of a selected area
Drawing tool
[6]Drawing tool
I am very much enthusiastic on the project and working hard to get a good outcome for the knitting web application implementation. See you with the next blog post update. Thanks :).

Continue ReadingImportance of a pattern editor for knitting applications

Knitting Library to support numerous Knitting Machines

Hi everyone, I’m Shiluka Dharmasena, Computer Science and Engineering undergraduate from University of Moratuwa, Sri Lanka. Thanks very much for this great opportunity to get involves in FOSSASIA open source project and I’m keen to give my fullest contribution to the FOSSASIA.  For GSoC 2015, I am developing a library to support knitting machines. It’s great to work with FOSSASIA team under awesome mentors Mario Behling and Christian Obersteiner. This is the Initial suggestions for the project.

Library to support knitting machines

Basic abstraction of the library to create library as separate layers

  • Serial communication : open, configure, read and write to serial port
  • Machine definitions : machine initialization, load to machine, save from machine
  • Image handling functions : memory allocation, read image file, setter and getter for image pixels
  • File handling functions : read / write access
  • Common utility functions

Add dependencies for the library

There are several dependency libraries which ayab has such as pillow, pyserial, wsgiref, fysom and yapsy with relevant versions. These dependencies should be added to the library.

Functions for the library

For access hardware directly
* Identify existing libraries to interface with hardware
* Use libraries to deal with serial ports
* Ability to get all the functions via library (for an example functions in ayabControl.py and add more functions to support in more machines)
* Ability to send QT signals

Emulate file formats

* Create functions to emulate file format

Add Arduino support

Installation

Installation should be well documented in step by step. Additionally I suggest to add GUI based installation with usability improvements with standard installation procedures.

* Installation on Linux (32bit, 64bit)
* Prerequisites
* Setup
* Installation on Windows (32bit, 64bit)
* Prerequisites
* Setup

Tests on the library

Use a python test framework like unittest to test the python library. It supports test automation and aggregation of the tests into collection.

Documentation of the library

Documenting Class definitions, methods definitions and links to the given source codes.
Continue ReadingKnitting Library to support numerous Knitting Machines

Knitting Web App FrontEnd with Pattern Editor Knitting Simulator

Hi everyone, I am Sameera Gunarathne and I am a computer science undergraduate of University of Moratuwa, Sri Lanka. This is the first time I have applied for the GSoC and FossAsia and I am quite excited to  give my contribution to FashionTec as it’s a whole nice new experience that programming is applied with real world applications in fashion and technology paradigm. I have selected for developing a Graphical User Interface which runs as a web application which is intended to provide a common platform to give input for the knitting machine firmware.

As the first step I had to research on the existing knitting applications that are available online commercially and what they provide as features that still need to be included in open source knitting applications. I have looked into both knitting pattern design softwares and knitting machine embedded softwares including knitbird, EnvisioKnit ,Stoll knitting software, ShimaSeiki SDS One Knit. The most significant feature I have noticed is the feature rich pattern editor provided with the software. They provide features like loading patterns from different formats(jpeg, png,gif,pdf), transform patterns(crop,replicate etc) to create new patterns, drawing tools to create a pattern from scratch, Provide colour palette with available yarn carrier colours, Saving and loading the work done by the user in the application storage etc.

Therefore in this GSoC period I am developing the assigned Web User Interface with consisting of following components.

Web App FrontEnd

  • Work Space + Pattern Editor
  • Knitting Simulator
  • Project Manager

Web App Back End

  • Web Client Server component(REST Api to communicate with knitlib interface)
  • Request Handler for back end logic
Screenshot from 2015-06-02 09:37:09
Logical Architecture Diagram

Knitting Simulator is used to simulate the knitting process through the user interface while the knitting is going on. It will display the carriage details, current knitting progress and a graphical simulation of the current knitting position of the pattern with row details. Project Manager component is to save knitting works as projects and load them later as the user preference.

The selected technologies for the project implementations are mainly JavaScript(node js for back end and angular js for front end implementations), HTML & CSS (render static content). REST Api for communicating with knit lib interface will be implemented in node js. The offline usage of the app will be implemented using Electron Framework.

This project consists of 4 milestones and under the first milestone I am working on the pattern editor features. Currently I have implemented loading different types of patterns into the workspace and pixelate them according to the number of rows and stitches allowed for the knitting. Following tasks will completed end of this week.

  • Identifying individual pixel in the grid as a stitch and add operations such as change colour, size etc.
  • Adding pattern editor tools for selecting pattern area, colour picker, crop-cut-paste tools for pattern replicating.
Screenshot from 2015-06-05 11:41:15
Current Implementation of Pattern Editor

I hope this GSoC will be a fruitful one to spend with a successful implementation of the knit web app and looking forward to provide a competitive open source knitting software at the end of the development :).

 

 

 

Continue ReadingKnitting Web App FrontEnd with Pattern Editor Knitting Simulator

Simpler Control of Knitting Machines with knitting machine abstraction library and JSON based knitting file format

Hello everyone, my name is Sebastian Oliva. I am a developer from Guatemala and part of the team of students currently in Google Summer of Code ’15 working on Fashiontec. During last year’s GSoC I built a GUI interface for the AYAB project, allowing for easier control for knitting machines supported by AYAB (Brother KH-930, KH-910).

When I started getting involved with Fashiontec and FOSSASIA last year I was not aware of the large community related to textile and open fabrication projects. Since then, I have found many projects that have focused on different techniques and have had different approaches to fabrication and in particular the operation of knitting machines. Such as projects that emulate existing functionality of an existing machine, projects that entirely replace or enhance the machine’s inner workings, and projects that build machines from scratch.

Currently I am working on developing a knitting machine abstraction library and JSON based knitting file format that can enable the use of a single API to control a varied number of knitting machines. A knitting machine library allows us to create even more advanced software to control and operate machines, while a standardized and open format for knitting patterns allows us to create pattern collections such as the common pattern books usually shared by knitting communities, as well as enabling pattern editors and ecosystem.

Currently I am:

  • Working on designing and implementing Knitlib’s API design.
  • Writing tests for Knitlib’s desired behaviour.
  • Starting work on defining Knitpat, the open knitting file format.

I hope that this year’s GSoC brings a lot of advances to the machine knitting community, and I am happy to be a part of it.

Continue ReadingSimpler Control of Knitting Machines with knitting machine abstraction library and JSON based knitting file format