{'fraction_non_alphanumeric': 0.022894084479657805, 'fraction_numerical': 0.005589850775287999, 'mean_word_length': 4.571080422420796, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
What the HoloLens Maps Is Your Workspace: Fast Mapping and Set-up of Robot Cells via Head Mounted Displays and Augmented Reality

Classical methods of modelling and mapping robot work cells are time consuming, expensive and involve expert knowledge. We present a novel approach to mapping and cell setup using modern Head Mounted Displays (HMDs) that possess self-localisation and mapping capabilities. We leveraged these capabilities to create a point cloud of the environment and build an OctoMap - a voxel occupancy grid representation of the robot's workspace for path planning. Through the use of Augmented Reality (AR) interactions, the user can edit the created Octomap and add security zones. We perform comprehensive tests of the HoloLens' depth sensing capabilities and the quality of the resultant point cloud. A high-end laser scanner is used to provide the ground truth for the evaluation of the point cloud quality. The amount of false-positive and false-negative voxels in the OctoMap are also tested.


I. INTRODUCTION
Knowledge of the robot environment is essential both in offline programming and for auto-generated trajectories as most manipulators lack external sensors to allow them the ability to map their own environment.
Programming robotic manipulators is classically a time consuming process requiring expert knowledge. Offline programming is generally preferred to online, lead-through programming due to smaller downtimes [1]. Offline programming, however, requires a precise model of the working environment which is often a time-consuming undertaking requiring exact 3D models of the objects around the robot and precise measurements of their placement. Even then, the final program needs to be tested and verified inside the real workspace itself. As it requires significant financial investment, expert knowledge and long delivery times, offline programming is unsuited for small and medium enterprises which require intuitive and fast robot programming paradigms [2].
Likewise setting up safety zones is a time consuming process, mostly done offline and then checked and rechecked until all safety zones are validated.
In this paper we propose a cost-efficient method to set-up the working environment of the robot that doesn't require any expert knowledge and combines exceedingly well with newer, AR programming paradigms such as the one presented in [3]. It leverages the localisation and depth sensing capabilities of modern HMDs to map the workspace of the robot. This map is then represented as an OctoMap -a 3D occupancy grid of voxels. The user is then able to add safety zones in situ and edit the OctoMap to, for example, allow collisions in parts where the use case requires contact with specific surfaces.
The structure of this paper is as follows. In Section II the state of the art and related work is presented. The contribution of this paper to the state of the art is outlined. Section III describes how the point cloud is constructed (Section III-A, how the coordinate transform between the robot and the HoloLens coordinate systems is obtained (Section III-B), and finally how the OctoMap is built and edited (Section Fig. 2: (a) The mapped point cloud with points more than 3.3 meter distant from the depth sensor at the time of capture marked in red. Points at less than 1 meter are marked in purple; (b) Point cloud with points more than 3.3 meter distant removed. One can see the presence of sparse outliers that can be filtered out; (c) Point cloud with points more than 3.4 meters away removed. The outliers are much denser requiring more aggressive filtering which may degrade the quality of the inliers.
III-C). In Section IV the experiments used to validate our approach are described and the results discussed. The paper ends with Section V where the conclusions are given and future improvements are outlined.

II. RELATED WORK
Although most industrial robot manufacturing companies offer software for offline programming of robots, such as ABB's RobotStudio or KUKA's KUKA.Sim, these require precise CAD models of all objects in the environment as well as exact calibration between the virtual and the real robot cell.
Neto et al. [4] describe a more intuitive offline programming method based on the common CAD package Autodesk Inventor. The user inputs tool coordinates and a program is automatically created. This still requires precise CAD models and calibration. They note that calibration errors are a major source of inaccuracies. According to the authors calibration requires expensive measurement hardware, software and expert knowledge. They also note that external sensing can help mitigate the errors of offline programming.
In [5] a trajectory is auto-generated for a spray-painting task by using range images of the part to colour. The collision-free trajectory generation, however, still required a model of the robot cell.
In the field of AR-based robotics, several approaches exist to plan robot motion in unknown environments. Ong et al. [6] use a tracked pointer tool to manually input trajectories and define collision-free volumes. However, no map of the environment is created and only a small part of the total collision-free volume is used. The authors themselves note that alternative methods for generating collision-free volumes should be explored.
Similarly, Quintero et al. [3] use holographic waypoints and B-spline interpolation to plan robot trajectories. The system relies on the user to manually modify trajectories to avoid obstacles. The mesh of the environment generated by the HoloLens is used to define waypoints on surfaces, yet the map itself is not used further.
In [7] the environment of a telepresence robot is mapped to allow the overlay of virtual fixtures -virtual objects for operator assistance. The motion of the robot arms, however, is guided by the user and no programming was implemented.

A. Contributions
This paper extends the previous approaches in several ways. Firstly by mapping the environment with multipurpose HMDs we eliminate the need for any overhead equipment for cell setup or the need for CAD data of the surrounding objects. HMDs have been used for robot intention visualisation [8], collaborative task planning [9] and as previously mentioned programming [3] just to name a few.
Secondly the map created this way can be used both for offline programming or as an addition to AR-based approaches such as the one in [3]. In the later case, it allows the use of higher-level motion planning to plan collision-free trajectories, such as MoveIT!. This significantly decreases the programming effort for the user.
Finally, we perform thorough tests of the depth sensing capabilities of the HoloLens. As of yet such tests have not been performed. This data will provide useful metrics and possible failure cases for future research.

III. METHODOLOGY
The system consists of two main components, the HoloLens HMD and a desktop computer connected to the robot and running the Robot Operating System (ROS) [10]. Communication between the desktop and the HoloLens is mediated via the ROSBridge package than allows seamless interfacing between ROS nodes and programs running on different systems.
For point cloud editing and filtering the open source Point Cloud Library (PCL) [11] was used. The OctoMap representation and the path planning is done using the MoveIt! path planner.
On the HoloLens side, the AR interface was constructed using the Unity3D engine. For the capture and streaming of depth information the HoloLensForCV library package was used. Communication with ROS was done using the ROS# library which provides ROSbridge clients for .Net applications, like Unity3D.

A. Mapping
Two different methods of obtaining the point cloud of the environment have been implemented. The first approach uses the mesh of the environment already generated by the HoloLens. Randomly a mesh triangle is chosen, weighted by the size of the triangles. Then, using barycentric coordinates, a random point within the triangle is selected and saved to the point cloud. The number of iterations of this process, and therefore the size of the resulting point cloud, can be chosen. The resulting point cloud is filtered with voxel grid filtering to obtain a uniform point density.
After Microsoft allowed access to the depth stream with the research mode, the raw depth data could be used and the point cloud generated directly. The depth sensor on the HoloLens provides two depth streams, the short-throw depth stream, with 30 frames per second update rate and a range Fig. 4: The edited environmental voxel grid and safety zones as visualised in RViz. To note is that the table in this application was part of the robot description file. If a CAD model exists and the robot should interact with that part of the environment, adding it to the robot model will filter out the unwanted voxels automatically. of 0.2-1 meters, and a long-throw depth stream, with 1-5 frames per second update rate and a range of 0.5-4 meters.
Combined with the localisation capabilities of the HoloLens, the different depth frames can be fused into a single point cloud of the environment. We registered the point data of different frames to the main point cloud using the HoloLens' own localisation as the initial guess and ICP [12] to refine the guess. It was found, however, that the HoloLens' localisation is precise enough that ICP does not significantly increase the precision. Therefore the registration step may be skipped. This shall be demonstrated in the experiments in Section IV-A.
We then discard points that are below the minimum cut-off distance D cut−of f min to eliminate points that may belong to the user's hand, and above the maximum cut-off distance D cut−of f max to eliminate low quality points. The maximum cut-off distance was experimentally determined to be 3.3 meters (Fig. 2). The minimum cut-off distance was taken to be one meter, around the reach of the user's arms. Therefore we can use only the long-throw stream and discard points further than 3.3 meters.
The resulting point cloud is down-sampled using voxelgrid filtering to ensure uniform point density. It is then filtered with an outlier removal filter, removing any point that had less than 9 neighbours in a radius of 5 cm, and smoothed with moving least squares [13]. Finally RANSAC plane detection is used to detect planes and map all the points near the plane to the plane itself. This improves the resolution of objects on floors and tables.

B. Referencing
To get a robust coordinate transform between the HoloLens and the robot world coordinate system, a semiautomatic referencing approach is used [14]. The user is asked to position a seed hologram near the robot base and rotate it approximately towards the front of the robot. Using the universal robot description file (urdf) and the link meshes of the robot a point cloud of the robot is created. The model, together with the map of the environment and the position of the seed hologram, are used as the input to an ICP registration algorithm. As the ICP is highly sensitive to local minima, the seed cube is paramount to get a robust coordinate transform. As shown in [14] the positioning of the seed hologram doesn't have to be precise but merely near the base of the robot.

C. Workspace Representation and Editing
After obtaining the position of the robot in the HoloLens' environmental point cloud in the referencing step, all points of the map outside the maximum reach of the robot are removed. To do this a kD-tree representation of the point cloud is first constructed. The kD-tree is a data structure that facilitates radius and nearest-neighbour searches. We then filter all the points further away than D reach from the (0,0,0) point, which is taken as the base of the robot.
The point cloud is then once again down-sampled with a voxel-grid filter with voxel size D leaf , which is the size of the voxels in the OctoMap. For each point in the model point cloud of the robot, a nearest-neighbour kD-tree search is performed to remove all the robot points from the scene. Finally the resulting point cloud is used to generate an OctoMap voxel grid representation of the occupancy as seen in Fig. 1.
The generated voxel occupancy grid is sent to the HoloLens where a user may edit the occupancy grid. This step allows the user to correct errors in the map if needed be. It also allows for voxel removal from parts of the environment where contact with the environment is needed to perform the robot's task. Finally, safety zones can be defined in situ, drastically reducing the set-up and test times. In Fig. 3 the overlayed robot model, the rendered OctoMap, and the set up of the safety zones can be seen.
When the user is done, the safety zones and the edited OctoMap are sent back to the computer. As the user can freely move and add voxels through AR on the HoloLens, these voxels must be snapped back to the voxel grid. These OctoMap environmental representations can be saved, loaded in MoveIt! and edited with the HoloLens as many times as necessary. Likewise, one could safe different voxel grids and safety zones depending on the task for future uses. A representation of an edited map and safety zones in RViz can be seen in Fig. 4.

IV. EXPERIMENTS AND RESULTS
In this section we present in-depth tests of the HoloLens' spatial mapping capabilities. The experiments to test the precision of the direct measurements from the depth sensor as well as the quality of the resulting point cloud are presented in Section IV-A. In Section IV-B we present the experiments and the results to test the quality of the resulting OctoMap by counting the amount of false-positive and falsenegative voxels in the occupancy grid of a test scene. Further tests with the robot and the motion planer itself revealed a particular failure case which will be addressed in Section IV-C. The results of the previous tests shall also be discussed.

A. Evaluation of Depth Sensing Capabilities
The first set of experiments were aimed to test the noise of the depth sensor data as well as any influence of the position of the pixel. A flat cardboard surface was positioned at 1 and 2 meters respectively from the HoloLens' depth sensor. The HoloLens was rotated so that one of the designated five points pictured in Fig. 5(a) lies on the cardboard surface. A total of fifteen consecutive depth frames were taken for each pixel and each distance for a total of 150 measurements. The results are depicted in Table I. The standard deviation of the depth measurement fluctuations around the average was found to be 3 mm and the maximum fluctuation around the average 5 mm.  In the second set of experiments a 5x5 pixel square in the centre of the depth image was selected and the values measured. Again a flat cardboard surface was placed 1 and 2 meters away respectively. For each distance 5 repetitions were carried out to average out human positioning error. For each repetition 5 consecutive frames were used for a total of 50 measurements. The setup can be seen in Fig. 5(b). The averages can be seen in Table II. The maximum error of the averages of each square is 11.2 mm and the total average error is 6 mm.  In the third set of experiments we took scans of our laboratory using a Faro Foucus S laser scanner with 1 mm precision as the ground truth. We compared it to a point cloud generated by the HoloLens. The HoloLens' point cloud was tested with four different combinations of using ICP for registration or not and using the post-processing step, consisting of MLS smoothing and RANSAC plane detection and projection, or not. Firstly we selected the parts of the environment where the two scans overlap (see Fig. 6) and measured the average euclidean distances and the Hausdorff distances, the greatest distance between two closest points in the two point clouds, of the four combinations. The results are presented in Table III. One can see that apparently the post-processing step introduces a bigger error. The large Hausdorff distance can likewise be attributed to left-over discrepancies in the two point clouds either as a result of missed holes or the fact that the point clouds are taken at slightly different time in a changing environment. To get a better estimate of the precision of the two point clouds we used CloudCompare. CloudCompare gives the percentile distribution of distances between the two point clouds and therefore offers a much better insight into the quality of the point cloud generated from the HoloLens. The results are shown in Table IV. One can see that the best performance is the mapping without ICP, meaning that the HoloLens localisation is as precise as the point cloud, and with post-processing. In this case 75 percent of points have an error of 3.6 cm or lower. A visual comparison of the four point clouds to the ground truth can be seen in Fig. 7.

B. Evaluation of the OctoMap
To evaluate the quality of the OctoMap generated from the HoloLens' point cloud we placed a wooden 20x20x30 cm cuboid on the front-left of the table. We assumed the worst case scenario of using the sampled environmental mesh of the HoloLens. Khoshelham et al. [15] found that the average global error of the HoloLens' environmental mesh is around 5 cm. We counted the total number of false-positives, i.e. the voxels that are detected as occupied by the object that are in fact not, and false-negatives, i.e. voxels detected as free that are in fact part of the object. The results presented in Table V show that on average there are 9.58 false-negatives and 61.33 false-positives with 12 point clouds tested. Worth noting is that the false-negatives are much more critical as they can cause crashes while false-positives only slightly limit the collision-free volume. Also worth noting is that some false-negatives are hidden behind false-positive voxels or near the table and are therefore unreachable. We also carried more than 50 tests to try to provoke collision in the cluttered scene shown in Fig. 1. The tests showed that there are indeed edge cases were a collision might happen i.e. when objects are positioned diagonally. A solution for these edge cases are presented in the next subsection.

C. Discussion
We have shown that the HoloLens environment mapping capabilities, with a MLS smoothing and RANSAC plane finding and fitting stage can produce a point cloud where 75 percent of the point lie within 3.6 cm of a ground truth point cloud captured with a high-end laser scanner.
The OctoMap voxel occupancy grid performs adequately even in the worst case scenario where a sampled environemtnal mesh of the HoloLens was used.
To mitigate the edge cases, a padding algorithm was developed. Each new level pads the surface of the starting voxels iteratively with voxels half the size of the starting voxels, as illustrated in Fig. 8. Even with one level of padding, it was shown that the edge cases were eliminated and no collisions occurred anymore.

V. CONCLUSION AND FUTURE WORK
For robotic applications to really become ubiquitous in enterprises of any size, easy set-up and programming of robots is crucial. In this paper we presented a robot cell modelling approach that relies on the Microsoft HoloLens to reference and map the previously unknown environment of the robot. As the amount of research in AR-based humanrobot interaction and programming is has seen major growth in recent years, a plethora of such programs and research can be combined with our approach to reduce user workload and extend the area of possible applications.
We have proven that the mapping and localisation capabilities of the HoloLens are more than adequate for such an application. Even if errors do occur, the interactive editing of the environmental map and the safety zones can quickly remove such errors. Furthermore the map can be edited for different task quickly and efficiently.
There is still plenty of room for improvement, however. We developed a programming approach based on the work of Quintero et al. [3], which should be integrated with our approach. User tests should be made to see if the perceived workload of the users is indeed lowered when using the proposed environmental mapping. Another exciting research direction is using a dynamic map for the interaction with the robot as well as sharing and fusing of sensor data if the robot  is also equipped with sensors. In the authors opinion such on-line sharing of data could be a great benefit in proximal human-robot collaboration.