Expand description
Programs read into path pieces (path::Piece) for the path planner: a subset of G-code (DIN 66025 / ISO 6983), robot
moves as CSV, and subsets of KUKA KRL and ABB RAPID. read picks the reader by the file’s extension.
G-code (.nc, .ngc, .gcode, .g, .cnc, .tap), one block per line:
- G0 rapid, G1 line, G2 clockwise and G3 counterclockwise arc (seen from the plus side of the plane’s normal), centre by I, J, K (from the start, always incremental) or radius R (negative: the longer of the two arcs);
- G17 (XY plane), G18 (ZX), G19 (YZ); G20 inch, G21 mm (the default); G90 absolute (the default), G91 incremental;
- F the feed per minute, needed before the first G1, G2 or G3: the speed along the path, in length units for a block
with a linear axis and in degrees for a block that moves only rotary axes (A, B, C); where both move, the linear
axes’ distance at F sets the time and the rotary axes follow in it. This is Siemens SINUMERIK’s reading with its
default FGROUP (the geometry axes; a rotary axis in a mixed block is synchronised and has no F of its own;
Fanuc’s, which counts degrees like mm in a mixed block, is not taken: no primary source). G2 or G3 with I, J, K and
no end is a full circle. F is modal and caps each piece at its own block’s feed (
path::plan_feeds,Run::caps): the moves between two G0 are one run planned as one path, with no stop where the feed changes (a corner still stops it, as it does without a feed); G0 runs at the axes’ limits; - X, Y, Z (and A, B, C in degrees) move the axes of the same name (ids x, y, z, a, b, c); the start is where the machine stands, an axis a block does not name stays;
- G4 P
a dwell: the path stops at the end of the move before, stands P seconds (0 to MAX_DWELL_S) and goes on (RS-274NGC’s G4, as LinuxCNC reads it, but alone in its block; Siemens’ G4 F and Fanuc’s P in milliseconds are not read). G61 exact path (corner tolerance 0 from here on: corners are stopped at, lines in one direction are not), G64 (the config’sprofile.corner_tolerance_m, where LinuxCNC’s G64 keeps the best speed at any deviation) and G64 P(that tolerance in the program’s unit, G20/G21 apply; P0 is G64 alone, as in LinuxCNC). P bounds the curve’s distance from the two lines, where LinuxCNC’s bounds it from the programmed corner: at a right angle the curve passes up to sqrt(2) P from the corner. G61.1 and G64 Q are not read; Siemens’ G64 takes no P. The mode that governs a corner is the one in force for the block after it; a change of mode, like a dwell, ends the run, so the corner at the change is stopped at ( Run::corner,Run::dwell_s); - taken and without effect: N, O, M, S, T words, G40, G49, G54, G80, G94; comments in ( ) and after ;; % lines; M2 and M30 end the program. Every other word or G code is refused with its line, and so is an arc that changes the plane’s third axis (a helix), whose start and end lie at different distances from its centre, or a word for an axis the machine does not have.
Robot moves as CSV (any other extension, when a line starts with Move): MoveL,x,y,z and MoveJ,x,y,z straight to
the pose, MoveC,via...,end... on the circle through the via point to the end; one value per axis in the machine’s
units (m, rad), as a path file has them; at the axes’ limits.
KRL (.src): PTP {X 100, Y 0, Z 500}, LIN {...}, CIRC {aux}, {end} with mm and degrees, components left out
kept from the point before (for a CIRC too, the auxiliary point’s are not used: KUKA System Software 8.3, section
11.5.3); A, B, C, S, T, E1… move axes of those names where the machine has them and are left out
otherwise. Where the machine’s axes are x, y, z and a rotation vector rx, ry, rz (an arm in tool space), A, B, C are
the orientation (R = Rz(A) Ry(B) Rx(C), KUKA’s) and set rx, ry, rz. $VEL.CP = v (m/s) is the speed along the path
of the LIN and CIRC moves after it; a PTP runs at the axes’ limits.
RAPID (.mod, .prg): MoveL, MoveJ and MoveC to robtargets given in place ([[x, y, z], [q1, q2, q3, q4], ...]) or declared (CONST robtarget p10 := [[...]];), positions in mm; where the machine has rx, ry, rz the
orientation quaternion (q1 the scalar part) sets them. The speed: v100 (the predefined speeddata, mm/s), vmax
(the axes’ limits), a speeddata given in place ([150, 500, 5000, 1000], its TCP speed in mm/s) or declared (CONST speeddata vfast := [...];); the zone is left out. In both every other line or statement without a move is skipped;
other move instructions (PTP_REL, SPLINE, MoveAbsJ, named KRL points) are refused. A PTP or MoveJ is a straight line
in the machine’s axes, as a MoveL, at the move’s speed along it.
A robot’s speed (KRL’s $VEL.CP, RAPID’s TCP speed) is the tool centre’s, the position alone, and the reorientation
is limited by its own: program.orientation_speed_rad_s (default 500 degrees per second, the default of RAPID’s
v_ori), on a machine whose tool space has rx, ry, rz. A move takes the longer of the tool centre’s distance over
its speed and the angle between the two orientations over that rate, so a move that only reorients runs at the
rate; the planner’s cap along the path (whose length counts the rotation vector’s radians with the metres) is the
path’s length over that time. A move with no speed (PTP, MoveJ, vmax) stays at the axes’ limits. G-code keeps its
feed rule above.
Structs§
- Program
Error - A line of a program that cannot be read: its number (from 1), a translation key and the word or detail.
- Run
- Moves planned as one path with no stop between them: the pieces, and the speed along the path each is capped at (axis
units per second, over all axes, as
path::plan_feedstakes it):caps, one per piece.feedis the highest of them,Nonewhere the run is at the axes’ limits (andcapsis empty).
Constants§
- MAX_
DWELL_ S - The longest dwell (s) a G4 takes: the plan has a pose per profile cycle for it. This simulator’s limit.
- ORIENTATION_
SPEED - The tool’s reorientation speed a robot program runs at by default (rad/s): 500 degrees per second, the default of
ABB’s
v_ori(RAPID speeddata);program.orientation_speed_rad_ssets it.
Functions§
- as_path
- The pieces of a program that plans as a path file does (
Sim::plan_path): one run at the axes’ limits in the config’s corner tolerance.Nonefor one to plan run by run (Sim::plan_program): with a feed, more runs, or a G61 or G64 P whose corner tolerance onlyplan_programtakes. - gcode
- G-code (see the module).
- krl
- KUKA KRL (see the module).
- krl_
with krlwith the tool’s reorientation speedorientation_speed(rad/s).- orientation_
speed_ of - The config’s
program.orientation_speed_rad_s(above 0),ORIENTATION_SPEEDwhere it has none: the value the front ends pass toread_with, as the simulator’s own path run does. - rapid
- ABB RAPID (see the module).
- rapid_
with rapidwith the tool’s reorientation speedorientation_speed(rad/s).- read
- The program in
text, read by the file’s extension (see the module): G-code, KRL, RAPID, robot moves as CSV, else a path file (path::parse, one run at the axes’ limits). Planned fromstart, on a machine withaxes. - read_
with readwith the tool’s reorientation speedorientation_speed(rad/s) for the robot programs on a machine whose tool has an orientation (program.orientation_speed_rad_s).- robot_
csv - Robot moves as CSV (see the module).