Robot
Machining

Robotic machining is the process where a raw
material is cut into a desired final shape and size by a controlled
material-removal process, using a robot arm. Machining encompasses different
material removal applications, such as milling, drilling, chamfering, and
deburring, typically performed by automated machine tools (CNC). Industrial
robots can be used like a machine tool (3-axis or 5-axis CNC) using RoboDK.

To achieve the same or better results as
CNC machines, industrial robots require advanced Offline Programming software
technology such as RoboDK to convert machine programs to robot programs.

The part dimensions are defined using
computer-aided design (CAD) software, and then translated into manufacturing programs
(such as G-code) by computer-aided manufacturing (CAM) software. The
manufacturing programs can then be converted to robot programs using RoboDK’s Offline
Programming tools.

Additional axes, such as a turntable and a
linear rail can be synchronized with the robot to extend the workspace.

Setup for Machining

This section shows how to prepare a simple
RoboDK station offline for robot machining. A
RoboDK station contains all robots, tools, reference frames, objects and other
settings. More information about building a RoboDK station in the getting started section.

It is required to have a robot with a tool
and the 3D object in a reference frame to set up a robot machining project:

c.Select Download and the robot should
automatically appear in the main screen.

2-Select a tool:

a.From the same online library, filter by Type➔Tool

b.Download a Spindle tool

c.The tool should be automatically attached to the
robot
Once the tool is loaded the Online library can be closed

Tip: An object
can be converted to a tool by drag & dropping the object to the robot in
the station tree. More information here.

3-Add a reference frame:

a.Select Program➔ Add Reference Frame

b.Select the new reference Frame in the tree and select F2 to rename
it to Milling Reference

4-Add an object:

a.Select File➔ Open

b.Select an object named Object wooden bowl.sld

c.Drag and drop the object to the Milling
Reference (inside the station tree)

Tip: Move
the reference frame instead of the object. The reference frame will be used to
locate the part once the milling program is ready to be executed by the robot.

Note: The
RoboDK station is stored in one file (RDK file). It is not required keep a
separate copy of the robot files, tools and objects, they are saved in the RDK
file.

Robot Machining project

Follow these steps to set up a new robot
machining project given a NC file generated using CAM software (such as G-code
or APT):

1.Select Utilities➔ Robot Machining project (Ctrl+M).
A new window will pop up, as shown in the image.

2.Select Select NC file in the Path input section

3.Provide an NC file, such as one from the RoboDK default library:
C:/RoboDK/Library/Milling Bowl 3x.nc

Tip: Load
the NC file directly to set up the project automatically. It is possible to
drag & drop the file to the RoboDK window.

Select the robot, the reference frame and
the tool in the top left section of the menu, as shown in the following image:

The machining toolpath is displayed in
Green and the path normals are shown as White vectors. Uncheck Visible toolpath
to hide the toolpath.

Tip: It is
possible to set a tool (TCP) relative to another TCP in the tool options window.

Important:
The object with respect to the reference frame must match with the machining
toolpath. If this is not the case, align
the object reference with the machining reference so that the reference
that can be located in a real setup.

Path input

The path input allows us to select
different ways to provide a toolpath. The toolpath can be defined by:

oSelect NC file: As
one NC file (obtained from CAM software), as described in this section.

Select Add to add an additional
movement. The green path will be updated accordingly. It is possible to select between
a normal movement (along the white normal), tangent (along the Green path) or
along specific axes with respect to the part.

Double click the value to modify the length
or select Remove to remove a specific movement.

Path to tool offset

The path to tool offset allows changing the
preferred orientation of the tool along the toolpath. This option is mainly
used to turn the tool around the Z axis of the TCP.

Note: Generally,
robot machining tools have the Z axis along the cutting axis, pointing
outwards. The Z axis of the tool will match the toolpath normal by default.

Since a 6-axis robot is used to follow a
3-axis or 5-axis CNC manufacturing program we have an additional degree of
freedom to define. This degree of freedom is usually the rotation around the Z
axis of the TCP.

By default, the path to tool offset
displays a rotz(0) transformation. This value can be modified to
establish the preferred orientation of the tool, modifying the orientation around
the Z axis of the TCP or in combination with other axes. The preferred
orientation is the orientation the robot will try to keep while following the
toolpath.

Tip: The reference frames section provides more
information about other ways to enter position and orientations.

By default, RoboDK uses the Minimum tool
orientation change algorithm. This means the orientation of the tool is
kept as constant as possible along the toolpath. In general, this option is
suitable for milling operations as it minimizes robot joint movements.
Alternatively, other algorithms/methods are available, such as the tool orientation following the toolpath
(useful for cutting applications), or the robot holding the object if the
toolpath needs to be followed attached to the robot tool (for example, for
dispensing or polishing applications).

Tip: Select
the Show preferred toolpath button to see an immediate representation of
the result as the orientation is changed.

Tip: Use the
mouse wheel while the cursor is on top of the rotz(0) text to gradually
modify the orientation.

Optimization parameters

Given a preferred orientation, the robot can
have a certain freedom to turn around the Z axis of the tool. This allows the
robot to accomplish the program avoiding robot singularities and axis
constrains. By default, RoboDK allows the tool to rotate up to +/-180 degrees
around the TCP axis by steps of 20 deg.

It is recommended to constrain this
rotation depending on the application. For example, it is possible to enter
+/-90 degrees to constrain the allowed rotation by half.

Tip: Select Show
estimated toolpath to see the reachable points (in green) and the unreachable
points (in red). The reachable points might be rotated with respect to the
preferred toolpath to make the targets reachable by the robot.

If some points of the path are not
reachable, it is recommended to move the reference frame or to be more permissive
with the tool Z rotation. The reference frame can be moved holding the Alt key.

Note: The
estimated toolpath will be displayed as the reference frame or the TCP are
modified if the Auto update option is checked.

Tip: Smaller
step values allow a more gradual reorientation of the tool as it is crossing a
singularity. On the other hand, it might take longer to calculate the toolpath.

Note: Set
the allowed rotation around Z to 0 degrees to fully constrain the tool
according to the preferred orientation.

Update program

Select Update to obtain the program
according to the provided settings. A green check mark is displayed if the
program can be successfully created. We will then see a new program in the
station.

Double click the generated program
or select Simulate to start the robot machining simulation.

Right click the program and select Generate
robot program (F6) to obtain the program. More information about program
generation in the Program section.

Note: By
default, RoboDK hides the instructions of a program. Right click the program
and select Show instructions to see the list of instructions. A yellow
arrow shows if the program is being simulated and what instruction is being
executed.

Preferred Configuration

RoboDK automatically selects the start
configuration that is closer to the preferred start joints (Preferred joints
for the start point). From that point, the robot will follow linear
movements, so the robot configuration will not change.

A dropdown menu will display all the
possible solutions to start the program. If required, select a preferred
configuration and select Update to recalculate the program.

Robot Cutting

It is possible to keep the orientation of
the tool constant along the path. This behavior is useful for cutting or
welding applications for example.

Select Tool orientation follows path
in the Select algorithm dropdown to recalculate the preferred toolpath.
The other settings are the same as having a Machining Project with a
constant tool orientation.

Robot Holds object

It is possible to program a robot when it
holds the object/toolpath with the tool with the robot while the manufacturing
operation takes place. This is useful for glue dispensing or polishing
applications for example.

Select Robot holds object in the Select
algorithm dropdown to properly place the toolpath on the TCP reference. The
other settings are the same as having a Machining Project with a
constant tool orientation.

Important:
It is strongly recommended to have the points of the toolpath close to each
other if the tool orientation is changed.

Curve Follow Project

It is possible to make a robot follow
curves in the 3D space with RoboDK. Curves in RoboDK can be selected from
object edges or imported as a
list of points in CSV files. This option is useful for robot welding
applications for example.

Tip: Curves
can have a normal vector that will be matched with the tool Z axis (usually
normal to the surface).

Select Utilities➔Curve Follow
Project to open the curve follow settings. These
settings are the same as a Robot
Machining Project, the only difference is that the Path input is
preset to Select curve.

Select Select curve to select the curve(s)
on the screen.

Select the curves with a mouse left click.
Selecting the same curve twice will switch the direction of motion. Also, right
clicking a previously selected curve allows switching the sense or deselect a
previously selected curve.

Note: The
order of motion is displayed in green numbers.

Tip: Select
Tools

➔Options➔Display and reduce the
curve pick sensibility if the curves are too close to each other. Also, reduce
the arrow size to display smaller green arrows along the path.

Right click the screen and select Done
or press the Esc key to go back to the settings menu. The green path will
display the robot motion with respect to the object.

Some additional options are available at
the top right of the settings, such as the tool speed and if the approach/retract
moves must be applied for each curve. The default settings are shown in the
next image:

Note: Among
other things, the Program Events settings allow changing the motion speed
during the approach and retract movements.

Import Curves

Curves can be imported in RoboDK from a CSV
file or a text file by selecting Utilities➔Import Curve. A new item will appear in the station showing the curve as an
object.

Tip: Drag
and drop a CSV file (.csv format) like the one shown in the image to
automatically import the file as a curve.

The file can be a text file with the 3D
coordinates of each point of the curve. Optionally, the orientation of the Z
axis of the tool can be provided as an i,j,k vector.

Note: Object
edges can be automatically extracted when a STEP or an IGES file is loaded in
RoboDK (more information available in the STEP/IGES
import section).

Optionally, existing curves of an object
can be exported as a CSV file (right click a curve, then, select Export curve),
modified and reimported back in RoboDK.

Point Follow Project

It is possible to make a robot follow
points in the 3D space with RoboDK. Points in RoboDK can be extracted from
objects, curves or imported as
a list of points in CSV files. This option is useful for spot welding or
drilling applications for example. The following video shows an example to set
up a spot welding application: watch video.

Tip: Points
can have a normal vector that will be matched with the tool Z axis (usually
normal to the surface).

Select Utilities➔Point Follow
Project to open the point follow settings. These settings
are the same as a Robot Machining
Project, the only difference is that the Path input is preset to Select
points.

Select Select points to select the
point(s) on the screen.

Select the points with a mouse left click.
Selecting the same point twice will switch the approach direction. Also, right
clicking a point allows selecting the points that follow by selecting Select
next.

Note: The
order of motion is displayed in green numbers.

Tip: Select
Tools

➔Options➔Display and reduce the
point pick sensibility if the points are too close to each other.

Right click the screen and select Done
or press the Esc key to go back to the settings menu. The green path will
display the robot motion with respect to the object.

Some additional options are available at
the top right of the settings, such as the tool speed and the approach distance.
The default settings are shown in the next image:

Note: Among
other things, the Program Events settings allow changing the motion speed
during the approach and retract movements.

Import Points

A list of points can be imported from a text
file or a CSV file by selecting Utilities➔Import Points. A new item will appear in the station showing the points as an
object.

Tip: Drag
and drop a text file (.txt format) like the one shown in the image to
automatically import the file as a list of points.

The file can be a text file with the 3D
coordinates of each point of the curve. Optionally, the orientation of the Z
axis of the tool can be provided as an i,j,k vector.

Note: Points
in parametric object files (such as STEP and IGES files) are automatically
imported by default (more information available in the STEP/IGES import section).

Optionally, existing curves of an object
can be converted into points by right clicking a curve, then, selecting Extract
curve points.

Robot 3D Printing Project

3D printing or additive manufacturing is
the process of making three dimensional solid objects from a digital file.
Industrial robot arms can be used as a 3-axis 3D printer or as a 5-axis 3D
printer with RoboDK. The following video shows an overview of how to setup 3D
printing with RoboDK offline: watch video.

3D printing with robots is possible in one
of the following ways:

oDirectly convert G-code programs (NC file) to
robot programs with RoboDK, as shown with the Robot Machining project. The rate
of material flow (extruder directive E) is properly taken into account for each
movement and it can be integrated in the generated program as a Program
Event. G-code is a type of NC file supported by RoboDK and it is also a
format supported by many 3D printers. Most slicer software can generate G-code
given an STL file.

Note:
Slicers create the instructions for the machine (G-code) from a 3D model. The
instructions define the extruder toolpath with a rate of flow. It is required
to combine RoboDK with slicer software to properly accomplish 3D printing with
robots.

Tip: Right click
an object in RoboDK to save it as STL.

oSelect Utilities➔3D Print
Project to open the 3D printing settings. These
settings are the same as a Robot
Machining Project, the only difference is that the Path input is
preset to 3D print object. Select Select object to select the
object on the main screen and automatically obtain the toolpath. Select 3D
printing options to open Slic3r.

Important: When
the 3D print object option is selected, the slicer Slic3r
can be used by default to convert the object to a toolpath. Alternatively,
other slicers can be used by generating G-code programs and converting them to
robot programs as shown in the Robot
Machining project.

By default, RoboDK translates the E
directive as a program call to a program called Extruder and passing the
E value as a parameter. Select Program Events to change this behavior.

The Extruder value (E) represents how much
material needs to be extruded before each movement. This value can be used to
drive the extruder feed from the robot taking into account the robot speed and
distance between points.

Alternatively, it is possible to calculate
the extruder feed using a post processor and generate appropriate code
accordingly. The following section provides an example.

Note: Some
robot controllers can synchronize the motion of the tool with an extruder feed
automatically.

Post Processor for robot 3D printing

This section shows how to modify a robot post processor to calculate the
extruder feed before executing each movement. Alternatively, these calculations
can be made on the robot controller.

The first step is to intercept the Extruder
calls and read the new Extruder values (E values) from the RunCode section in
the post processor:

defRunCode(self,
code, is_function_call =False):

if is_function_call:

if code.startswith("Extruder("):

# Intercept the extruder command.

# if the program call is Extruder(123.56)

# we extract the number as a string

# and convert it to a number

self.NEW_E_LENGTH =
float(code[9:-1])

# Skip the program call generation

return

else:

self.addline(code
+ "()")

else:

# Output program code

self.addline(code)

The Extruder value is saved as the
NEW_E_LENGTH variable. Then, we need to define a new procedure that will
generate appropriate extruder feed commands according to the distance between
movements, the robot speed and the robot acceleration. This assumes the
extruder feed is driven by a specific analog output from the robot controller
(analog output number 5 in this example).

defnew_move(self,
pose1, pose2):

if pose1 isNone:

return

defCalculate_Time(Dist,
Vmax, Amax):

'''Calculate the time to move Dist with Amax acceleration
and Vmax speed'''

tacc = Vmax/Amax;

Xacc =0.5*Amax*tacc*tacc;

if Dist <=2*Xacc:

# Vmax is not reached

tacc = sqrt(Dist/Amax)

Ttot = tacc*2

else:

# Vmax is reached

Xvmax
= Dist -2*Xacc

Tvmax
= Xvmax/Vmax

Ttot =2*tacc +
Tvmax

return Ttot

add_material = self.NEW_E_LENGTH
- self.LAST_E_LENGTH

self.LAST_E_LENGTH =
self.NEW_E_LENGTH

if add_material >0:

distance_mm = norm(subs3(pose1.Pos(),
pose2.Pos()))

# calculate movement time in seconds

time_s = Calculate_Time(distance_mm, self.SPEED_MMS, self.ACCEL_MMSS)

# add material

self.setDO(5, (add_material/time_s))

else:

# DO not add material

self.setDO(5,0)

Important: Using
a rounding value will help maintain
a constant speed and minimize the behavior of the acceleration. In that case,
the time can be calculated as distance/speed.

Finally, we need to trigger the new_move
command with each new movement instruction. We can add this call at the
beggining of the MoveL command: