GcodeDriver - Helsparrow/OpenpnpDocs_KR GitHub Wiki

GcodeDriver๋Š” ์‚ฌ์šฉ์ž ์ง€์ • ๋“œ๋ผ์ด๋ฒ„ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜์ง€ ์•Š๊ณ ๋„ ํ”ผ๋”์™€ ๊ฐ™์€ ๋ณต์žกํ•œ ๊ธฐ๊ณ„ ๋ฐ ์• ๋“œ์˜จ ํ•˜๋“œ์›จ์–ด๋ฅผ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ๋ฒ”์šฉ ๋“œ๋ผ์ด๋ฒ„์ž…๋‹ˆ๋‹ค. ๋ชจ๋“  ๊ตฌ์„ฑ์€ ๊ตฌ์„ฑ ํŒŒ์ผ์˜ ๋ช…๋ น์„ ํ†ตํ•ด ์ˆ˜ํ–‰๋ฉ๋‹ˆ๋‹ค.

GcodeAsyncDriver๋Š” ์ด ๋“œ๋ผ์ด๋ฒ„์˜ ๊ณ ๊ธ‰ ํ™•์žฅ์ž…๋‹ˆ๋‹ค. ์ด ํŽ˜์ด์ง€์˜ ์ง€์นจ์€ ์—ฌ์ „ํžˆ ์ ์šฉ๋˜์ง€๋งŒ ์—ฌ๊ธฐ์— ๋” ๋งŽ์€ ์„ค์ •์ด ์„ค๋ช…๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋ชจ๋“  ์„ค์ •์„ ์œ ์ง€ํ•˜๋ฉด์„œ ๋ฌธ์ œ ๋ฐ ์†”๋ฃจ์…˜ ๋งˆ๋ฒ•์‚ฌ ์‹œ์Šคํ…œ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ณ ๊ธ‰ ๋“œ๋ผ์ด๋ฒ„๋กœ ์ž๋™ ์—…๊ทธ๋ ˆ์ด๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ปจํŠธ๋กค๋Ÿฌ ํŠน์ง•

ํŠน์ • ์ปจํŠธ๋กค๋Ÿฌ์— ๋Œ€ํ•ด GcodeDriver๋ฅผ ๊ตฌ์„ฑํ•  ๋•Œ ์ถ”๊ฐ€ ์ •๋ณด๋Š” ๋‹ค์Œ ํŽ˜์ด์ง€๋ฅผ ์ฐธ์กฐํ•˜์‹ญ์‹œ์˜ค:

์˜ˆ์ œ

์ปค๋ฎค๋‹ˆํ‹ฐ์—์„œ ์ œ๊ณตํ•˜๋Š” ์ผ๋ถ€ ๊ตฌ์„ฑ ์˜ˆ์ œ๋Š” GcodeDriver: ์˜ˆ์ œ ํ™˜๊ฒฝ์„ค์ •๋ฅผ ์ฐธ์กฐํ•˜์‹ญ์‹œ์˜ค. ์ปจํŠธ๋กค๋Ÿฌ์™€ ์ผ์น˜ํ•˜๋Š” ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ฐพ์œผ๋ฉด ํ•ด๋‹น ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์‚ฌ์šฉ์ž ์‹œ์Šคํ…œ์˜ ์‹œ์ž‘์ ์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์—ฐ๊ฒฐ

Driver Connection

์ปจํŠธ๋กค๋Ÿฌ์— ๋“œ๋ผ์ด๋ฒ„๋ฅผ ์—ฐ๊ฒฐํ•˜์„ธ์š”.

ํ™˜๊ฒฝ์„ค์ •

GcodeDriver๋ฅผ ๊ตฌ์„ฑํ•˜๋ ค๋ฉด ์ ์–ด๋„ COMMAND_CONFIRM_REGEX์™€ ํ•˜๋‚˜ ์ด์ƒ์˜ ๋ช…๋ น์„ ์„ค์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. COMMAND_CONFIRM_REGEX๋Š” ๋“œ๋ผ์ด๋ฒ„๊ฐ€ ์ปจํŠธ๋กค๋Ÿฌ์˜ ์‘๋‹ต์„ ์ผ์น˜์‹œํ‚ค๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ์ •๊ทœ์‹์ž…๋‹ˆ๋‹ค. ์‘๋‹ต์ด ์ผ์น˜ํ•˜๋ฉด ๋ช…๋ น์ด ์™„๋ฃŒ๋œ ๊ฒƒ์œผ๋กœ ๊ฐ„์ฃผ๋ฉ๋‹ˆ๋‹ค. ๋ช…๋ น์„ ์ •์˜ํ•˜๋ฉด OpenPnP๊ฐ€ ํŠน์ • ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋ ค๋Š” ๊ฒฝ์šฐ ์ปจํŠธ๋กค๋Ÿฌ๋กœ ๋ณด๋‚ผ ๋‚ด์šฉ์ด ๋“œ๋ผ์ด๋ฒ„์— ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

๋ณ€์ˆ˜ ์น˜ํ™˜

๋ชจ๋“  ๋ช…๋ น์€ ๋ณ€์ˆ˜ ์น˜ํ™˜์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ๋ณ€์ˆ˜ ์ž๋ฆฌ ํ‘œ์‹œ์ž๋Š” {VariableName:Format} ํ˜•์‹์ž…๋‹ˆ๋‹ค. ๊ฐ ๋ช…๋ น์— ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋ณ€์ˆ˜ ์ด๋ฆ„์€ ์•„๋ž˜ ๋ช…๋ น๊ณผ ํ•จ๊ป˜ ๋‚˜์—ด๋ฉ๋‹ˆ๋‹ค. ํ˜•์‹์€ printf์™€ ์œ ์‚ฌํ•œ Java ์Šคํƒ€์ผ ํ˜•์‹ ๋ฌธ์ž์—ด์ž…๋‹ˆ๋‹ค. ํ˜•์‹์ด ์ง€์ •๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ ํ˜•์‹์€ %s๋กœ ๊ธฐ๋ณธ ์„ค์ •๋˜๋ฉฐ ์ด๋Š” ๋‹จ์ˆœํžˆ ๋ณ€์ˆ˜์˜ ๊ฐ’์„ ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

๋ณ€์ˆ˜ ์ž๋ฆฌ ํ‘œ์‹œ์ž๋Š” ๋ช…๋ น์— ๋ณ€์ˆ˜๊ฐ€ ์žˆ์„ ๋•Œ๋งŒ ๋ฐฉ์ถœ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด ๊ฐ„๋‹จํžˆ ํ…์ŠคํŠธ์—์„œ ์ œ๊ฑฐ๋ฉ๋‹ˆ๋‹ค(์˜ˆ: {์—์„œ }๋กœ). 'ํ˜•์‹'์—๋Š” ๊ณ ์ • ํ…์ŠคํŠธ ๋˜๋Š” ํ˜•์‹ ์ง€์ •์ž๊ฐ€ ์‚ฝ์ž…๋œ ๊ณ ์ • ํ…์ŠคํŠธ์˜ ์กฐํ•ฉ๋„ ํฌํ•จ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋ณ€์ˆ˜๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ์—๋งŒ ์กฐ๊ฑด๋ถ€๋กœ ์ •์  ํ…์ŠคํŠธ๋ฅผ ๋‚ด๋ณด๋‚ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ์ถ• ๋ฌธ์ž๊ฐ€ ์ขŒํ‘œ์™€ ํ•จ๊ป˜ ๋ฐฉ์ถœ๋˜์–ด์•ผ ํ•˜๊ฑฐ๋‚˜ ์ „ํ˜€ ๋ฐฉ์ถœ๋˜์ง€ ์•Š์•„์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ์— ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค. {X:X%.4f}.

์•„๋ž˜ ๋ช…๋ น์–ด์—์„œ ๋ช…๋ น์–ด์— ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๋ณ€์ˆ˜๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ ๋ช…๋ น์–ด ๋’ค์— ํ•ด๋‹น ๋ณ€์ˆ˜๊ฐ€ ํ‘œ์— ๋‚˜์—ด๋ฉ๋‹ˆ๋‹ค.

๋ช…๋ น์–ด

๋ช…๋ น์–ด, ๋ณ€์ˆ˜ ๋ฐ ์˜ˆ์ œ์˜ ์ „์ฒด ๋ชฉ๋ก์€ GcodeDriver: Command Reference๋ฅผ ์ฐธ์กฐํ•˜์‹ญ์‹œ์˜ค.

์ •๊ทœ ํ‘œํ˜„์‹(์‘๋‹ต ์ˆ˜์‹ )

GcodeDriver๋Š” ์ •๊ทœ์‹์„ ์‚ฌ์šฉํ•˜์—ฌ ์ปจํŠธ๋กค๋Ÿฌ์˜ ์‘๋‹ต์„ ํŒŒ์‹ฑํ•ฉ๋‹ˆ๋‹ค. ์ •๊ทœ์‹์€ ๋งค์šฐ ์œ ์—ฐํ•˜๋ฉฐ ๊ฑฐ์˜ ๋ชจ๋“  ์ข…๋ฅ˜์˜ ํ…์ŠคํŠธ์—์„œ ๊ฑฐ์˜ ๋ชจ๋“  ๊ฐ’์„ ๊ตฌ๋ฌธ ๋ถ„์„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

GcodeDriver๊ฐ€ ์‚ฌ์šฉํ•˜๋Š” ๋Œ€๋ถ€๋ถ„์˜ ์ •๊ทœ์‹์€ ํŠน์ • ์‘๋‹ต์ด ์ˆ˜์‹ ๋˜๋„๋ก ํ…์ŠคํŠธ๋ฅผ ์ผ์น˜์‹œํ‚ค๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ํ•ญ๋ชฉ์—๋Š” ์‘๋‹ต์—์„œ ๊ฐ’์„ ์บก์ฒ˜ํ•˜๋Š” ํŠน์ˆ˜ ์‹œํ€€์Šค๊ฐ€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.

RegExr์€ ์ •๊ทœ์‹์„ ์‹คํ—˜ํ•˜๊ธฐ์— ์ข‹์€ ์‚ฌ์ดํŠธ์ž…๋‹ˆ๋‹ค. ์„ค๋ช… ํƒญ์„ ํด๋ฆญํ•˜๋ฉด ์‹์˜ ๊ฐ ๋ถ€๋ถ„์ด ์ˆ˜ํ–‰ํ•˜๋Š” ์ž‘์—…์ด ํ‘œ์‹œ๋˜๊ณ  ์„ธ๋ถ€ ์ •๋ณด ํƒญ์—๋Š” ์ผ์น˜ ํ•ญ๋ชฉ ๋ฐ ์บก์ฒ˜๋œ ๊ฐ’์— ๋Œ€ํ•œ ์ •๋ณด๊ฐ€ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.


์ฐธ๊ณ : ๊ฐ€์žฅ ์ผ๋ฐ˜์ ์ธ ์ปจํŠธ๋กค๋Ÿฌ ํŽŒ์›จ์–ด์˜ ๊ฒฝ์šฐ OpenPnP๋Š” ๋งŽ์€ ๋ช…๋ น๊ณผ ์ •๊ทœ์‹์„ ์ž๋™์œผ๋กœ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ธฐ๊ณ„์— ๊ตฌ์„ฑ๋œ ๋Œ€๋กœ ์ถ•์„ ์‚ฌ์šฉํ•˜์—ฌ ์˜ฌ๋ฐ”๋ฅธ ๋ณ€์ˆ˜๋กœ ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค. ๋ฌธ์ œ ๋ฐ ์†”๋ฃจ์…˜ ๋งˆ๋ฒ•์‚ฌ ์‹œ์Šคํ…œ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ œ์•ˆ๋œ ์ฝ”๋“œ๋ฅผ ์–ป์œผ์‹ญ์‹œ์˜ค. ์–ธ์ œ๋“ ์ง€ ํ•ด์ œ/์‹คํ–‰ ์ทจ์†Œํ•˜๊ฑฐ๋‚˜ ๋‚˜์ค‘์— ๋ณ€๊ฒฝ/ํ™•์žฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


COMMAND_CONFIRM_REGEX

๋“œ๋ผ์ด๋ฒ„๋Š” ์ด ์ •๊ทœ์‹์„ ์‚ฌ์šฉํ•˜์—ฌ ์ปจํŠธ๋กค๋Ÿฌ์˜ ์‘๋‹ต์„ ์ฐพ์Šต๋‹ˆ๋‹ค. ๋ช…๋ น์„ ๋ณด๋‚ธ ํ›„ ๋ช…๋ น ์™„๋ฃŒ๋ฅผ ๊ณ ๋ คํ•˜๊ธฐ ์ „์— ์ด ์ •๊ทœ์‹๊ณผ ์ผ์น˜ํ•˜๋Š” ์ค„์„ ๊ธฐ๋‹ค๋ฆฝ๋‹ˆ๋‹ค. ๋งŽ์€ ์ปจํŠธ๋กค๋Ÿฌ์—์„œ ์ด๋Š” ๋‹จ์ˆœํžˆ ok์ด์ง€๋งŒ ์ผ๋ถ€ ์ปจํŠธ๋กค๋Ÿฌ๋Š” ๋ช…๋ น ๊ฒฐ๊ณผ์™€ ํ•จ๊ป˜ ์ถ”๊ฐ€ ์ •๋ณด๋ฅผ ์ „์†กํ•˜๋ฏ€๋กœ ^ok.*์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

์ปจํŠธ๋กค๋Ÿฌ๊ฐ€ ACTUATOR_READ_COMMAND์—์„œ ๋ฐ˜ํ™˜๋œ ๊ฐ’ ๋‹ค์Œ์— OK๋ฅผ ๋ฐ˜ํ™˜ํ•˜์ง€ ์•Š์œผ๋ฉด ์—ฌ๊ธฐ์— ์ด ์‘๋‹ต๋„ ํฌํ•จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ: "^(ok)|(Read:).*".

COMMAND_ERROR_REGEX

๋“œ๋ผ์ด๋ฒ„๋Š” ์ด ์ •๊ทœ์‹์„ ์‚ฌ์šฉํ•˜์—ฌ ์ปจํŠธ๋กค๋Ÿฌ์˜ ์‘๋‹ต ์˜ค๋ฅ˜๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. ์ •๊ทœ์‹์ด ์„ค์ •๋˜๊ณ  ์‘๋‹ต ์ค‘ ํ•˜๋‚˜์™€ ์ผ์น˜ํ•˜๋ฉด ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๊ณ  ์‘๋‹ต ๋ฉ”์‹œ์ง€๊ฐ€ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค. ์ปจํŠธ๋กค๋Ÿฌ๊ฐ€ ์œ ํšจํ•˜์ง€ ์•Š๊ฑฐ๋‚˜ ๋ถ€์ ์ ˆํ•œ ๋ช…๋ น์— ๋Œ€ํ•œ ์˜ค๋ฅ˜๋ฅผ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๋Š” ๊ฒฝ์šฐ ์ด ์ •๊ทœ์‹์„ ์‚ฌ์šฉํ•˜์—ฌ ์˜ค๋ฅ˜๊ฐ€ ์ˆ˜์‹ ๋  ๋•Œ OpenPnP๊ฐ€ ์ค‘์ง€๋˜๋„๋ก ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ: ^error:.*

MOVE_TO_COMPLETE_REGEX

์ตœ์‹  ๋ฒ„์ „์˜ OpenPnP 2.0 ๋ฐ ์ตœ์‹  ์ปจํŠธ๋กค๋Ÿฌ ํŽŒ์›จ์–ด์˜ ๊ฒฝ์šฐ ๋” ์ด์ƒ ํ•„์š”ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์Šต๋‹ˆ๋‹ค. TinyG ์‚ฌ์šฉ์ž๋Š” ํŽŒ์›จ์–ด ์—…๊ทธ๋ ˆ์ด๋“œํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋ฌธ์ œ ๋ฐ ์†”๋ฃจ์…˜ ๋งˆ๋ฒ•์‚ฌ ์‹œ์Šคํ…œ์„ ์‚ฌ์šฉํ•˜์—ฌ ํ˜„๋Œ€์ ์ธ ๋ฐฉ์‹์œผ๋กœ ์„ค์ •ํ•˜์„ธ์š”. ์ฆ‰, MOVE_TO_COMPLETE_COMMAND๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

์ด์ „ ๋ฒ„์ „์˜ OpenPnP ๋ฐ/๋˜๋Š” ์ด์ „ ํŽŒ์›จ์–ด์˜ ๊ฒฝ์šฐ ๋‹ค์Œ ์ง€์นจ์„ ๋”ฐ๋ฅด์‹ญ์‹œ์˜ค.

If specified, the driver will check for this regex in the responses after a move-to-command is sent and will not return until the regex is matched. This can be used to support motion controllers that return the command confirmation before movement is complete.

Example: .*vel:0.00.*

ACTUATOR_READ_REGEX

ACTUATOR_READ_COMMAND๋ฅผ ๋ณด๋‚ธ ํ›„ ์•ก์ถ”์—์ดํ„ฐ์—์„œ ๊ฐ’์„ ํŒŒ์‹ฑํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ์ •๊ทœ์‹์€ ํ•„์ˆ˜ ์‘๋‹ต ๊ฐ’์„ ํฌํ•จํ•˜๋Š” Value๋กœ ๋ช…๋ช…๋œ ๊ทธ๋ฃน์„ ํฌํ•จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ: read:(?<Value>-?\d+)

์ด๊ฒƒ์€ read:255 ํ˜•์‹์œผ๋กœ ์ปจํŠธ๋กค๋Ÿฌ์˜ ์‘๋‹ต์„ ์ฝ์Šต๋‹ˆ๋‹ค. ์ •๊ทœ์‹์€ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ถ„๋ฅ˜๋ฉ๋‹ˆ๋‹ค.

  1. read:๋Š” ์ปจํŠธ๋กค๋Ÿฌ๊ฐ€ ๊ฐ’ ์•ž์— ๋ณด๋‚ด๋Š” ๊ณ ์ • ํ…์ŠคํŠธ์ž…๋‹ˆ๋‹ค.
  2. ๋‚˜๋จธ์ง€ ์ •๊ทœ์‹ ์ฃผ์œ„์˜ ๊ด„ํ˜ธ๋Š” ์บก์ฒ˜ํ•˜๋ ค๋Š” ๊ฐ’์œผ๋กœ ๋‹ค๋ฅธ ๋ชจ๋“  ๊ฒƒ์„ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์„ ์บก์ฒ˜๋ง ๊ทธ๋ฃน์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.
  3. ?<Value>๋Š” ์บก์ฒ˜ ๊ทธ๋ฃน์— OpenPnP๊ฐ€ ๊ฒฐ๊ณผ๋ฅผ ์ฝ๋Š” ๋ฐ ์‚ฌ์šฉํ•  "Value"๋ผ๋Š” ์ด๋ฆ„์„ ๋ถ€์—ฌํ•ฉ๋‹ˆ๋‹ค. ์ด ํ…์ŠคํŠธ๋Š” ์ •๊ทœ์‹์˜ ์–ด๋”˜๊ฐ€์— ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ •ํ™•ํžˆ ?<Value>๋กœ ๋‚˜ํƒ€๋‚˜์•ผ ํ•˜๋ฉฐ ์ •๊ทœ์‹์˜ ๊ฐ’ ์ผ์น˜ ๋ถ€๋ถ„๋„ ํฌํ•จํ•˜๋Š” ๊ด„ํ˜ธ๋กœ ๋ฌถ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  4. -?๋Š” ๊ฐ’ ์•ž์— ์„ ํƒ์  ์Œ์ˆ˜ ๋ถ€ํ˜ธ๋ฅผ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค.
  5. \d+๋Š” ๊ฐ’ ์ž์ฒด๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ํ•˜๋‚˜ ์ด์ƒ์˜ ์ˆซ์ž๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.

POSITION_REPORT_REGEX

์ฐธ๊ณ : ๊ฐ€์žฅ ์ผ๋ฐ˜์ ์ธ ์ปจํŠธ๋กค๋Ÿฌ ํŽŒ์›จ์–ด์˜ ๊ฒฝ์šฐ OpenPnP๊ฐ€ ์ด ์ •๊ทœ์‹์„ ์ž๋™์œผ๋กœ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฌธ์ œ ๋ฐ ์†”๋ฃจ์…˜ ๋งˆ๋ฒ•์‚ฌ ์‹œ์Šคํ…œ์„ ์‚ฌ์šฉํ•˜์‹ญ์‹œ์˜ค.

์œ„์น˜ ๋ณด๊ณ ๋ฅผ ํŒŒ์‹ฑํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ํ”„๋กœ๊ทธ๋žจ ์™ธ๋ถ€์—์„œ ์ด๋™์ด ์ด๋ฃจ์–ด์กŒ์„ ๋•Œ OpenPnP์— ์—…๋ฐ์ดํŠธํ•˜๊ธฐ ์œ„ํ•ด ์ปจํŠธ๋กค๋Ÿฌ๊ฐ€ ์œ„์น˜ ๋ณด๊ณ ์„œ๋ฅผ ๋ณด๋‚ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ์ˆ˜๋™ ์กฐ๊ทธ ํŽœ๋˜ํŠธ์™€ ๊ฐ™์€ ์™ธ๋ถ€ ์กฐ๊ทธ๋ฅผ ์ง€์›ํ•˜๋Š” ์ปจํŠธ๋กค๋Ÿฌ์— ํŠนํžˆ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.

์ •๊ทœ์‹์€ ์—…๋ฐ์ดํŠธํ•˜๋ ค๋Š” ๊ฐ ์ถ•์— ๋Œ€ํ•ด ๋ช…๋ช…๋œ ๊ทธ๋ฃน์„ ํฌํ•จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ: <Idle,MPos:(?<x>-?\d+\.\d+),(?<y>-?\d+\.\d+),(?<z>-?\d+\.\d+),(?<rotation>-?\d+\.\d+)>

๊ธฐํƒ€

units

์ปจํŠธ๋กค๋Ÿฌ์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์ธก์ • ๋‹จ์œ„์ž…๋‹ˆ๋‹ค. ๋ฐ€๋ฆฌ๋ฏธํ„ฐ๊ฐ€ ๊ฐ€์žฅ ์ผ๋ฐ˜์ ์ด์ง€๋งŒ ๋ฏธํ„ฐ, ์„ผํ‹ฐ๋ฏธํ„ฐ, ๋ฏธํฌ๋ก , ํ”ผํŠธ, ์ธ์น˜ ๋ฐ ๋ฐ€๋„ ์ง€์›๋ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ moveTo ๋ช…๋ น์„ ๋ณด๋‚ด๊ธฐ ์ „์— ์œ„์น˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณ€ํ™˜ํ•˜๊ธฐ ์œ„ํ•ด ๋‚ด๋ถ€์ ์œผ๋กœ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.

max-feed-rate

move-to-command์—์„œ ์ „์†ก๋  ์ตœ๋Œ€ ์ด์†ก ์†๋„ ๊ฐ’์ž…๋‹ˆ๋‹ค. ์ „์†ก๋˜๋Š” ์‹ค์ œ ๊ฐ’์€ ์ด ๊ฐ’๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์Šต๋‹ˆ๋‹ค.

connect-wait-time-milliseconds

๋ช…๋ น์„ ๋ณด๋‚ด๊ธฐ ์ „์— ์ง๋ ฌ ํฌํŠธ์— ์—ฐ๊ฒฐํ•œ ํ›„ ๋Œ€๊ธฐํ•˜๋Š” ์‹œ๊ฐ„(๋ฐ€๋ฆฌ์ดˆ)์ž…๋‹ˆ๋‹ค. ์ด๋Š” ์—ฐ๊ฒฐ ์‹œ ์žฌ์„ค์ •๋˜๋Š” ์ปจํŠธ๋กค๋Ÿฌ๊ฐ€ ์žˆ๊ฑฐ๋‚˜ ์‘๋‹ต์„ ์‹œ์ž‘ํ•˜๋Š” ๋ฐ ๋ช‡ ์ดˆ๊ฐ€ ๊ฑธ๋ฆฌ๋Š” ๊ฒฝ์šฐ์— ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค.

backslash-escaped-characters

์ด์Šค์ผ€์ดํ”„ ๋ฌธ์ž ์‹œํ€€์Šค๋ฅผ ๋ช…๋ น์— ํฌํ•จํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋ ค๋ฉด ์ด ์˜ต์…˜์„ ํ™œ์„ฑํ™”ํ•˜์‹ญ์‹œ์˜ค. ์ด์Šค์ผ€์ดํ”„ ํ˜•์‹์€ ๋ฐฑ์Šฌ๋ž˜์‹œ U(๋Œ€๋ฌธ์ž ๋˜๋Š” ์†Œ๋ฌธ์ž)์™€ ์œ ๋‹ˆ์ฝ”๋“œ ๋ฌธ์ž๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์ •ํ™•ํžˆ 4๊ฐœ์˜ 16์ง„์ˆ˜ ๋ฌธ์ž(๋Œ€๋ฌธ์ž ๋˜๋Š” ์†Œ๋ฌธ์ž)๊ฐ€ ๋‚˜์˜ต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ctrl-x ๋ฌธ์ž(16์ง„์ˆ˜ 18)๋ฅผ ๋ณด๋‚ด๋ ค๋ฉด ๋ช…๋ น์— \u0018์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ ๋ฐ”๋กœ ๊ฐ€๊ธฐ ์ด์Šค์ผ€์ดํ”„ ์‹œํ€€์Šค๋„ ํ—ˆ์šฉ๋ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ctrl-x ๋ฌธ์ž(16์ง„์ˆ˜)๋ฅผ ๋ณด๋‚ด๋ ค๋ฉด ๋ช…๋ น์— \u0018์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฐ”๋กœ ๊ฐ€๊ธฐ ์ด์Šค์ผ€์ดํ”„ ์‹œํ€€์Šค๋„ ํ—ˆ์šฉ๋ฉ๋‹ˆ๋‹ค:

  • \b - backspace character, equivalent to \u0008
  • \f - form feed character, equivalent to \u000C
  • \n - line feed character, equivalent to \u000A
  • \r - carriage return character, equivalent to \u000D
  • \t - tab character, equivalent to \u0009

Dollar Command Wait Time

The TinyG controller is traditionally configured via the CONNECT_COMMAND using a series of $var=<value> statements. These might cause TinyG to write some settings back to the EEPROM (only if they're changed). During that EEPROM write, interrupts on the MCU have to be disabled therefore no further serial communication is allowed.

There is now a $-Command Wait Time [ms] that pauses sending for that many milliseconds after each command starting with a $ sign:

Driver Settings

Notes: The 50ms default was taken from the Liteplacer Software source code. See also the user discussion.

With Confirmation Flow Control enabled, this is always going to work, which is what Issues & Solutions automatically suggests for the TinyG.

With Confirmation Flow Control disabled (i.e. truly asynchronous operation), this is only guaranteed to work, if the $-commands come as the first thing inside the CONNECT_COMMAND, or if the controller is otherwise guaranteed to be idle before sending $-commands.

The wait time will now be added to any $-commands, regardless of whether it actually writes to the EEPROM or not. To check the effect, go to the Log tab (set to Trace level):

Log

Sub-Drivers

์ตœ์‹  ๋ฒ„์ „์˜ OpenPnP 2.0์—์„œ๋Š” ํ•˜์œ„ ๋“œ๋ผ์ด๋ฒ„๊ฐ€ ๋” ์ด์ƒ ์‚ฌ์šฉ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด์ œ ๋“œ๋ผ์ด๋ฒ„ ํŠธ๋ฆฌ ๋…ธ๋“œ์—์„œ ์ผ๋ฐ˜์ ์ธ [+] ๋ฒ„ํŠผ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ๋“  ์œ ํ˜•์˜ ์—ฌ๋Ÿฌ ๋“œ๋ผ์ด๋ฒ„๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Add new Driver

์ด์ „ ๋ฒ„์ „์˜ OpenPnP์˜ ๊ฒฝ์šฐ ๋‹ค์Œ ์ง€์นจ์„ ๋”ฐ๋ฅด์‹ญ์‹œ์˜ค.

Sub-Drivers allow you to interface multiple controllers by passing commands through. This can be used to control additional boards attached to your machine for functions such as feeders, actuators, conveyers, lighting, etc.

When a command is sent to the driver it is first processed by the main driver and then it is passed on to each defined sub-driver. If the main driver or any sub-driver does not define a handler for the command it is simply ignored.

For example, let's say you have your machine setup to use a Smoothieboard and you are using GcodeDriver to control it. You will have configured various commands such as the move-to-command, pick-command, place-command, etc.

Now perhaps you'd like to add an automatic feeder but don't have any I/O left on your Smoothieboard. You could add an Arduino connected by USB serial and control it with a sub-driver. On the sub-driver you would only define actuate-boolean-command.

Now when OpenPnP sends a movement command it will be processed by the main driver, which will move the machine. It will then be passed to the sub-driver, but since the sub-driver doesn't have a move-to-command it will be ignored. Then when OpenPnP wants to actuate your feeder it will send an actuate command. The main driver does not have actuate-boolean-command defined so it ignores it and passes it on to the sub-driver which processes it.

Using this system you can build up a series of controllers of any complexity that you like and control as many devices as you need.

Here is an example sub-drivers section of the main driver configuration:

<sub-drivers class="java.util.ArrayList">
   <reference-driver class="org.openpnp.machine.reference.driver.GcodeDriver" port-name="/dev/tty.usbmodem1A12421" baud="9600" flow-control="Off" data-bits="Eight" stop-bits="One" parity="None" set-dtr="false" set-rts="false" units="Millimeters" max-feed-rate="50000" timeout-milliseconds="5000" connect-wait-time-milliseconds="750">
      <command type="COMMAND_CONFIRM_REGEX">
         <text><![CDATA[^ok.*]]></text>
      </command>
      <command type="ACTUATE_DOUBLE_COMMAND">
         <text><![CDATA[{Index}]]></text>
      </command>
   </reference-driver>
</sub-drivers>

๊ตฌ๋™ ์ถ• ๋งคํ•‘

์ตœ์‹  ๋ฒ„์ „์˜ OpenPnP 2.0์˜ ๊ฒฝ์šฐ GUI์—์„œ ์ถ•์„ ์ง์ ‘ ๋งคํ•‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ตฌ๋™ ์ถ• ๋งคํ•‘ ํŽ˜์ด์ง€๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

์ด์ „ ๋ฒ„์ „์˜ OpenPnP์˜ ๊ฒฝ์šฐ ๋‹ค์Œ ์ง€์นจ์„ ๋”ฐ๋ฅด์‹ญ์‹œ์˜ค.

If your system has more than one nozzle you will need to tell OpenPnP which axes on your controller map to which nozzles, and other devices. Axis Mapping allows you to do this, along with specifying axes that should be ignored or included for a given head mounted device. This is an advanced option and will not be used by everyone. By default OpenPnP will create a basic axis mapping configuration that will work for a single nozzle, four axis system.

See GcodeDriver: Axis Mapping for the full documentation of this feature.

๋น„์ฅฌ์–ผ ํ˜ธ๋ฐ

์ตœ์‹  ๋ฒ„์ „์˜ OpenPnP 2.0์˜ ๊ฒฝ์šฐ GUI์—์„œ ์ง์ ‘ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋น„์ฅฌ์–ผ ํ˜ธ๋ฐ ํŽ˜์ด์ง€๋ฅผ ์ฐธ์กฐํ•˜์‹ญ์‹œ์˜ค.

์ด์ „ ๋ฒ„์ „์˜ OpenPnP์˜ ๊ฒฝ์šฐ ๋‹ค์Œ ์ง€์นจ์„ ๋”ฐ๋ฅด์‹ญ์‹œ์˜ค.

GcodeDriver supports the ability to complete the homing operation using a vision check. If there is a part defined in your Parts list called FIDUCIAL-HOME then after GcodeDriver completes the standard homing operation (using HOME_COMMAND) it will do a fiducial check for the FIDUCIAL-HOME part and reset the home coordinates.

To use visual homing:

  1. Create a Part called FIDUCIAL-HOME. The Part should follow the same rules are used for setting up Fiducials.
  2. Set the GcodeDriver POST_VISION_HOME_COMMAND as as described in the Reference. This command is sent after visual homing is complete and will reset the coordinates to the home coordinates.
  3. Set up your machine so that when mechanical homing is complete the fiducial is visible to the camera.
  4. When mechanical homing is complete, GcodeDriver will look for the fiducial, center on it and then reset the X and Y coordinates to the home coordinates.

If your homing fiducial is in a different location than the camera can see after homing you can change the location that is searched by adding <homing-fiducial-location units="Millimeters" x="0.0" y="0.0" z="0.0" rotation="0.0"/> to your driver in machine.xml. Also you will need to add a G0 X Y command (fiducial X, Y coordinates) at the end of your HOME_COMMAND so after homing the machine moves to the approximate homing fiducial location.

๋ฐฑ๋ž˜์‹œ ๋ณด์ƒ

์ตœ์‹  ๋ฒ„์ „์˜ OpenPnP 2.0์˜ ๊ฒฝ์šฐ GUI์—์„œ ์ง์ ‘ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฐฑ๋ž˜์‹œ ๋ณด์ƒ ํŽ˜์ด์ง€๋ฅผ ์ฐธ์กฐํ•˜์‹ญ์‹œ์˜ค. ์•„๋ž˜์— ์„ค๋ช…๋œ ํŠน์ˆ˜ Gcode ๊ตฌ์„ฑ์€ ๋” ์ด์ƒ ํ•„์š”ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์ด์ „ ๋ฒ„์ „์˜ OpenPnP์˜ ๊ฒฝ์šฐ ๋‹ค์Œ ์ง€์นจ์„ ๋”ฐ๋ฅด์‹ญ์‹œ์˜ค.

The GcodeDriver includes basic basic backlash compensation; also known as slack compensation. When enabled, the machine will always overshoot the target position and then move back to the target at a slower rate. This has been found to resolve issues with improperly tensioned belts and other sources of backlash.

To enable backlash compensation, there are two steps:

  1. In the GcodeDriver configuration, set the backlash offset X and Y to a small value that you think is greater than your backlash. Starting with -0.4mm is a good choice. Also set the backlash feed rate factor to 0.1. The max feed rate is multiplied by this value for the backlash move, so using 0.1 will move the head at 10% of it's normal speed for the final position approach.
  2. In the GcodeDriver Gcode configuration, change your move to command to look something like:
G0 {BacklashOffsetX:X%.4f} {BacklashOffsetY:Y%.4f} {Z:Z%.4f} {Rotation:A%.4f} F{FeedRate:%.0f}
G1 {X:X%.4f} {Y:Y%.4f} {Z:Z%.4f} {Rotation:A%.4f} F{BacklashFeedRate:%.0f}

The way this works is that the first command moves past the target position by the backlash offset amount at the normal feed rate. The second command then moves to the final position at the backlash feedrate, which will be slower.

More information about this feature can be found in https://github.com/openpnp/openpnp/issues/318.

๋น„ ์ง๊ฐ์„ฑ ๋ณด์ •

์ตœ์‹  ๋ฒ„์ „์˜ OpenPnP 2.0์˜ ๊ฒฝ์šฐ ์ด์ œ ์„ ํ˜• ์ถ• ๋ณ€ํ™˜์— ์˜ํ•ด ๋ณด๋‹ค ๋ณดํŽธ์ ์œผ๋กœ ์ฒ˜๋ฆฌ๋ฉ๋‹ˆ๋‹ค. Linear Transformed Axes ํŽ˜์ด์ง€์˜ ๋น„ ์ง๊ฐ์„ฑ ๋ณด์ƒ ์‚ฌ์šฉ ์‚ฌ๋ก€ ์„น์…˜์„ ์ฐธ์กฐํ•˜์„ธ์š”.

์ด์ „ ๋ฒ„์ „์˜ OpenPnP์˜ ๊ฒฝ์šฐ ๋‹ค์Œ ์ง€์นจ์„ ๋”ฐ๋ฅด์‹ญ์‹œ์˜ค.

No matter how well you planned your pnp machine and how well you assembled it chances are that the X and Y moving axes are not 100% perpendicular to each other. A very small 0.1ยฐ alignment error will already result in a physical offset of 0.52mm (already a bit more than the width of one 0402 component) when the head travels 300mm.

The GCodeDriver can compensate such non squareness with a "Non-Squareness Factor". This factor basically tells the ratio between X offset and Y movement distance.

Measurement method:

  1. Make sure the current Non-Squareness Factor in the GcodeDriver settings panel is zero.
  2. Put a piece of graph paper with fine grid into your PnP machine.
  3. Align the grid with the X-Axis by moving the camera left and right until a reference grid line matches the motion path exactly.
  4. Move the camera into Y direction along a grid line by a defined distance (the further you move the more precise the measurement will be). 100mm is a good start.
  5. You will probably find that the camera has not traced the Y line exactly and now it is offset from the center of the camera. Click the DRO and use the relative coordinates to measure the offset from the line.
  6. Use the formula in the image above to calculate the Non-Squareness Factor. Positive factors mean a machine leaning left, negatives ones leaning right.
  7. Enter the Non-Squareness Factor into the GcodeDriver settings panel and apply.
  8. Repeat steps 3 to 5. This time there should be no offset. If the offset is even greater try inverting the sign of the Non-Squareness Factor.

๋ฌธ์ œ ํ•ด๊ฒฐ

์นด๋ฉ”๋ผ๊ฐ€ ์›€์ง์ผ ๋•Œ ๋…ธ์ฆ์ด ์›€์ง์ด๊ฑฐ๋‚˜ ํšŒ์ „ํ•จ

์นด๋ฉ”๋ผ๊ฐ€ ์ด๋™ ๋ช…๋ น์„ ๋ฐ›์€๊ฒฝ์šฐ ๋…ธ์ฆ์ด ์›€์ง์ด๋Š” ๊ฒฝ์šฐ(ํŠนํžˆ Z๋ฐฉํ–ฅ), Z์ถ•์— ์นด๋ฉ”๋ผ๊ฐ€ ํฌํ•จ๋˜์ง€ ์•Š๋„๋ก G์ฝ”๋“œ ๋“œ๋ผ์ด๋ฒ„_๊ตฌ๋™์ถ• ๋งคํ•‘์„ ์„ค์ •ํ•˜์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด ์ž‘์—…์€ "*" ๋Œ€์‹  Z์ถ•์— ๋…ธ์ฆ ID๋งŒ ์ง€์ •ํ•˜์—ฌ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ G์ฝ”๋“œ ๋“œ๋ผ์ด๋ฒ„_๊ตฌ๋™์ถ• ๋งคํ•‘์„ ์ฐธ์กฐํ•˜์„ธ์š”. ๋˜ํ•œ ์ด๊ฒƒ์€ ์นด๋ฉ”๋ผ๊ฐ€ ํšŒ์ „ํ•˜๋„๋ก ๋ช…๋ น์„ ๋ฐ›๊ณ  ๋…ธ์ฆ๋„ ํšŒ์ „ํ•˜๋Š” ๊ฒฝ์šฐ x,y,z์ถ•์—์„œ ์ œํ•œ๋œ ์ด๋™ ์†๋„๋ฅผ ํ•ด๊ฒฐํ•ฉ๋‹ˆ๋‹ค(๋‹ค์†Œ ๋Š๋ฆฌ๊ฒŒ).

โš ๏ธ **GitHub.com Fallback** โš ๏ธ