VIRTUAL ENVIRONMENT IN CONTROL AND PROGRAMMING SYSTEM FOR RECONFIGURABLE MACHINING ROBOT

Preliminary note Robotic machining systems play an important role in modern manufacturing. The paper proposes the application of virtual robots for off-line programming. The reconfigurable machining robot, programmed in G-code, which can be directly used by CNC machine tool programmers and operators, is presented. The subject of study are 5and 6-DOF vertical articulated robots that can be configured to emulate vertical and horizontal 5-axis spindle tilting machine tools. The considered machining systems are supported by equivalent virtual robots in the CAD/CAM environment and control system. Several test workpieces were machined to demonstrate the effectiveness of the proposed architecture.


Introduction
The complexity of robot programming in machining applications originates from the fact that robot manufacturers usually use their own proprietary robot programming languages because no industry standard exists.This was a strong motivation for both researchers and leading world robot and CAD/CAM software manufactures to develop versatile robot programming methods which can be divided into two groups: (i) on-line by using standard teach-in robot techniques [1÷3], and (ii) off-line by using versatile software solutions [4,5] such as G-code translators, specific postprocessor solutions, etc.The aforementioned programming methods rely on traditional robot control systems with "normally closed" architecture [6], which is an obstacle to the integration of kinematic modules, programming languages, sensor systems, etc.The state-of-the-art robot programming methods in machining applications are tedious and timeconsuming tasks that require technical expertise.As stated in [7] robot programming represents the main obstacle for utilization of robots in machining applications, especially in small and medium-sized enterprises (SMEs).Finding skilled workers capable of operating with machining robots is the main difficulty for SMEs.
Robot machining simulation is very important in modern manufacturing [4, 8÷12].There are modern specialised CAD/CAM systems for robots, such as the Robotmaster [13], Robot Studio [14], and others.The state-of-the-art virtual robots can be classified into three main types: (i) virtual robots in CAD/CAM systems, (ii) virtual robots in control systems, and (iii) virtual reality robots [15].The subjects of our study are the first two types.
The first idea presented herein is the off-line robot programming by using standardised CAD/CAM, which includes robot machining simulation with movements of robot's 3D solid model segments including tool at the end.The second idea is to integrate a virtual robot into an open architecture control system EMC2 (Enhanced Machine Controller) [16], thus allowing machining simulation in OpenGL 3D environment.The virtual robot enables verification of G-code that includes the following:  Check if the robot can execute the specified path within the limited joints motions ranges and speeds;  Visual detection of collisions between the robot and the tool with the piece and jigs and fixtures.
The paper describes a reconfigurable robot for machining which can be directly used by CNC machine tool programmers and operators.It utilizes direct programming in G-code with equivalent virtual robot in the CAM toolpath programming environment.For G-code programming, we can use standardised CAD/CAM systems like PTC Creo, CATIA, Solid CAM, and others.Virtual robot is applied in EMC2 through usage of OpenGL [17] as an integral part of the control system.Several test workpieces were machined to demonstrate the effectiveness of developed off-line programming, simulation and control system for reconfigurable machining robot.
Results presented in the paper are a part of our broader research in the area of robotic machining that includes reconfigurability, control, programming, calibration and error compensation [9,12].Machining simulation embracing the analysis of cutting forces and machining error compensation is presented in our papers [12,18].
The rest of the paper is organized as follows.In Section 2, the outline of the concept is given.Control and programming system and virtual robots are shown in Section 3. In Section 4, several test workpieces were machined for verification of the control and programming system for Reconfigurable Machining Robot presented.

The outline of the concept
In this paper, the idea is to perform 3-to 5-axis machining using commercially available 5-and 6-DOF articulated robots that emulate 5-axis spindle tilting machine tools (Fig. 1) whereby G-code based programming in a standard CAD/CAM environment is possible.Specialised commercially available 5-DOF machining robots with integrated motor spindle (Fig. 1a) emulate 5-axis vertical milling machines (X, Y, Z, A, B).Commercial multifunctional (standardised) 5-DOF robots (Fig 1b) can emulate 5-axis horizontal milling machines (X, Y, Z, A, B).Commercial multifunctional (standardised) 6-DOF robots can emulate 5-axis machine tools of the following configurations:  5-axis vertical milling machines (X, Y, Z, A, B) where all robot's axes are active, with the tool orientation angle C = const., as shown in Fig. 1c (V).
Experimental 6-DOF articulated robot from Fig. 2 was used for machining simulation, testing and verification of the developed prototype of control and programming system.Appropriate mechanical interfaces between the motor spindle and the interface plate of experimental robot (Fig. 2) enable emulation of 5-axis spindle tilting machine tools with 5-and 6-DOF articulated robots as shown in Fig 1 .Fig. 4 shows CAD models of 6-DOF experimental machining robot which in 5-or 6-DOF robot configurations emulates 5-axis spindle tilting machine tools according to Fig. 1.In all described cases machining is performed on the work table in front of the machine.The robots' reference frames {M} have been adopted according to the standard for relevant machine types [19].
where of workpiece frame {W} is conducted according to the procedure for 5-axis CNC machine tools without changing the G-code.
In this stage of development, the system makes it possible to work with parallel coordinate frames {M} and {W} only, which means To complete the vectors of world coordinates, it is also necessary to determine tool orientation angles (A, B) and (A, C) which define only the direction of tool axis T z for the relevant cases from Fig. 4.
The description of the position and orientation of one frame relative to another, e.g. in this case of the frame {T} relative to the frame {M}, can be represented through homogenous coordinate transformation matrix 4 × 4, [20÷22], as where rotation matrix R M T represents the orientation, while vector T M p represents the position of the frame {T} with respect to the robot's reference frame {M}.To bring the tool axis, i.e. the axis T z of the frame {T}, to a desirable angular position with respect to the frame {M}, the frame {T} must be rotated appropriately about the axes of the coordinate frame {M}:

Emulation of vertical milling machine (X, Y, Z, A, B) tilting spindle includes case (1.1), case (2.1) and case (3.1)
To bring the tool axis T z of the frame {T} to a desirable angular position with respect to the frame {M}, the frame {T} must be rotated first about axis M X by angle A, and then about axis M Y by angle B, as prescribed by the convention for 5-axis tilting spindle machine tools (X, Y, Z, A, B).The equivalent rotation matrix R M T can be further derived as where rotation matrices from Eq. ( 6).This way, the world coordinate vectors for the case (1.1), (2.1) and (3.1) (Fig. 4) can be expressed as

Emulation of horizontal milling machine (X, Y, Z, A, B) tilting spindle type includes cases (1.2), (2.2), and (3.2)
In these cases, to bring tool axis T z of frame {T} to a desirable angular position with respect to the frame {M}, the tool frame {T} must be rotated first about axis M Y by the angle B and then about axis M X by the angle A, as prescribed by the convention for this machine type.The equivalent rotation matrix R M T can be further derived as As the orientation of tool axis T z specified by unit from Eq. ( 7) [20,23].This way, the world coordinate vectors for the cases (1.2), (2.2) and (3.2) (Fig. 4) can be expressed as

Emulation of vertical milling machine (X, Y, Z, A, C) tilting spindle type relates to the case (3.3)
In this case, to bring the tool axis T z of the frame {T} to a desirable angular position with respect to the frame {M}, the tool frame {T} must be rotated first about the axis M X by the angle A and then about the axis M Z by the angle C, as prescribed by the convention for this machine type.The equivalent rotation matrix R M T can be further derived as As the orientation of tool axis T z specified by unit from Eq. ( 8) [20,23].This way, the world coordinate vectors for the case (3.3) (Fig. 4) are expressed as It should be noted here that in the cases where the 6-DOF robot performs 5-axis machining, the angle which is not included in world coordinate vectors is taken to be blocked (i.e.C=0).
The modelling approach, inverse and direct kinematics, workspace analysis of reconfigurable machining robot programmed in G-code are described in [9,10].
In the case of very complex workpieces requiring multifaceted machining, the proposed control and programming system allows robot reconfigurations (with no physical interventions) into different vertical or horizontal 5-axis machines.This solves the problems of robot singularity and the problems of limited joint motions.As an example, Fig. 5 shows a case where complex surfaces on the upper side of the workpiece would be machined using programmes for 5-axis vertical machine (X V , Y V , Z V , A V , C V ), case (3.2), whereas complex surfaces on the lateral sides of the workpiece would be machined using programmes for 5-axis horizontal machine (X H , Y H , Z H , A H , B H ), case (3.3).

Control and programming system with virtual robots
The development of the control and programming system prototype for 5-axis machining by articulated robots with 5-and 6-DOF is based on EMC2 software.EMC2 was initially created by the NIST (National Institute of Standards and Technology) and is a free software released under the terms of the GPL (General Public License) [24,25].
Fig. 6 shows a simplified structure of the first control and programming system.As it is obvious, the programming part is very conventional, with the use of appropriate postprocessor to convert CLF into G-code, according to ISO 6983.This means that the programmer starts from the workpiece CAD model in a common way, in this case in CAD/CAM system, generating CLF.The generated tool path is tested through the NC check (animated display of tool path and material removal).Using the configured postprocessor for the vertical (V) or horizontal (H) 5-axis milling machines (X,Y,Z,A,B) or (X,Y,Z,A,C) spindle-tilting type, post-processing of CLF is done to obtain the program in G-code, which is transferred to the robot control system.In the control system a choice is made for vertical (V) or horizontal (H) 5-axis milling machine with appropriate transformation matrices T M T , T M 0 and T T 6 .For testing the functions of inverse and direct kinematics [9,10] and collision detection, a virtual robot is configured.The virtual robot is configured using several predefined Python classes [16] and OpenGL in EMC2.Based on inverse and direct kinematics equations, kinematic module is programmed in C language and is integrated in EMC2 software system (Fig. 6).

Virtual robots in programming system
The configured virtual robot is used for the simulation of tool path generated in CAD/CAM (PTC Creo 2 [26]) environment, which is important in order to: (i) configure the off-line programming environment, (ii) verify program before machining, (iii) detect collision during program execution [27÷30].
The virtual robot in CAD/CAM environment, contains all relevant components of the robot mechanism, including kinematic relations between moving segments.In-between the robot segments are rotary axes (Pin) (Fig. 7a).This virtual robot enables the motion of segments in ranges defined in the real robot (Fig. 7b) which is of particular importance for the identification of possible collisions during the simulation process.Tool tip moves according to the tool path, which was previously obtained from the CAD/CAM.Post-processing is the same as for the 5-axis vertical or horizontal milling machine, spindle tilting type.The postprocessor is configured using the post-processor generator in the CAD/CAM system.

Virtual robots in control system
Reconfigurable machining system has been tested in our laboratory.Since it is a robotic system with complex kinematics, a virtual robot is also included in the control system.
Virtual robots are configured in the programming language Python using OpenGL [17].The algorithm for model configuration is shown in Fig. 8.
The modelling process of the virtual model boils down to the input of coordinates which define elementary geometric bodies.Simplified CAD model can be generated using the geometric primitives such as Box, Cylinder, Sphere, etc.It can also be made by using AsciiSTL or AsciiOBJ file for each robot segment, as displayed in Fig. 8.As a result, one gets a virtual robot in OpenGL which integrates in graphical interface Axis of EMC2.Simulations are performed to verify the program before machining in real time control unit.
Virtual simulation allows off-line programming with verification and testing on a remote site without machine engagement.Since there was a word about the real-time simulation of the machine, it can also be used for monitoring of machining operation from remote location.Working in the virtual environment is also suitable for training and education in programming of such manufacturing systems.The aim of machining experiments was to test the capabilities of the developed system.
The PTC Creo 2.0 was used for the experiments with the idea that the programming of machining robot and machining itself is done in exactly the same way as it is done on a 5-axis vertical milling machines (X, Y, Z, A, B) and (X, Y, Z, A, C) or 5-axis horizontal milling machine (X, Y, Z, A, B) spindle-tilting type.Machining experiments were conducted to machine two workpieces of light materials and lower tolerance.Prior to machining the programs are tested in EMC2 on a virtual machining robot in order to perform the final verification of the program (Fig. 9 and Fig. 10).To verify the control and programming system with virtual robots, the test workpiece was machined.Fig. 10a shows virtual robot and Fig. 10b shows a real robot doing 5-axis machining of a calotte on the test workpiece.This experiment employs standardized 6-DOF robot, case (2.2).
To verify the robot reconfigurability (with no physical interventions) a test workpiece requiring multifaceted machining (Fig. 11) was designed and performed.
Fig. 11a shows a CAD model of the designed test workpiece on which machined surfaces (that were machined) are indicated as follows:  3-axis machining 3V (Fig. 11c) and 5-axis machining 5V (Fig. 11d) on an emulated 5-axis vertical tilting spindle milling machine (X, Y, Z, A, C), case (3.3);  3-axis machining 3H (Fig. 11b) and 5-axis machining 5H (Fig. 11f and Fig. 11g) on an emulated 5-axis horizontal tilting spindle milling machine (X, Y, Z, A, B), case (3.2);  Finally machined workpiece is shown in Fig 11e.These experiments have confirmed that it is possible to realise a reconfigurable machining robot for different versions of emulated 5-axis milling machines, shown in Fig. 4.

Conclusion
The paper presents the concept of reconfigurable machining robot and its equivalent virtual robot in the control and programming system.In this stage, the proposed concept of control system with programming in G-code is based on EMC2 software and generalized modelling approach of 5-and 6-DOF vertical articulated robots which can be configured to emulate vertical and horizontal 5-axis machine tools with spindle-tilting.
The presented control and programming system with virtual robots helps users to utilize robots in machining applications, especially in SMEs, allowing control and programming to become intuitive, cost-effective, quickly implemented, without the usage of the robot specific language.
The proposed control architecture is a low-cost and low-setup time system, where no advanced robot programming skills are required from the operator, which means that it can be directly used by CNC machine tool programmers and operators.The developed system provides an integrated reconfigurability of the machining robot that allows multifaceted machining with different robot configurations in one workpiece setup.
Experimental prototype of the control and programming system for 5-axis machining by articulated 5-and 6-DOF robots indicates that it is possible to encapsulate robots' kinematics into a control system enabling the use of industrial robots for machining applications in the same way as commercially available machine tools.

Figure 4
Figure 4 Geometric models of 5-and 6-DOF vertical articulated robotsGeometric models of 5-and 6-DOF vertical articulated robots (Fig.1and Fig.3) which can be configured and reconfigured to emulate different types of vertical and horizontal 5-axis spindle tilting machines are shown in Fig.4.Displayed geometric models allow for a generalised modelling approach that represents a basis for the development of a reconfigurable control system.The robots' reference frames {M} have been adopted according to the standard for relevant machine types[19].Tool frames {T} are attached to the milling tools at tool tip T and frames {W} are attached to the workpieces.Vectors v referenced in frames {M} and {W} are denoted

for 6 -
Tool frames {T} are attached to the milling tools at tool tip T and frames {W} are attached to the workpieces.Vectors v referenced in frames {M} and {W} are denoted by v DOF articulated robot.The description of world coordinates is based on the tool path calculated by CAD/CAM systems defined by a set of successive tool positions and orientations in workpiece frame {W}, all cases in Fig.4.The thus calculated tool path is machine independent and is known as a cutter location file (CLF).A tool pose is defined by the position vector of tool tip T in workpiece frame {W} as is defined by the unit vector of the tool axis as axes of frames {M} and {W} need not be parallel in a general case, the tool tip position vector T M p and unit vector of tool axis direction in the robot's reference frame {M} T M k can be expressed as [ ] the position vector of the origin of workpiece frame {W} and R M W is an orientation matrix.It should be noted that the determination of the position vector only, the angles A and B can be determined by equating T M k with the corresponding members of matrix R M T interest only, the angles A and C can be determined by equating T M k with the corresponding members of matrix R M T

Figure 5
Figure 5 An example of robot reconfiguring for multifaceted machining

Figure 6
Figure 6 Control and programming system

Figure 7 Figure 8
Figure 7 Virtual machining robot in programming system and real robot

Figure 9
Figure 9 Virtual machining robots 4 Experiments

Figure 10
Figure 10 Virtual and real robot during simulation and 5-axis machining of a calotte on the test workpiece

Figure 11
Figure 11 Machining experiments in the case of multifaceted machining