You are on page 1of 20

Corso IFTS

Tecnico Progettista Programmatore di sistemi per l'industria 4.0

ARCHITETTURA E
PROGRAMMAZIONE SISTEMI PER
MOTION CONTROL

MARCO
SILVESTRI

LEZIONE 09
OTHER LANGUAGES FOR MOTION
CONTROL

▪ MINT - Motion INTelligence (ABB)


(http://www.abbmotion.com/products/mint/MINT.asp)

▪ HPGL - Hewlett Packard Graphics Language


(http://www.abilitysystems.com/_download/HPGL%20Controller%2
0Manual.pdf)

▪ MCL - Motion ControlLanguage


(https://www.logosolinc.com)

▪ TPL
(https://tplang.org/)

2
TPL
▪ TPL or Tool Path Language is a programming language for creating
machine tool paths for CNCs. It is based on JavaScript and is a
powerful replacement for the venerable but horribly outdated
GCode language. However, TPL can output GCode so it remains
compatible with existing machine control software such as
LinuxCNC.

▪ TPL is part of the CAMotics project and can be used in


conjunction with the CAMotics CNC simulator.

3
AN EXAMPLE
▪ feed(400); // Set the feed rate to 400 millimeters per minute
▪ tool(1); // Select tool 1

▪ rapid({z: 5}); // Move to a safe height of 5mm


▪ rapid({x: 1, y: 1}); // Go to start position
▪ speed(2000); // Spin at 2000 RPM in the clockwise direction

▪ cut({z: -3}); // Cut down to depth


▪ cut({x: 11}); // Cut to second corner
▪ cut({y: 11}); // Cut to third corner
▪ cut({x: 1}); // Cut to forth corner
▪ cut({y: 1}); // Cut back to begining

▪ rapid({z: 5}); // Move back to safe position


▪ speed(0); // Stop spinning
4
NOTE
▪ The previous example initializes the machine then cuts a square.
Note, you must always set the feed rate to something other than
zero before making a cut. It's also a good idea to select a tool and
set the spindle speed. Also note, TPL uses metric units by default.
You can switch to imperial units by calling units(IMPERIAL).

▪ The bracket notation {} used above lets you specify specific


arguments and leave others to their default values. The following
function calls are all equivalent:

▪ rapid(5, 10, 15);


▪ rapid({x: 5, y: 10, z: 15});
▪ rapid({z: 15, x: 5, y: 10});

5
FUNCTIONS
▪ The above square example could be wrapped in a function like this:

▪ function square(size, depth, safe) {


▪ cut({z: depth}); // Cut down to depth
▪ icut({x: size}); // Cut to second corner
▪ icut({y: size}); // Cut to third corner
▪ icut({x: -size}); // Cut to forth corner
▪ icut({y: -size}); // Cut back to begining
▪ rapid({z: safe}); // Move back to safe position
▪ }

▪ feed(400); // Set the feed rate to 400 mm per minute


▪ tool(1); // Select tool 1

▪ rapid({z: 5}); // Move to a safe height of 5mm


▪ rapid({x: 1, y: 1}); // Go to start position
▪ speed(2000); // Spin at 2000 RPM in the clockwise direction

▪ square(10, -3, 5);

▪ speed(0); // Stop spinning

▪ Note the square() function uses icut() the incremental version of cut(). 6
FOR LOOP
▪ Given the square() function you can now cut repeated squares
like this:

▪ for (i = 1; i <= 10; i++) square(i * 5, -3, 5);

▪ Here is the result of running the square function as in the for loop
above.

7
ROTATE
▪ for (var i = 0; i < 4; i++) {
▪ squares(10, 5, -3, 5);
▪ rotate(Math.PI / 8); // Rotate clockwise 15 degrees
▪ }

▪ speed(0); // Stop spinning

8
TOOL MOVEMENT: RAPID
▪ rapid(x, y, z, a, b, c, u, v, w, incremental=false)

▪ Issue a linear motion at the rapid feed rate from the current
position to the new position defined by the provided axes
arguments.

▪ rapid(0, 0, 0); // Rapid to x=0, y=0, z=0


▪ rapid(10, 10); // Rapid to x=10, y=10, z remains 0
▪ rapid({z: 10, y: 10}); // Rapid to y=10, z=10, x remains 10

▪ irapid(x, y, z, a, b, c, u, v, w, incremental=true)

▪ The same as rapid() but incremental defaults to true.

9
TOOL MOVEMENT: CUT
▪ cut(x, y, z, a, b, c, u, v, w, incremental=false)

▪ The same as rapid() except moves are at the current feed rate set
by a call to feed().
▪ icut(x, y, z, a, b, c, u, v, w, incremental=true)

▪ The same as cut() but incremental defaults to true.

10
TOOL MOVEMENT: ARC
▪ arc(x, y, z, angle, plane)

▪ x, y and z specify the offset from the current position to the far
center of the helical move in the selected plane. If the z value is
zero then the move is a simple arc in the selected plane,
otherwise it is a true helical move with an axis of length equal to
the absolute value of the z value either above or below the
selected plane through the current control point depending on
the sign.

▪ angle is the rotation of the arc in radians. A positive value


indicates a clockwise rotation, negative a counter-clockwise
rotation.

▪ plane specifies to which plane the helical axis is perpendicular.


Valid values are XY (the default), XZ or YZ. 11
TOOL MOVEMENT: PROBE
▪ probe() will return the coordinates of the position at the time
the probe changed state. If the programmed point was reached
before the state changed then the programmed point will be
returned instead.

▪ probe(z = -10); // Probe towards z=-10


▪ probe(z = 10, active = false); // Probe away from current z

▪ It is an error if:

▪ The current point is the same as the programmed point.


▪ The current feed rate is zero.
▪ The probe is already in the target state.

12
TOOL MOVEMENT: DWELL
▪ probe() will return the coordinates of the position at the time
the probe changed state. If the programmed point was reached
before the state changed then the programmed point will be
returned instead.

▪ probe(z = -10); // Probe towards z=-10


▪ probe(z = 10, active = false); // Probe away from current z

▪ It is an error if:

▪ The current point is the same as the programmed point.


▪ The current feed rate is zero.
▪ The probe is already in the target state.

13
TOOL MOVEMENT: DWELL
▪ dwell(seconds)

▪ seconds indicate the time in seconds that all axes will remain
unmoving. Fractions of a second may be used.

▪ dwell(0.5); // Dwell for half a second.

14
MACHINE STATE
▪ feed(rate, mode = FEED_UNITS_PER_MIN)
▪ rate indicates the units per minute in the XYZ Cartesian system of all
subsequent non-rapid moves until the feed rate is changed.
▪ mode may be one of the following:
▪ FEED_UNITS_PER_MIN - The feed rate is in units per minute. The unit
may be inches, millimeters or degrees depending on the current unit of
length and which axes are moving.
▪ FEED_INVERSE_TIME - Indicates that moves should be completed in
one divided by rate minutes. For example, if rate is 2.0, moves should be
completed in half a minute.
▪ FEED_UNITS_PER_REV - Means that the controlled point should move a
certain number of units per revolution.

▪ Note, these names are case sensitive.

▪ If no arguments are given, returns the current feed rate and mode.
▪ feed(4); // Move at 4 units per minute
▪ rate = feed()[0]; // Get the current feed rate
15
SPEED
▪ speed(rate, surface, max)

▪ rate indicates the revolutions per minute of the spindle.

▪ If rate is positive the spindle will turn in the clockwise direction. If


negative in the counterclockwise direction.

▪ A rate of zero turns the spindle off.

▪ speed(1000); // Spin clockwise at 1K RPM.


▪ speed(-20000); // Spin counterclockwise at 20K RPM.

16
TOOL
▪ tool(number)
▪ Make tool number the current tool.
▪ tool(1); // Select tool 1

▪ If no arguments are given, information about the currently selected tool is


returned. E.g.:
{
number: 1,
shape: CONICAL, // A tool type constant
angle: Math.PI * 0.5, // In radians, 90°
length: 10, // In current units
diameter: 3.175, // In current units
snub_diameter: 1 // If shape == SNUBNOSE
}

▪ The tool type constants are as follows:


CYLINDRICAL
CONICAL
BALLNOSE
SPHEROID
SNUBNOSE 17
SPEED
▪ speed(rate, surface, max)

▪ rate indicates the revolutions per minute of the spindle.

▪ If rate is positive the spindle will turn in the clockwise direction. If


negative in the counterclockwise direction.

▪ A rate of zero turns the spindle off.

▪ speed(1000); // Spin clockwise at 1K RPM.


▪ speed(-20000); // Spin counterclockwise at 20K RPM.

18
SPEED
▪ speed(rate, surface, max)

▪ rate indicates the revolutions per minute of the spindle.

▪ If rate is positive the spindle will turn in the clockwise direction. If


negative in the counterclockwise direction.

▪ A rate of zero turns the spindle off.

▪ speed(1000); // Spin clockwise at 1K RPM.


▪ speed(-20000); // Spin counterclockwise at 20K RPM.

19
ESERCIZIO
▪ Modificare il programma d’esempio precedente per realizzare
una traiettoria ottagonale.

▪ Realizzare una serie di ottagoni uno all’interno dell’altro con un


ciclo for

20

You might also like