scaralang

Python toolchain and compiler for the SCARA Robotics


Project maintained by vroncevic Hosted on GitHub Pages — Theme by mattgraham

SCARA Domain-Specific Language (DSL) Specification & Reference Manual

Version: 1.1.1
Target: Industrial SCARA Robotic Manipulators
Toolchain: scaralang (scarac compiler, decompiler & binary protocol engine)
Author: Vladimir Roncevic
License: GPL-3.0 / Apache-2.0


Table of Contents

  1. Introduction
  2. Lexical Structure & Syntax
  3. Language Instructions Reference
  4. Static Analysis & Linter Rules
  5. Examples Directory & Verification Artifacts
  6. Complete Industrial Example Scripts

1. Introduction

The SCARA Domain-Specific Language (DSL) is a high-level, human-readable robotic programming language designed specifically for Selective Compliance Assembly Robot Arm (SCARA) 4-axis manipulators ($X, Y, Z, \Phi$).

Unlike generic CNC G-code, SCARA DSL is natively aware of:


2. Lexical Structure & Syntax

2.1 Line-Oriented Statements

A .scara program consists of sequence lines. Each line contains at most one statement. A statement starts with a command keyword, followed by optional or required parameters:

MOVE_L X 150.0 Y 45.0 Z 20.0
PUMP ON
WAIT 150

2.2 Case Insensitivity

All command keywords and parameter identifiers are case-insensitive:

MOVE_L X 100.0 Y 50.0 Z 10.0
move_l x 100.0 y 50.0 z 10.0
Move_L X 100.0 Y 50.0 Z 10.0

All three variants produce identical AST nodes and binary instructions.

2.3 Parameter Passing Styles

Parameters may be passed either using whitespace separation (KEY VALUE) or explicit assignment (KEY=VALUE):

# Whitespace style
MOVE_L X 150.0 Y 75.0 Z 20.0 P 45.0

# Assignment style
MOVE_L X=150.0 Y=75.0 Z=20.0 P=45.0

# Mixed style (fully supported)
JUMP X 150.0 Y=75.0 Z 20.0 ARCH=35.0

2.4 Comments and Whitespace

2.5 Coordinate System & Standard Units

Dimension Axis Unit Description
Linear Coordinates X, Y, Z Millimeters (mm) Absolute or frame-relative Cartesian position.
Tool Orientation P / PHI Degrees (°) 4th-axis end-effector yaw rotation ($\pm 180^\circ$).
Arc Center Offsets I, J Millimeters (mm) Incremental vector offset from starting point to arc center.
Feedrate SPEED mm/s Tool center point (TCP) linear speed.
Acceleration ACCEL mm/s² Linear path acceleration and deceleration.
Time Delay WAIT / WAIT_MS Milliseconds (ms) Hardware execution dwell.
Joint Angles deg Degrees (°) Joint 1, Joint 2 arm angles, Joint 4 yaw.

3. Language Instructions Reference

Category 1: Cartesian & Joint Motion


MOVE_J

Rapid Joint Point-to-Point Motion

Moves the robot arm to the target Cartesian coordinates using non-interpolated joint motion. Both arm joints articulate simultaneously at maximum speed without enforcing a straight-line Cartesian path. Best used for clearance travel and rapid repositioning.


MOVE_L

Linear Cartesian Interpolated Motion

Executes a linear, straight-line trajectory from the current position to the destination coordinates at the currently active working feedrate (SPEED WORK).


MOVE_REL

Relative Cartesian Incremental Motion

Executes an incremental straight-line Cartesian motion relative to the current tool pose. Incremental offsets ($\Delta X, \Delta Y, \Delta Z, \Delta \Phi$) are applied in the currently active coordinate work frame.


ARC_CW

Clockwise Circular Arc Interpolation

Interpolates a circular arc in the XY plane in a clockwise direction. The arc begins at the current robot position and terminates at (X, Y). The circle center is defined relative to the starting position via I (X offset) and J (Y offset).


ARC_CCW

Counter-Clockwise Circular Arc Interpolation

Interpolates a circular arc in the XY plane in a counter-clockwise direction from the current position to (X, Y) around the center offset (I, J).


APPROACH

Relative Vertical Descent

Performs a relative vertical descent along the negative Z axis from the current position by the specified clearance distance. Used to move down safely from clearance plane to pickup or placement plane.


RETRACT

Relative Vertical Ascent

Performs a relative vertical ascent along the positive Z axis from the current position by the specified clearance distance. Used to lift the tool up safely away from workpiece and fixtures before horizontal moves.


JOG_AXIS

Manual Incremental Cartesian Jog

Commands a single-axis relative jog displacement along a chosen Cartesian degree of freedom. Used primarily in manual setup, calibration, and REPL control.


JOG_JOINT

Manual Incremental Joint Jog

Rotates an individual robotic actuator joint by a relative angle.


PROBE

Tactile Surface Search

Drives the Z-axis downwards at a controlled speed until a tactile touch probe or microswitch sensor triggers. Upon contact, the current coordinate is registered, motion halts cleanly, and subsequent commands proceed from the probed plane.


Category 2: High-Level Macros, Subroutines & Spatial Zones


JUMP

3D Parabolic Arch Pick & Place

The quintessential robotic pick-and-place command. Expands into a smooth, time-optimal 3D motion consisting of:

  1. Smooth vertical lift-off along Z to apex height ARCH.
  2. High-speed horizontal transfer in XY plane.
  3. Smooth vertical descent to destination (X, Y, Z).

Eliminates discrete corner stops and optimizes cycle times.


PALLET_DEF

Matrix Pallet Grid Definition

Defines a structured 2D Cartesian pallet matrix of components or trays. Establishes the grid layout with row count, column count, and pitch offsets between cells.


MOVE_PALLET

Pallet Index Positioning

Moves the robot to the specified 1-indexed cell within a previously defined pallet matrix. Automatically computes the Cartesian coordinates based on row and column index.


DEF / END

User-Defined Subroutine Definition

Declares a reusable, parameterized routine block consisting of high-level SCARA instructions. The routine is registered into the AST symbol table and expanded inline upon invocation with nested block support.


CALL

Subroutine Invocation

Invokes a previously declared user subroutine by name. Expands into the defined sequence of instructions during the macro compilation phase.


REPEAT / END

Fixed-Count Iteration Loop

Executes an enclosed block of SCARA instructions for a specified number of repetitions. Loops can be nested and support incremental relative motions, pallet advances, and sensor sampling.


ZONE_DEF

User-Defined Spatial Keep-Out Zone

Declares a geometric forbidden keep-out obstacle zone (rectangular bounding box or 2D circular boundary) in the robot’s Cartesian workspace. During compilation and linting, the static obstacle collision checker verifies all trajectory segments (linear, joint, and circular arcs) against declared zones, reporting OBSTACLE_COLLISION errors before hardware transmission.


Category 3: Actuator & Tool Control


PUMP

Vacuum Generator Actuation

Controls the vacuum suction generator pump for end-effector pneumatic pick-and-place grippers.


VALVE

Vacuum Blow-Off Release Valve

Actuates the pneumatic release blow-off valve to exhaust vacuum pressure and instantaneously release gripped parts.


TOOL

Vertical Slide Stage Actuation

Controls a secondary high-speed pneumatic or motorized vertical slide stage mounted on the tool head.


TOOL_ORIENT

End-Effector Orientation Mode

Configures the 4th-axis tool yaw tracking behavior during multi-axis path execution.


Category 4: Dynamics & Trajectory Shaping


SPEED

Travel and Working Feedrate Limit

Sets the maximum Cartesian linear velocity for subsequent motion segments. Supports separate definitions for rapid positioning (RAPID) and working contact travel (WORK).


ACCEL

Path Acceleration Limit

Configures the maximum linear path acceleration and deceleration for trajectory planning.


OVERRIDE

Dynamic Real-Time Speed Override

Applies a dynamic global percentage scaling factor to all path feedrates without modifying programmed velocity coordinates.


ZONE

Corner Path Blending & Rounding Mode

Controls corner rounding and trajectory continuous path blending between adjacent motion segments.


Category 5: Work Coordinates & Kinematic Configuration


CONFIG ELBOW

Kinematic Arm Solution Branch

Specifies the inverse kinematics arm solution configuration. For any SCARA Cartesian coordinate within the workspace, two valid joint angles exist: Elbow Left or Elbow Right.


CONFIG MOTOR

Stepper Drive Feedback Mode

Selects the actuation drive mode of the robot joint steppers.


FRAME_SET / FRAME

Work Coordinate System (WCS)

Defines a local User Coordinate System offset from the robot base. All subsequent motion coordinates are interpreted relative to this frame.


FRAME_RESET

Reset Coordinate System to World Base

Clears all active work coordinate transformations, restoring the global robot base origin as the reference coordinate frame.


HOME

Multi-Axis Calibration & Homing Routine

Executes the hardware reference homing sequence for all axes (Joint 1, Joint 2, Z-axis, Tool yaw). Synchronizes stepper motor step counters with optical physical limit switches.


Category 6: Execution Flow & Safety


WAIT / WAIT_MS

Trajectory Dwell Delay

Pauses program execution for a specified duration in milliseconds. Used to allow pneumatic pressures to equalize, mechanical vibrations to dampen, or peripheral automation to index.


SYNC

Trajectory Buffer Barrier Flush

Inserts an execution barrier that blocks further command execution until the robot controller’s motion buffer completely drains and all axes come to a complete physical standstill.


HOLD

Trajectory Feed Hold (Pause)

Commands a controlled deceleration and immediate suspension of the running trajectory. Motors remain energized and position coordinates are preserved.


RESUME

Resume Paused Trajectory

Resumes motion along a previously paused (HOLD) trajectory from the exact suspended coordinates.


ESTOP

Immediate Emergency Stop

Executes an instantaneous hard stop aborting all motion, clearing command queues, and locking execution until an explicit reset.


ENABLE

Energize Motor Driver Stages

Powers up and energizes the stepper motor driver stages, applying holding torque to all axes.


DISABLE

De-energize Motor Driver Stages

Cuts power to stepper driver motor windings, releasing holding torque. Allows manual positioning by hand.


4. Static Analysis & Linter Rules

The scaralang toolchain includes an industrial-grade static analyzer and linter (scarac lint). It inspects AST instructions before compilation and flags semantic issues into three severity categories: ERROR, WARNING, and INFO.

4.1 Motion Rules

Rule Identifier Checker Service Description Severity
MOTION_UNCALIBRATED MotionCalibrationValidator Motion instruction (MOVE_J, MOVE_L, etc.) is commanded before HOME homing routine. WARNING
MOTION_DUPLICATE MotionDuplicateValidator Adjacent move instructions specify identical target coordinates, wasting trajectory planning cycles. INFO
MOTION_WORKSPACE_LIMIT TrajectoryValidator Target coordinate falls outside the physical reach envelope ($R_{min} \le r \le R_{max}$, $Z_{min} \le z \le Z_{max}$). ERROR

4.2 Pneumatic & Vacuum Rules

Rule Identifier Checker Service Description Severity
PNEUMATIC_CONFLICT PneumaticConflictValidator PUMP ON and VALVE ON are commanded simultaneously, causing hardware pneumatic contention. ERROR
PNEUMATIC_FLYBY PneumaticFlybyValidator PUMP ON is triggered without a subsequent dwell (WAIT) before initiating rapid motion, risking part drop. WARNING
PNEUMATIC_REDUNDANT PneumaticRedundancyValidator Consecutive redundant state changes (e.g. PUMP ON followed immediately by PUMP ON). INFO

4.3 State & Kinematic Rules

Rule Identifier Checker Service Description Severity
STATE_HOMING_REDUNDANT StateHomingValidator Multiple HOME commands placed without physical reason. INFO
STATE_MOTOR_MODE MotorModeValidator Incompatible motor drive mode or configuration timing. WARNING
STATE_ZONE_CONFLICT StateZoneValidator Zone rounding enabled during precision pick/place or probing sequences. WARNING

4.4 Timing & Blending Rules

Rule Identifier Checker Service Description Severity
TIMING_DWELL_EXCESSIVE TimingDwellValidator Single WAIT command exceeds 60,000 ms (1 minute), likely an error. WARNING
TIMING_BLEND_COLLISION TimingBlendZoneValidator Corner blend zone radius is larger than the motion segment distance. ERROR

4.5 Spatial Safety & Obstacle Collision Rules

Rule Identifier Checker Service Description Severity
OBSTACLE_COLLISION ObstacleLintRule Trajectory path segment (linear, joint, or arc) intersects user-defined spatial keep-out obstacle zone (ZONE_DEF). ERROR

5. Examples Directory & Verification Artifacts

The examples/ directory at the repository root contains 50 industrial test programs providing reference implementations for all categories of the SCARA DSL specification.

5.1 Directory Structure & Artifact Types

Every example program in examples/ includes 4 artifact files validating round-trip toolchain compilation, binary wire framing, and decompilation:

File Extension Artifact Role Description
.scara High-Level Source Original human-readable SCARA DSL script adhering to the language specification.
.bin Compiled Bytecode Packed binary execution payload framed with 0xAA 0x55 delimiter, message IDs, payload bytes, and CRC-16-CCITT checksums.
.dis Disassembly Inspection Frame-by-frame textual disassembly detailing wire sequence numbers, opcode IDs, payload unpacks, and hex bytes.
_decompiled.scara Decompiled Source Regenerated SCARA DSL script reverse-engineered directly from .bin by scaralang decompile.

5.2 Comprehensive Examples Catalog

# Program Name Primary Features & DSL Instructions Source & Artifacts
01 Multi-Axis Homing Multi-axis motor energizing, vertical slide homing, and coordinate origin calibration (ENABLE, HOME) 01_homing.scara
01_homing.bin
02 Cartesian Linear Motion Coordinated straight-line Cartesian interpolation with feedrate limits (MOVE_L, SPEED WORK, SPEED RAPID) 02_linear_motion.scara
02_linear_motion.bin
03 Joint-Interpolated Rapid Unconstrained multi-joint point-to-point rapid transit between fixtures (MOVE_J) 03_joint_rapid.scara
03_joint_rapid.bin
04 Circular Arc Interpolation Planar arc interpolation with relative center offsets (ARC_CW, ARC_CCW, I, J) 04_circular_arc.scara
04_circular_arc.bin
05 3D Parabolic Jump Arch Industrial pick-and-place arch move with parameterized clearance height (JUMP, ARCH) 05_jump_arch.scara
05_jump_arch.bin
06 Pneumatics & Vacuum Control Vacuum suction cup engagement, positive blow-off burst, and dwell settling (PUMP, VALVE, WAIT_MS) 06_pneumatics.scara
06_pneumatics.bin
07 Relative Approach & Retract Controlled low-speed vertical descent and high-speed vertical ascent (APPROACH, RETRACT) 07_approach_retract.scara
07_approach_retract.bin
08 Work Coordinate Frames (WCS) Named local coordinate frames, spatial origin shifts, and base reset (FRAME_DEF, FRAME_SET, FRAME_RESET) 08_work_frames.scara
08_work_frames.bin
09 Palletizing Matrix Grid 2D matrix tray definition and zero-indexed cell positioning (PALLET_DEF, MOVE_PALLET) 09_pallet_matrix.scara
09_pallet_matrix.bin
10 Tangential Tool Orientation Continuous 4th-axis yaw alignment tangential to trajectory path vector (TOOL_ORIENT TANGENT) 10_tangent_orientation.scara
10_tangent_orientation.bin
11 Corner Zone Blending Fly-by corner rounding and exact stop transition blending (ZONE EXACT, ZONE BLEND R=...) 11_zone_blending.scara
11_zone_blending.bin
12 Industrial Pick & Place Complete coordinated industrial pick-and-place workcell routine combining all subsystem capabilities 12_industrial_pick_place.scara
12_industrial_pick_place.bin
13 Elbow Reconfiguration Dynamic elbow orientation switching (LEFT to RIGHT) with singularity clearance 13_elbow_reconfiguration.scara
13_elbow_reconfiguration.bin
14 Singularity Avoidance Multi-tier singularity prevention and near-boundary damping 14_singularity_avoidance.scara
14_singularity_avoidance.bin
15 Boundary Reach Limits Cartesian workspace envelop boundary verification and clamping 15_boundary_reach_limits.scara
15_boundary_reach_limits.bin
16 Multi-Frame Palletizing Multiple work frame definitions with local pallet grid assembly 16_multi_frame_palletizing.scara
16_multi_frame_palletizing.bin
17 Bidirectional Assembly Reconfiguration and bilateral pallet transfer across dual fixtures 17_bidirectional_elbow_assembly.scara
17_bidirectional_elbow_assembly.bin
18 Tangential Dispensing Smooth glue bead dispensing with continuous tangential tool orientation 18_tangential_contour_dispensing.scara
18_tangential_contour_dispensing.bin
19 High-Speed Sorter Jump Fast parabolic jump gate pick-and-place with velocity tuning 19_high_speed_sorter_jump.scara
19_high_speed_sorter_jump.bin
20 Annular Inspection Scan Coordinated multi-point annular circular scan routine 20_annular_inspection_scan.scara
20_annular_inspection_scan.bin
21 Incremental Relative Motion Incremental relative Cartesian tool moves with active work frame mapping (MOVE_REL) 21_relative_motion_incremental.scara
21_relative_motion_incremental.bin
22 Conveyor Tracking Relative High-speed conveyor synchronized incremental pick-and-place tracking (MOVE_REL) 22_conveyor_tracking_relative.scara
22_conveyor_tracking_relative.bin
23 Bidirectional Arc Contour High-speed smooth bidirectional arc transition with dynamic feedrates (ARC_CW, ARC_CCW) 23_bidirectional_arc_contour.scara
23_bidirectional_arc_contour.bin
24 Matrix Pallet Depalletizing Automated depalletizing grid extraction with coordinate frame mapping 24_matrix_pallet_depalletizing.scara
24_matrix_pallet_depalletizing.bin
25 Stepper Motor Calibration Closed-loop stepper encoder calibration and torque testing (CONFIG MOTOR) 25_stepper_motor_calibration.scara
25_stepper_motor_calibration.bin
26 Multi-Zone High Speed Blending Continuous high-velocity trajectory with mixed fine and coarse zone blending (ZONE) 26_multi_zone_high_speed_blending.scara
26_multi_zone_high_speed_blending.bin
27 Emergency Hold Recovery In-flight trajectory pause, sensor verification, and motion resumption (HOLD, RESUME) 27_emergency_hold_recovery.scara
27_emergency_hold_recovery.bin
28 Three-Frame Assembly Station Multi-station fixture transformations across base, feeder, and nest (FRAME_SET, FRAME_RESET) 28_three_frame_assembly_station.scara
28_three_frame_assembly_station.bin
29 Precision Dispensing Tangent Constant-velocity continuous adhesive contouring with tangential tool yaw (TOOL_ORIENT TANGENT) 29_precision_dispensing_tangent.scara
29_precision_dispensing_tangent.bin
30 Complex Automation Workcell Fully integrated assembly cell combining pallets, frames, blending, and pneumatics 30_complex_automation_workcell.scara
30_complex_automation_workcell.bin
31 Subroutine Pick Place Parametric pick-and-place routines using modular subroutines (DEF, CALL, END) 31_subroutine_pick_place.scara
31_subroutine_pick_place.bin
32 Repeat Loop Array Automated repetitive grid testing using fixed-count iteration loops (REPEAT, END) 32_repeat_loop_array.scara
32_repeat_loop_array.bin
33 Nested Repeat Palletizing Multi-layer nested iteration loops with relative coordinate indexing 33_nested_repeat_palletizing.scara
33_nested_repeat_palletizing.bin
34 Subroutine Relative Motion Subroutine routines integrating relative Cartesian moves and frame offsets 34_subroutine_with_relative_motion.scara
34_subroutine_with_relative_motion.bin
35 Complex Cycle Subroutines Loops Full industrial automation routine combining nested loops, subroutines, and error recovery 35_complex_cycle_subroutines_and_loops.scara
35_complex_cycle_subroutines_and_loops.bin
36 Spatial Keep-Out Zones User-defined rectangular box and circular obstacle keep-out zones (ZONE_DEF BOX, ZONE_DEF CIRCLE) 36_spatial_keepout_zones.scara
36_spatial_keepout_zones.bin
37 Multi-Obstacle Dual Elbow Obstacle avoidance (BOX & CIRCLE) with in-flight dynamic elbow reconfiguration (CONFIG ELBOW) 37_obstacle_avoidance_dual_elbow.scara
37_obstacle_avoidance_dual_elbow.bin
38 Nested Matrix Frame Sorting Angled work frame transformations (FRAME_SET), nested iteration loops (REPEAT), and relative moves (MOVE_REL) 38_nested_matrix_frame_sorting.scara
38_nested_matrix_frame_sorting.bin
39 Closed-Loop Contour Hold Recovery Bidirectional circular arcs (ARC_CW/CCW), corner blending (ZONE BLEND), and in-flight feed hold/resume (HOLD/RESUME) 39_closed_loop_contour_hold_recovery.scara
39_closed_loop_contour_hold_recovery.bin
40 Pallet Obstacle Jump Transfer Dual matrix pallets (PALLET_DEF), 3D parabolic jump arch (JUMP), and keep-out corridor navigation 40_pallet_obstacle_jump_transfer.scara
40_pallet_obstacle_jump_transfer.bin
41 Dynamic Feedrate & Accel Profiling Multi-stage dynamic velocity and acceleration scheduling (ACCEL, SPEED WORK, OVERRIDE, ZONE BLEND) 41_dynamic_feedrate_accel_profiling.scara
41_dynamic_feedrate_accel_profiling.bin
42 Vacuum Decay & Pressure Equalization High-precision vacuum seal validation, multi-stage pressure equalization micro-dwells (WAIT_MS, PUMP, VALVE, APPROACH) 42_vacuum_decay_pressure_equalization.scara
42_vacuum_decay_pressure_equalization.bin
43 Concentric Pocket Milling Tangency Multi-depth concentric pocket profiling with alternating circular arcs, incremental Z depth stepping, and tool tangency (ARC_CW/CCW, TOOL_ORIENT TANGENTIAL) 43_tangential_pocket_milling.scara
43_tangential_pocket_milling.bin
44 Hierarchical Subroutine Chain 3-level deep subroutine call stack expansion (Master -> Task -> Atomic) with recursion tracking (DEF, CALL, END) 44_hierarchical_subroutine_chain.scara
44_hierarchical_subroutine_chain.bin
45 Polar Rotary Inspection Sweep Polar quadrant arc sweeps with discrete 4th-axis yaw re-orientation and camera exposure dwell (ARC_CCW, MOVE_REL PHI, WAIT_MS) 45_polar_rotary_inspection_sweep.scara
45_polar_rotary_inspection_sweep.bin
46 Rotated Frame Relative Stepping Angled work frame transformations (FRAME_SET ... ANGLE=30.0), relative incremental raster steps (MOVE_REL), and base reset (FRAME_RESET) 46_rotated_frame_relative_stepping.scara
46_rotated_frame_relative_stepping.bin
47 Asymmetric Dual Obstacle Channel Tight collision-free corridor navigation between rectangular enclosure (ZONE_DEF BOX) and cylindrical column (ZONE_DEF CIRCLE) with blend transitions 47_asymmetric_dual_obstacle_channel.scara
47_asymmetric_dual_obstacle_channel.bin
48 Hybrid Motor Mode Torque Switch Dynamic runtime switching between open-loop high-speed transit and closed-loop delicate seating (CONFIG MOTOR OPEN_LOOP/CLOSED_LOOP) 48_hybrid_motor_mode_torque_switch.scara
48_hybrid_motor_mode_torque_switch.bin
49 Serpentine Raster Dispensing Continuous planar serpentine meander path with linear passes joined by 180° alternating circular U-turn arcs (ARC_CW/CCW, TOOL_ORIENT TANGENTIAL, ZONE BLEND) 49_serpentine_raster_dispensing.scara
49_serpentine_raster_dispensing.bin
50 Master Multi-System Production Cell Full-scale capstone manufacturing cell integrating pallets, frames, obstacle keep-out, parabolic jumps, subroutines, tool tangency, and pneumatics 50_master_multisystem_production_cell.scara
50_master_multisystem_production_cell.bin

5.3 Toolchain CLI Workflows (Compile, Disassemble, Decompile)

Developers and integrators can use the scaralang command-line interface to compile, inspect, disassemble, decompile, and export any example program:

1. Compilation (compile)

Compiles a human-readable .scara script into a packed binary execution stream (.bin):

scaralang compile -s examples/12_industrial_pick_place.scara -o examples/12_industrial_pick_place.bin

2. Disassembly (disassemble)

Decodes binary wire protocol frames into formatted textual inspection instructions (.dis):

scaralang disassemble -b examples/12_industrial_pick_place.bin -o examples/12_industrial_pick_place.dis

3. Decompilation (decompile)

Reconstructs high-level .scara DSL instructions directly from binary wire frames (_decompiled.scara):

scaralang decompile -b examples/12_industrial_pick_place.bin -o examples/12_industrial_pick_place_decompiled.scara

4. Trajectory Export (export)

Exports trajectory plans to multi-target formats (G-code, CSV time series, JSON telemetry, SVG visualization):

scaralang export -s examples/12_industrial_pick_place.scara -f gcode -o examples/12_pick_place.gcode
scaralang export -s examples/12_industrial_pick_place.scara -f svg -o examples/12_pick_place.svg
scaralang export -s examples/12_industrial_pick_place.scara -f csv -o examples/12_pick_place.csv
scaralang export -s examples/12_industrial_pick_place.scara -f json -o examples/12_pick_place.json

5. Static Linter Analysis (lint)

Validates robotic motion safety, pneumatic timing, and kinematic boundaries before execution:

scaralang lint -s examples/12_industrial_pick_place.scara

6. Complete Industrial Example Scripts

6.1 High-Speed Pick and Place with Matrix Pallet

# ------------------------------------------------------------------
# Industrial Palletizing Routine: Pick from Feeder, Place into Tray
# ------------------------------------------------------------------
CONFIG ELBOW LEFT
CONFIG MOTOR CLOSED_LOOP

SPEED RAPID 220.0
SPEED WORK 80.0
ACCEL 600.0
OVERRIDE 100

# 1. Calibrate reference home
HOME

# 2. Define a 3x4 Component Tray Matrix
PALLET_DEF TRAY_OUT ROWS 3 COLS 4 DX 30.0 DY 30.0 Z 10.0

# 3. Position above component feeder station
MOVE_J X 120.0 Y -60.0 Z 40.0
APPROACH DIST 35.0

# 4. Grip first component
PUMP ON
WAIT 150
RETRACT DIST 35.0

# 5. High-speed parabolic arch transfer to Pallet Slot #1
JUMP X 180.0 Y 50.0 Z 10.0 ARCH 30.0

# 6. Release component
PUMP OFF
VALVE ON
WAIT 60
VALVE OFF

# 7. Move directly to Pallet Slot #2 for second cycle
MOVE_PALLET TRAY_OUT INDEX 2
APPROACH DIST 10.0

6.2 Circular Profiling with Tool Tangency

# ------------------------------------------------------------------
# Continuous Circular Gasket Dispensing with Tangential Tool Yaw
# ------------------------------------------------------------------
SPEED RAPID 180.0
SPEED WORK 50.0
ACCEL 400.0

HOME
ZONE Z5
TOOL_ORIENT TANGENT

# Approach starting contour point
MOVE_J X 150.0 Y 0.0 Z 25.0
MOVE_L X 150.0 Y 0.0 Z 5.0

# Dispenser ON
TOOL DOWN
WAIT 50

# Continuous circular toolpath (R=40mm)
ARC_CW X 190.0 Y 40.0 I 0.0 J 40.0
ARC_CW X 230.0 Y 0.0 I 0.0 J -40.0
ARC_CW X 190.0 Y -40.0 I -40.0 J 0.0
ARC_CW X 150.0 Y 0.0 I 0.0 J 40.0

# Dispenser OFF
ZONE EXACT
TOOL UP
RETRACT DIST 30.0

6.3 Surface Probing and Adhesive Dispensing

# ------------------------------------------------------------------
# PCB Height Surface Probing and Touch-Off
# ------------------------------------------------------------------
CONFIG ELBOW RIGHT
SPEED RAPID 150.0
SPEED WORK 30.0

HOME

# Move above PCB test pad
MOVE_J X 140.0 Y 20.0 Z 35.0

# Search for PCB top plane at controlled velocity
PROBE SPEED 5.0 DIST 30.0

# Set Work Coordinate System relative to probed surface
FRAME X 140.0 Y 20.0 Z 0.0

# Dispense micro-dot exactly 0.5 mm above probed surface
MOVE_L X 0.0 Y 0.0 Z 0.5
TOOL DOWN
WAIT 100
TOOL UP
RETRACT DIST 20.0
FRAME_RESET