textiles-lab / knitout-backend-kniterate

MIT License
16 stars 3 forks source link

improving transition between knits & tucks in single knitout pass (aka 2 kcode passes) #36

Open gabrielle-ohlson opened 3 years ago

gabrielle-ohlson commented 3 years ago

Although the kniterate cannot perform knits and tucks in one kcode pass, it would be nice to have the separated passes flow together better. Currently a knitout pass like so:

knit - b95 4
knit - b91 4
knit - b87 4
tuck - b83 4
tuck - b79 4
tuck - b75 4
tuck - b71 4
tuck - b67 4
tuck - b63 4
tuck - b59 4
knit - b57 4
tuck - b53 4
tuck - b49 4
tuck - b45 4
tuck - b41 4
tuck - b37 4
tuck - b33 4
miss - b29 4

Results in something like this when converted to kcode:

// knitout lines: 3671 - 3702
FRNT:..............._________________________________________________________________________________________________________________________________________/4_______________4\_____________________________________________________________________________________________________...............
STIF:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
REAR:..............._________________________________________________________________________________________________________________________________________/4__-___-___-____4\_____________________________________________________________________________________________________...............
STIR:4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
<< Kn-Kn 4 300 300
//
//
//
// knitout line: 3703
// (decayed from a SOFT_MISS)
FRNT:..............._________________________________________________________________________________________________________________________________________/4_____4\_______________________________________________________________________________________________________________...............
STIF:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
REAR:..............._________________________________________________________________________________________________________________________________________/4_____4\_______________________________________________________________________________________________________________...............
STIR:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
>> Tu-Tu 4 300 0
//
//
//
// knitout line: 3705
FRNT:..............._____________________________________________________________________________________________________________/4_________________________________4\_______________________________________________________________________________________________________________...............
STIF:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
REAR:..............._____________________________________________________________________________________________________________/4__-___-___-___-___-___-___-______4\_______________________________________________________________________________________________________________...............
STIR:4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
<< Tu-Tu 4 300 300

When it would ideally look more like this:

// knitout lines: 3671 - 3702
FRNT:..............._________________________________________________________________________________________________________________________________________/4_______________4\_____________________________________________________________________________________________________...............
STIF:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
REAR:..............._________________________________________________________________________________________________________________________________________/4__-___-___-____4\_____________________________________________________________________________________________________...............
STIR:4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
<< Kn-Kn 4 300 300
//
//
//
//
// knitout line: 3705
FRNT:..............._____________________________________________________________________________________________________________/4____________________________4\____________________________________________________________________________________________________________________...............
STIF:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
REAR:..............._____________________________________________________________________________________________________________/4__-___-___-___-___-___-___-_4\____________________________________________________________________________________________________________________...............
STIR:4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
<< Tu-Tu 4 300 300

The kniterate often encounters an issue when juggling a carrier in the middle of knitting—the working yarn will get a bit caught on the pegs and then won't be at the correct angle to successfully knit, resulting in dropped loops when resuming knitting.

Here's what that might look like in knitout:

knit - f10 1
knit - f9 1
; gets caught on the pegs here v
miss + f9 1
; will drop these loops below v
knit - f8 1
knit - f7 1
ixchow commented 3 years ago

I think I agree here -- in cases where the carrier stopping distance is short enough, juggling/kickbacks should be avoided.

If I recall, the current backend code does have a notion of carrier stopping distances and so probably could do exactly as suggested (at least with suitably-spaced stitches).

I suspect it will never work for a knit and a tuck on adjacent needles (no place to put the carrier), but it would be interesting to run some kcode tests to see if there is some distance for which it does work.