Augmented Reality Simulation of CAM Spatial Tool Paths in Prismatic Milling Sequences

. Augmented Reality (AR) technology to support learning activities becomes a trend in education and effective teaching aids for engineering courses. This paper presents initial results of a project aimed to transform the current learning process of Computer Aided Manufacturing (CAM) by designing and implementing an interactive AR learning and simulation tool to help students to develop a comprehensive understanding of technological models and features in milling processes. We present a marker-based platform that uses AR as a medium for representation of prismatic milling processes to facilitate CAM education and it should enable a faster comprehension of complex spatial paths and overall machining system.


Introduction
Augmented reality (AR) is a technology which renders CAD objects into the real scene by registering virtual CAD model over a user's view in real world at real-time (in situ) [1], [2]. With additional information embedded in CAD models physical world can be enhanced/augmented beyond user's normal experiences and perceptions. The user can interact with digital information projected onto the real surfaces within a workspace in natural manner. On the other hands, modern CAD/CAM software offer an overwhelming variety of complex features, models and processes in multimodular product development and production. With augmented reality, CAD models and CAM simulations can be extended for better perceptions of digital 3D design and manufacturing process. This article introduces the applications of AR technology in practical CAD/CAM education and simulation of milling process, and will discuss the significance of AR based learning in machining process planning. The core of this interactive system consists of video image processing techniques and interactive 3D simulation of tool movements in a specific milling sequence.

Augmented Reality
The concept of an Augmented Reality based Magic Book was firstly introduced in 1997 [4]. The basic principle is that a real book is enhanced using Augmented Reality (Fig.1). Virtual objects are superimposed on the different pages of the book in the Augmented Reality mode. If the user is interested in a specific scene, he can fly into the scene by switching to the Virtual Reality mode and inspect it from the inside.
In recent years Android smart phones and tablets became an increasingly popular devices for AR, combining all needed components (camera, display and processing power) for video based Augmented Reality in a compact form [5].  [3] For this reason and the fact that smart phones and tablets became widespread devices we choose to build our system as a video based Augmented Reality system for Android devices. Also, it is important to emphasize that there are marker-based and markerless-based principles of AR algorithms [3], [4].

Augmented Reality Aided Manufacturing
Generally, AR is a concept of enhancing the real world with additional virtual information and it can be used to create an integration of process data with workspace of an industrial CNC machine (Fig.2). Independent of specific technologies, an AR system has to meet the following requirements: Combine real and virtual worlds, Augmentations are interactive in real time, Augmentations are registered in 3D to the real world. This concept also included multi-scale collaboration, which enables multiple users to experience the same virtual environment. For our system we omitted the Virtual Reality mode as it is impractical for our application. We still have support for collaboration, as several users can see the same virtual model on the book page.

Computer Aided Manufacturing -CAM
Based on CAD models and specific drawings (Fig.3), operators are able to generate technological features and NC code for physical material removing. In that course we used standard procedures to prepare technological model of milling in the CAM (Computer Aided Manufacturing) module.

Creating 2.5D milling sequences
In the case of production computer-aided process planning (CAPP) in milling sequences, stock part is fixed, by the fixtures on the machine table in the XY plane, while the tool axis is directed in Z axis of the machine. Based on the shape of pockets, tool path styles may be different and may combine linear and/or circular segments (linear, counterclockwise and clockwise interpolations). In the 2.5D milling operation, we defined the following technological features: 1. Machine system (HAAS 3-axis Machine.1), stock part (164x164x30mm) and machining part; 2. Default reference machining axis located on the stock corner; 3. Models of fixture devices, safety planes and default tool change point; 4. Parameters of the machining process (feed rates, spindle speeds, feeds and speeds, approach/retract, etc.) and machine tools; 5. Geometry of the machining part and stock (volumes, planes, islands, contours, curves, etc.); 6. Milling strategies (axial, radial, profile), and styles (spiral, back and forth, one way, inward helical, etc.).
By defining and simulating all milling sequences in CAM modules like Prismatic Machining in PLM system CATIA [6], user generate P.P.R. structure of the process and manufacturing program, easy to edit in the future if needed (Fig.4). In order to obtain the final shape of the part, we combined facing, pocketing, profile contouring and curve following operations in just one program. Some of the milling sequences are given in Table 1. Fig. 4. Machining part created in PLM system CATIA a) P.P.R. tree, b) Virtual CAD model and c) selected milling pocket

Manufacturing Program Code -CATNCode
After post processing the APT code using postprocessor Sinumerik_840D_3X.pp, CATNCcode is generated, and for specific level of selected pocketing milling it has the following commands, presented in Table 2. From those NC commands, we extracted segments of paths and movements in xyz coordinates and transfer them to AR platform in order to simulate the tool's movement over the 3D model, on the screen (Fig.5). To demonstrate the AR possibilities on a specific milling sequence we selected Pocketing.7 from Part Operation/Manufacturing program (Fig.5) to check process virtually before physical machining (Fig.6).

Fig. 6. Real machining part and pocket after milling
All CAD models from PLM system CATIA are exported in appropriate format *.wrl, and then in *.obj. We involved CAD model of the machine HAAS in order to represent overall system (Fig.7).

Proposed AR system
Our AR system is composed of a tracking framework to provide the necessary tracking data and an advanced software engine for rendering the virtual models and interaction with the augmentations.

System description
As the tracking framework we are using UbiTrack [7]. UbiTrack is an open source, general purpose tracking framework for Augmented Reality developed by CAMPAR group (TUM Munich, Germany). UbiTrack has been successfully adopted to Microsoft Windows, Linux, Mac OS and Android [9]. For the software engine we are using Unity3D [8] for the ease of use and its platform independency. This allows us to deploy our application to all desktop systems and Android devices without any need to change the source code of the application.
To fulfill all requirements for an AR system, the key step is to estimate the position and orientation of the camera in respect to the axis of the scene. To do this we employ a technique called "marker tracking", in the case of QR marker based augmented reality system [10], [11].

Marker tracker
Marker tracking means finding an optical square marker in the scene and estimating its relative position to the camera. A squared QR marker has an encoded ID and consists of a black square with a white border and a predefined size and shape of pattern. Different techniques can be used to encode the ID like template matching or the encoding as a binary number. Key steps of the marker tracking pipeline is illustrated in Figure 8.

Fig. 8. Marker tracker pipeline -2D image processing and recognitions
In the first step the image from the camera is converted to a gray scale image to speed up the image processing in all further steps. Since the square markers are only black and white we can threshold the gray image in the second step to generate a binary image. This will remove noise and most of the environment from the image, which again allows a much faster processing for the next step. The third step consists of finding all of the contours that are left in the binary image. Of these contours only contours with exactly four corners are selected as potential square markers for the following steps. In step five, the algorithm tries to determine whether a specific rectangle is a part of an optical square marker or a part of the environment by extracting the ID of the marker from the gray image.
By using the camera image as the background (real world) in our display and using the pose of the marker we now can superimpose the camera image with the virtual object (virtual world) [12]. When the marker or camera is moved the augmentation stays on the marker (registered in 3D). The marker tracking pipeline is computationally inexpensive, so we can keep all interactions with the virtual objects in real time (Fig.9). This paper discusses how spatial augmented reality may be used to support understanding of milling operations in the machining processes, by projecting augmentations (machines, machining parts, tools, NC paths) on objects in real machining system [13].
By recognizing the ID of the square-sized marker, the application determines which CAD model to display in the scene. The 3D model database is created using educational PLM system CATIA. Employing desktop version of developed AR platform and a camera, operators are able to go through the entire process. Focusing the camera on the markers retrieve the virtual 3D objects from database and the information and graphics are then overlaid onto the screen (Fig.9) [14]. The database may be updated with new models even by operators that have a little knowledge about programming.

Conclusions
In this paper, we are focused on moveable interactive augmentations of 3D model of milling tool and its displaying in the correct position in the specific milling pocket. The proposed system makes possibility to enhance visibility of occluded tools as well as to visualize real-time data from the machining process by adding visual feedback to augment and amplify operator's sense and understanding and simplifying operation. In the near future, our aim is to highlight current NC (Numerical Control) code in current operation and overlay textual G-code and M-code instructions on the screen. The proposed system can be used as a simulator which allows virtual experiments with combinations of virtual tools without the need for destructive and costly physical testing. The operation information and other media (e.g. pictures, animations, videos, etc.) can be also projected onto the screen or physical surface of the machining part in the scene.