Robonix skill for declarative scene drawing, prompt-to-image drawing,
debug previews, and traced image drawing. It owns
robonix/skill/draw/* and turns JSON scenes, generated PNGs, or existing
images into pen-up/down waypoints for the plotter primitive.
The skill never talks TCP or PLC. It resolves the plotter primitive through
Atlas.
Every trajectory tool validates the complete plan before moving.
Out-of-workspace points, an empty plan, or more than max_points waypoints
return success=false with no motion. dry_run=true returns counts and
bounds without moving.
Drawing policy
Call config before planning a drawing request. It exposes the runtime
switches that the planner cannot otherwise see:
Flag
Meaning
debug
render_preview is enabled, and a non-dry-run scene writes output_dir/last_preview.png before moving
imagegen_enabled
prompt is enabled in config
imagegen_ready
prompt is enabled and has a base URL and model
home_before_draw
draw tools run the primitive HOME routine before the trajectory
preview_name
fixed preview filename (last_preview.png)
Routing:
Request
Path
Structured/geometric (shapes, coordinates, JSON)
plotter_home → render_preview (only if debug=true) → scene
Free-form/illustrative and imagegen_ready=true
plotter_home → prompt; on failure, author a simple declarative scene and continue with scene
Pass skip_home=true after plotter_home and skip_preview=true after
render_preview. The skill still enforces home/preview when the flags are
missing, so the plan remains advisory rather than a hard requirement.
Preview failures are warnings and never block drawing.
scene
The primary tool for structured drawings. The scene is never rasterised for
plotting and is never contour-traced: every stroke/shape becomes exactly one
pen-down polyline, so a line is drawn once and circles/arcs keep their
analytic geometry. width_mm is ignored for plotting because the pen tip
defines the line width.
Canvas coordinates are millimetres; origin at the lower-left, +X right,
+Y up. offset_x / offset_y translate the canvas inside the workspace.
strokes are drawn first, then shapes, in list order; each may set
closed.
Only line art: no fills, colours, gradients, or text.
width_mm / height_mm default to the config and must fit the workspace.
dry_run=true never homes and never writes a preview.
Unless skip_home=true, HOME runs before the trajectory;
home_before_draw: false disables it globally. auto_home homes again
after a successful draw.
With debug=true, a non-dry-run draw also renders the same scene to
output_dir/last_preview.png before moving, unless skip_preview=true.
Preview failures are reported in message and never block drawing.
Scene size is bounded by max_points, generate_max_strokes, and
generate_max_points.
render_preview
Renders the same JSON scene to a black-on-white line-art PNG.
Enabled only when the config has debug: true. With debug: false it
returns success=false and writes nothing.
An empty output_name selects the fixed slot last_preview.png and
overwrites it; an explicit name keeps the normal overwrite rules.
The PNG is written only inside output_dir and carries orientation/scale
metadata that image understands.
scene writes the same last_preview.png automatically when
debug=true, so this tool is optional. Call it first when the preview
must exist before the draw is planned, then pass skip_preview=true.
It does not move the machine, so there is no dry_run; validation is the
same as for scene.
prompt
Generates an image from a text prompt and draws it. This is the preferred
path for free-form/illustrative requests when imagegen_ready=true; use
scene when the request specifies exact geometry or JSON.
prompt
→ POST {imagegen_base_url}/images/generations (OpenAI-compatible)
→ decode b64_json or download the returned URL
→ normalise to RGB PNG, write it into output_dir
→ image(trace=lineart) → waypoints → primitive
Disabled by default. Requires imagegen_enabled: true, a non-empty
imagegen_base_url, and a model. Disabled or misconfigured calls return
success=false without any network request. Check imagegen_ready first.
Every successful generation writes the PNG into output_dirbefore
tracing. If tracing or drawing later fails, the file remains.
trace defaults to lineart; skeleton and outline can be requested.
Generated PNGs are tagged screen-upright and drawn that way by default;
flip=true selects the raw paper-raster direction (vertically mirrored).
dry_run=true still generates the PNG and plans waypoints, but does not
move the machine.
On failure, fall back to scene with a simple scene authored from the
request; do not retry the same prompt.
HOME runs before the trajectory unless skip_home=true; auto_home homes
after a successful draw.
imagegen_prompt_suffix appends style words to every prompt, for example
"high contrast, clean white background, black line art, no text".
This is a separate text-to-image service, not the Pilot’s VLM. The VLM can
read images but cannot generate them.
image
Traces a PNG/JPEG/BMP/WebP file inside the allowed roots and draws it.
image
→ path validation (image_dir / output_dir only)
→ grayscale → binarise (Otsu, explicit threshold, or DoG for lineart)
→ trace according to `trace`
→ fit_to_paper (aspect-preserving) or explicit scale + offset
→ absolute (x, y, z) waypoints
→ plan validation → trajectory
trace
Algorithm
Best for
outline
Marching squares on the ink boundary, then Douglas-Peucker
silhouettes and filled shapes; line art becomes two parallel sides
skeleton
Zhang-Suen thinning to the ink centreline, then Douglas-Peucker
line art, logos, handwriting; one pen stroke per line
lineart
Difference-of-Gaussians edges with a hysteresis threshold, then thinning
photos and grey artwork; produces line art instead of filled blobs
"" / auto
skeleton for PNGs with Robonix metadata, otherwise outline
backward-compatible default; never auto-selects lineart
lineart sensitivity is controlled by trace_lineart_sigma and
trace_lineart_detail (strong threshold = mean + detail × standard
deviation; lower keeps more edges). trace_spur_px removes short spurs,
trace_min_length_mm drops short isolated polylines, and trace_bridge_px
joins nearby endpoints into one stroke. If output is dashed, raise
trace_bridge_px (3 → 6) or lower trace_lineart_detail.
Unless skip_home=true, HOME runs before the trajectory. auto_home homes
after a successful draw. dry_run=true validates and plans without moving.
Prefer scene for scenes. render_preview → image still pays for
rasterisation and thinning even though trace=auto selects skeleton.
list_images
Lists drawable files directly under image_dir and output_dir (not
recursive), optionally filtered by a filename substring. Use it before
image instead of guessing paths.
config
Read-only. Returns the policy flags above plus image_dir, output_dir,
preview_name, and home_before_draw. It never moves the machine and never
writes files.
File roots and path policy
image_dir defaults to images/ under the deployment root;
output_dir defaults to the same directory.
Both are read roots. output_dir is the only write root: previews and
generated images are written there.
Relative paths resolve against ROBONIX_WORKSPACE when set, otherwise the
deployment root (the directory containing packages/).
Absolute paths are accepted only when they resolve inside a read root.
.., symlink escapes, unknown suffixes, and missing files are rejected.
list_images lists direct children only.
Orientation and scale
image does not understand image content; it traces pixels.
Input
Default behavior
PNG produced by render_preview / scene
robonix_orientation=screen; drawn upright at the stored millimetre scale; trace=auto selects skeleton
Third-party PNG, no metadata
drawn screen-upright (as displayed), auto-fitted to paper
Third-party PNG, with metadata
metadata orientation and scale are honoured
orientation values:
"" / "auto": metadata first; otherwise screen-upright and auto-fit.
"screen": force screen-upright (flip_y=true).
"paper": force the raw raster mapping (flip_y=false).
scale values:
< 0: force auto-fit, ignoring metadata scale.
= 0: use metadata scale when present, otherwise auto-fit.
> 0: explicit millimetres per pixel; offset_x / offset_y become the
placement origin in millimetres.
flip_x always works independently. flip_y mirrors the screen orientation
only in orientation=auto on a file without metadata. Rotation is not a
parameter: rotate the file beforehand.
Preview PNG tEXt metadata:
Key
Meaning
robonix_orientation
screen (currently always)
robonix_pixel_to_mm
millimetres per pixel
robonix_width_mm / robonix_height_mm
canvas size
robonix_offset_x_mm / robonix_offset_y_mm
canvas offset in the workspace
Boot ordering
This skill must come afterprimitive-hdu-cartesian-plotter-rbnx in the deployment
manifest. Activation resolves robonix/primitive/plotter/{trajectory,home};
if they are missing it returns Deferred and retries on the next MCP call.
Driver-init lifecycle
scripts/start.sh execs python3 -m draw.main.
CMD_INIT: parse and validate config, image roots, and preview settings;
no primitive connection.
CMD_ACTIVATE: resolve the two primitive contracts through Atlas.
CMD_DEACTIVATE / CMD_SHUTDOWN: close the gRPC channels.
The mirrored capabilities/primitive/plotter/* files exist only so
rbnx codegen --mcp emits the stubs this skill calls. They are not
listed in package_manifest.yaml, so Atlas does not treat the skill as a
provider.
Config
Deployment config lives in the draw skill config block of
robonix_manifest.yaml. Full defaults and
constraints are in config.spec.
# Drawable area and pen heights are NOT configured here. They are read
# from the primitive's `geometry` contract on activation, so this skill
# carries no machine-specific numbers and works on any sized rig.
image_dir: images # read root (deployment-root relative)
output_dir: "" # empty -> same as image_dir; the only write root
debug: fasle # checked-in deployment value; config.spec default false
home_before_draw: true # HOME before a trajectory
auto_home: true # HOME after a successful draw
imagegen_enabled: false
imagegen_base_url: "" # OpenAI-compatible, e.g. http://127.0.0.1:8000/v1
imagegen_model: ""
imagegen_api_key: "" # or IMAGE_GEN_API_KEY / OPENAI_API_KEY
imagegen_size: "1024x768"
imagegen_timeout_s: 120.0
imagegen_prompt_suffix: ""
trace: auto # auto / outline / skeleton / lineart
simplify_px: 1.5
image_margin_mm: 5.0
image_fill: 0.8
trace_lineart_sigma: 1.2
trace_lineart_detail: 1.0
trace_spur_px: 2.0
trace_min_length_mm: 1.0
trace_bridge_px: 3.0
generate_pixel_to_mm: 0.25
generate_line_width_mm: 0.5
generate_supersample: 2
max_points: 50000
Per-call MCP fields override the config; 0 / negative sentinels are
documented in each .srv. Speed, acceleration, deceleration, and jerk remain
global primitive parameters (plotter_set_params) and are never modified by
this skill.
Build / run standalone
The deployment shares one uv environment at the repository root; this package
does not carry its own requirements.txt.
Tests cover path policy, scene validation, preview naming, PNG metadata,
orientation/scale mapping, direct-scene waypoints, skeleton/lineart tracing,
the image-generation client, and trajectory validation. They need neither the
Robonix runtime nor a PLC. End-to-end checks need the primitive, a real PLC,
and — for prompt — a reachable image service.
skill-draw-rbnx
Robonix skill for declarative scene drawing, prompt-to-image drawing, debug previews, and traced image drawing. It owns
robonix/skill/draw/*and turns JSON scenes, generated PNGs, or existing images into pen-up/down waypoints for the plotter primitive.The skill never talks TCP or PLC. It resolves the plotter primitive through Atlas.
Capability surface
robonix/skill/draw/driverDriver(CMD_INIT, config_json)— lifecycle gaterobonix/skill/draw/configconfig() → debug, imagegen_enabled, imagegen_ready, output_dir, preview_name, home_before_draw; read-onlyrobonix/skill/draw/scenescene(spec, offset_x, offset_y, dry_run, auto_home, skip_home, skip_preview, workspace)robonix/skill/draw/promptprompt(prompt, output_name, overwrite, trace, size, flip, dry_run, auto_home, skip_home, workspace)robonix/skill/draw/render_previewrender_preview(spec, output_name, overwrite, pixel_to_mm, line_width_mm, supersample)robonix/skill/draw/imagedraw_image(image_path, orientation, trace, scale, offsets, thresholds, dry_run, auto_home, skip_home, workspace)robonix/skill/draw/list_imageslist_images(filter)Every trajectory tool validates the complete plan before moving. Out-of-workspace points, an empty plan, or more than
max_pointswaypoints returnsuccess=falsewith no motion.dry_run=truereturns counts and bounds without moving.Drawing policy
Call
configbefore planning a drawing request. It exposes the runtime switches that the planner cannot otherwise see:debugrender_previewis enabled, and a non-dry-runscenewritesoutput_dir/last_preview.pngbefore movingimagegen_enabledpromptis enabled in configimagegen_readypromptis enabled and has a base URL and modelhome_before_drawpreview_namelast_preview.png)Routing:
plotter_home→render_preview(only ifdebug=true) →sceneimagegen_ready=trueplotter_home→prompt; on failure, author a simple declarative scene and continue withscenePass
skip_home=trueafterplotter_homeandskip_preview=trueafterrender_preview. The skill still enforces home/preview when the flags are missing, so the plan remains advisory rather than a hard requirement. Preview failures are warnings and never block drawing.sceneThe primary tool for structured drawings. The scene is never rasterised for plotting and is never contour-traced: every stroke/shape becomes exactly one pen-down polyline, so a line is drawn once and circles/arcs keep their analytic geometry.
width_mmis ignored for plotting because the pen tip defines the line width.offset_x/offset_ytranslate the canvas inside the workspace.strokesare drawn first, thenshapes, in list order; each may setclosed.width_mm/height_mmdefault to the config and must fit the workspace.dry_run=truenever homes and never writes a preview.skip_home=true, HOME runs before the trajectory;home_before_draw: falsedisables it globally.auto_homehomes again after a successful draw.debug=true, a non-dry-run draw also renders the same scene tooutput_dir/last_preview.pngbefore moving, unlessskip_preview=true. Preview failures are reported inmessageand never block drawing.max_points,generate_max_strokes, andgenerate_max_points.render_previewRenders the same JSON scene to a black-on-white line-art PNG.
debug: true. Withdebug: falseit returnssuccess=falseand writes nothing.output_nameselects the fixed slotlast_preview.pngand overwrites it; an explicit name keeps the normaloverwriterules.output_dirand carries orientation/scale metadata thatimageunderstands.scenewrites the samelast_preview.pngautomatically whendebug=true, so this tool is optional. Call it first when the preview must exist before the draw is planned, then passskip_preview=true.dry_run; validation is the same as forscene.promptGenerates an image from a text prompt and draws it. This is the preferred path for free-form/illustrative requests when
imagegen_ready=true; usescenewhen the request specifies exact geometry or JSON.imagegen_enabled: true, a non-emptyimagegen_base_url, and a model. Disabled or misconfigured calls returnsuccess=falsewithout any network request. Checkimagegen_readyfirst.output_dirbefore tracing. If tracing or drawing later fails, the file remains.tracedefaults tolineart;skeletonandoutlinecan be requested.flip=trueselects the raw paper-raster direction (vertically mirrored).dry_run=truestill generates the PNG and plans waypoints, but does not move the machine.scenewith a simple scene authored from the request; do not retry the same prompt.skip_home=true;auto_homehomes after a successful draw.imagegen_prompt_suffixappends style words to every prompt, for example"high contrast, clean white background, black line art, no text".This is a separate text-to-image service, not the Pilot’s VLM. The VLM can read images but cannot generate them.
imageTraces a PNG/JPEG/BMP/WebP file inside the allowed roots and draws it.
traceoutlineskeletonlineart""/autoskeletonfor PNGs with Robonix metadata, otherwiseoutlinelineartlineartsensitivity is controlled bytrace_lineart_sigmaandtrace_lineart_detail(strong threshold = mean + detail × standard deviation; lower keeps more edges).trace_spur_pxremoves short spurs,trace_min_length_mmdrops short isolated polylines, andtrace_bridge_pxjoins nearby endpoints into one stroke. If output is dashed, raisetrace_bridge_px(3 → 6) or lowertrace_lineart_detail.Unless
skip_home=true, HOME runs before the trajectory.auto_homehomes after a successful draw.dry_run=truevalidates and plans without moving.Prefer
scenefor scenes.render_preview → imagestill pays for rasterisation and thinning even thoughtrace=autoselectsskeleton.list_imagesLists drawable files directly under
image_dirandoutput_dir(not recursive), optionally filtered by a filename substring. Use it beforeimageinstead of guessing paths.configRead-only. Returns the policy flags above plus
image_dir,output_dir,preview_name, andhome_before_draw. It never moves the machine and never writes files.File roots and path policy
image_dirdefaults toimages/under the deployment root;output_dirdefaults to the same directory.output_diris the only write root: previews and generated images are written there.ROBONIX_WORKSPACEwhen set, otherwise the deployment root (the directory containingpackages/)..., symlink escapes, unknown suffixes, and missing files are rejected.list_imageslists direct children only.Orientation and scale
imagedoes not understand image content; it traces pixels.render_preview/scenerobonix_orientation=screen; drawn upright at the stored millimetre scale;trace=autoselectsskeletonorientationvalues:""/"auto": metadata first; otherwise screen-upright and auto-fit."screen": force screen-upright (flip_y=true)."paper": force the raw raster mapping (flip_y=false).scalevalues:< 0: force auto-fit, ignoring metadata scale.= 0: use metadata scale when present, otherwise auto-fit.> 0: explicit millimetres per pixel;offset_x/offset_ybecome the placement origin in millimetres.flip_xalways works independently.flip_ymirrors the screen orientation only inorientation=autoon a file without metadata. Rotation is not a parameter: rotate the file beforehand.Preview PNG
tEXtmetadata:robonix_orientationscreen(currently always)robonix_pixel_to_mmrobonix_width_mm/robonix_height_mmrobonix_offset_x_mm/robonix_offset_y_mmBoot ordering
This skill must come after
primitive-hdu-cartesian-plotter-rbnxin the deployment manifest. Activation resolvesrobonix/primitive/plotter/{trajectory,home}; if they are missing it returnsDeferredand retries on the next MCP call.Driver-init lifecycle
scripts/start.shexecspython3 -m draw.main.CMD_INIT: parse and validate config, image roots, and preview settings; no primitive connection.CMD_ACTIVATE: resolve the two primitive contracts through Atlas.CMD_DEACTIVATE/CMD_SHUTDOWN: close the gRPC channels.Layout
The mirrored
capabilities/primitive/plotter/*files exist only sorbnx codegen --mcpemits the stubs this skill calls. They are not listed inpackage_manifest.yaml, so Atlas does not treat the skill as a provider.Config
Deployment config lives in the
drawskillconfigblock ofrobonix_manifest.yaml. Full defaults and constraints are inconfig.spec.Per-call MCP fields override the config;
0/ negative sentinels are documented in each.srv. Speed, acceleration, deceleration, and jerk remain global primitive parameters (plotter_set_params) and are never modified by this skill.Build / run standalone
The deployment shares one uv environment at the repository root; this package does not carry its own
requirements.txt.rbnx bootlaunches the skill from the manifest. To run it manually:Tests cover path policy, scene validation, preview naming, PNG metadata, orientation/scale mapping, direct-scene waypoints, skeleton/lineart tracing, the image-generation client, and trajectory validation. They need neither the Robonix runtime nor a PLC. End-to-end checks need the primitive, a real PLC, and — for
prompt— a reachable image service.Verification
Suggested checks, in order:
scenewithdry_run=true— point count and bounds, no motion.render_previewwithdebug=true—images/last_preview.pngexists.sceneof a small shape —last_preview.pngis rewritten before motion whendebug=true.list_images— confirms the filenames visible toimage.imagewithdry_run=true, then trace a small file for real.Known limits
skill-write_text-rbnxfor text.sceneignoreswidth_mmfor plotting; the physical pen defines the stroke width.outlinetraces the ink boundary, so line art becomes two parallel sides.lineartextracts edges; it does not reproduce shading or greyscale.skeletonon filled regions produces a centreline, not the filled shape.promptdepends on an external image service and never uses the VLM for generation.License
MIT. See LICENSE.