{'fraction_non_alphanumeric': 0.031049340993578912, 'fraction_numerical': 0.007265968232510984, 'mean_word_length': 4.584571832979476, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Out of the Box: Embodied Navigation in the Real World

The research field of Embodied AI has witnessed substantial progress in visual navigation and exploration thanks to powerful simulating platforms and the availability of 3D data of indoor and photorealistic environments. These two factors have opened the doors to a new generation of intelligent agents capable of achieving nearly perfect PointGoal Navigation. However, such architectures are commonly trained with millions, if not billions, of frames and tested in simulation. Together with great enthusiasm, these results yield a question: how many researchers will effectively benefit from these advances? In this work, we detail how to transfer the knowledge acquired in simulation into the real world. To that end, we describe the architectural discrepancies that damage the Sim2Real adaptation ability of models trained on the Habitat simulator and propose a novel solution tailored towards the deployment in real-world scenarios. We then deploy our models on a LoCoBot, a Low-Cost Robot equipped with a single Intel RealSense camera. Different from previous work, our testing scene is unavailable to the agent in simulation. The environment is also inaccessible to the agent beforehand, so it cannot count on scene-specific semantic priors. In this way, we reproduce a setting in which a research group (potentially from other fields) needs to employ the agent visual navigation capabilities as-a-Service. Our experiments indicate that it is possible to achieve satisfying results when deploying the obtained model in the real world. Our code and models are available at https://github.com/aimagelab/LoCoNav.


Introduction
Embodied AI has recently attracted a lot of attention from the vision and learning communities. This ambitious research field strives for the creation of intelligent agents that can interact with the surrounding environment. Smart interactions, however, require fine-grained perception and effective planning abilities. For this reason, current research focuses on the creation of rich and complex architectures that are trained in simulation with a large amount of data. Thanks to powerful simulating platforms [6,13,17], the Embodied AI community could achieve nearly perfect results on the PointGoal Navigation task (PointNav) [16].
However, current research is still in the first mile of the race for the creation of intelligent and autonomous agents. Naturally, the next milestones involve bridging the gap between simulated platforms (in which the training takes place) and the real world [7]. In this work, we aim to design a robot that can navigate in unknown, real-world environments.
We ask ourselves a simple research question: can the agent transfer the skills acquired in simulation to a more realistic setting? To answer this question, we devise a new experimental setup in which models learned in simulation are deployed on a LoCoBot [8]. Previous work on Sim2Real adaptability from the Habitat simulator [13] has focused on a setting where the real-world environment was matched with a corresponding simulated environment to test the Sim2Real metric gap. To that end, Kadian et al. [7] carry on a 3D acquisition of the environment specifically built for robotic experiments. Here, we assume a setting in which the final user cannot count on the technology/expertise required to make a 3D scan. This experimental setup is more challenging for the agent, as it cannot count on semantic priors on the environment acquired in simulation. Moreover, while [7] employs large boxes as obstacles, our testing scene contains real-life objects with complicated shapes such as desks, office chairs, and doors.
Our agent builds on a recent model proposed by Ramakrishnan et al. [10] for the PointNav task. As a first step, we research the optimal setup to train the agent in simulation. We find out that default options (tailored for simulated tasks) are not optimal for real-world deployment: for instance, the simulated agents often exploit imperfections in the simulator physics to slide along the walls. As a consequence, deployed agents tend to get stuck when trying to replicate the same sliding dynamic. By enforcing a more strict interaction with the environment, it is possible to avoid such shortcomings in the locomotor policy. Secondly, we employ the software library PyRobot [9] to create a transparent interface with the LoCoBot: thanks to PyRobot, the code used in simulation can be seamlessly deployed on the real-world agent by changing only a few lines of code. Finally, we test the navigation capabilities of the trained model on a real scene: we create a set of navigation episodes in which goals are defined using relative coordinates. While previous tests were mainly made in robot-friendly scenarios (often consisting of a single room), we test our model, which we call LoCoNav, in a more realistic environment with multiple rooms and typical office furniture (Fig.1). Thanks to our experiments, we show that models trained in simulation can adapt to real unseen environments. By making our code and models publicly available, we hope to motivate further research on Sim2Real adaptability and deployment in the real world of agents trained on the Habitat simulator.

Related Work
There is a broad area of recent research that focuses on designing autonomous agents with different abilities. Among these, a vast line of work concentrates on embodied exploration and navigation [2,4,10,11]. In this setting, the agent's

RGB-D Observation
Third-Person View Egocentric Map Global Map Fig. 1. We deploy a state-of-art navigation architecture on a LoCoBot and test it in a realistic, office-like environment. Our model exploits egocentric and global occupancy maps to plan a route towards the goal.
goal is to explore a new environment in the shortest amount of time. Architectures trained for this task usually employ reinforcement learning to maximize coverage (the area seen during a single episode) [2], surprisal [1], or a reward based on the novelty of explored areas [11]. Usually, this is done by creating internal map representations to keep track of the exploration progress and at the same time help the agent plan for future destinations [2,4,10]. The main advantage of these approaches is their ability to adapt to downstream tasks, such as PointGoal [10] or ObjectGoal [3] navigation. In PointGoal navigation, the target destination is specified using relative coordinates w.r.t. the agent's initial position and heading [13]. Using simulation and impressive computational power, Wijmans et al. [16] achieve nearly perfect results. However, their model is trained using 2.5 billion frames and requires experience acquired over more than half a year of GPU time. Unfortunately, models tend to learn simulator-specific tricks to circumvent navigation difficulties [7]. Since such shortcuts do not work in the real world, there is a significant Sim2Real performance gap. Recent work has studied how to deploy models trained on simulation to the real world [6,7,12]. In their work, Kadian et al. [7] make a 3D acquisition of a real-world scene and study the Sim2Real gap for various setups and metrics. However, their environment is very simple as obstacles are large boxes, the floor has an even and regular surface in order to facilitate the actuation system, and there are no doors or other navigation bottlenecks. In this work, instead, we focus on a more realistic type of environment: obstacles are represented by common office furniture such as desks, chairs, cupboards; the floor is uneven as there are gaps between floor tiles that make actuation noisy and very position-dependent, and there are multiple rooms that must be accessed through doorways.

Real-World Navigation with Habitat
In this section, we describe our out-of-the-box navigation robot. First, we describe the baseline architecture and its training procedure that takes place in the Habitat simulator [13]. Then we present our LoCoNav agent, which builds upon the baseline and implements various modules to enable real-world navigation.

Baseline Architecture
We draw inspiration from the occupancy anticipation agent [10] to design our baseline architecture. The model consists of three main parts: a mapper, a pose estimator, and a hierarchical policy, that we describe in the following. Mapper. The mapper is responsible for producing an occupancy map of the environment, which is then employed by the agent as an auxiliary representation during navigation. We use two different types of map at each time step t: the agent-centric map v t that depicts the portion of the environment immediately in front of the agent, and the global map m t that captures the area of the environment already visited by the agent. The global map of the environment m t is blank at t = 0 and it is built in an incremental way. Each map has two channels, identifying the free/occupied and the explored/unexplored space, respectively; each pixel contains the state of a 5cm × 5cm area. The mapper module takes as input the RGB and depth observations (o r t , o d t ) at time t and produces the agent-centric map v t ∈ [0, 1] 2×V ×V . The RGB observation is encoded to a feature representationō r t with the first two layers of a pretrained ResNet-18 followed by a three-layered CNN. Instead, the depth observation is used to create a pointcloud and reprojected to form a preliminary mapō d t . The resulting agent-centric map v t is computed by combiningō r t andō d t with a U-Net. Then, v t is registered to the global map m t ∈ [0, 1] 2×W ×W , with W > V , using the agent's position and heading in the environment (x t , y t , θ t ). Pose Estimator. While the agent navigates towards the goal, the interactions with the environment are subject to noise and errors, so that, for instance, the action go forward 25cm might not result in a real displacement of 25cm. That could happen for a variety of reasons: bumping into an obstacle, slipping on the terrain, or simple actuation noise. The pose estimator is responsible of avoiding such positioning mistakes and keeps track of the agent pose in the environment at each time step t. This module computes the relative displacement (∆x t , ∆y t , ∆θ t ) caused by the action selected by the agent at time t. It takes as input the RGB-D observations (o r t , o d t ) and (o r t−1 , o d t−1 ) retrieved at time t and t − 1, and the egocentric maps v t and v t−1 . Each modality is considered separately to obtain a first estimate of the displacement: The final output of the pose estimator is the weighted sum of the three displacement vectors g i : where MLP is a three-layered fully-connected network, (ō r t ,ō d t ,v t ) are the inputs encoded by a CNN and [·, ·, ·] denotes tensor concatenation. The estimated pose of the agent at time t is given by (x t , y t , θ t ) = (x t−1 , y t−1 , θ t−1 )+(∆x t , ∆y t , ∆θ t ). Hierarchical Policy. Following a current trend in Embodied AI [4,2,10], we employ a hierarchical policy in our baseline navigator. The highest-level component of our policy is the global policy. The global policy selects a long-term goal on the global map, that we call global goal. The input of the global policy at time t is a 4-channel enriched global map m + t ∈ [0, 1] 4×W ×W obtained as the concatenation of the global map m t with a spatial representation of visited states and a one-hot representation of the agent position at time t. Finally, we compute an 8-channel input of shape G × G for the global policy. To that end, we concatenate a cropped and a max-pooled version of m + t . The global policy outputs a probability distribution over the G × G action space. The global goal is sampled from this distribution and is then converted to (x, y) coordinates on the global map. A new global goal is sampled every N time steps during training and is set to the navigation goal during deployment and test. The middle-level component of our hierarchical policy is the planner. After the global goal is set, an A* planner decodes the next local goal within 0.25m from the agent and on the trajectory towards the global goal. A new local goal is sampled if at least one of the following three conditions verifies: a new global goal is sampled by the global policy, the previous local goal is reached, or the local goal is known to be in an occupied area. Finally, the local policy performs the low-level navigation and decodes the series of actions to perform. The actions available to the agents are go forwards 25cm and turn 15°. The local policy samples an atomic action a t at each time step t.

Training in Simulation
The baseline architecture described in the previous lines is trained in simulation using Habitat [13] and 3D scans from the Gibson dataset of spaces [17]. The mapper is trained with a binary cross-entropy loss using the ground-truth occupancy maps of the environment, obtained as described in [10]. The navigation policy is trained using reinforcement learning. We choose PPO [14] as training algorithm. The global policy receives a reward signal equal to the increase in terms of anticipated map accuracy [10]: where m t and m t−1 represent the global occupancy maps computed at time t and t − 1 respectively, andm ∈ [0, 1] 2×W ×W is the ground-truth global map.
The map accuracy is defined as: where 1[·] is an indicator function that returns one if the condition [·] is true and zero otherwise. The local policy is trained using a reward that encourages the decrease in the euclidean distance between the agent and the local goal while penalizing collisions with obstacles: where d t and d t−1 are the euclidean distances to the local goal at times t and t−1, bump t ∈ {0, 1} identifies a collision at time t and α regulates the contributions of the collision penalty. The training procedure described in this section exploits the experience collected throughout 6.5 million exploration frames.

LoCoNav: Adapting for Real World
The baseline architecture described above is trained in simulation and achieves state-of-art results on embodied exploration and navigation [10]. The reality, however, poses some major challenges that need to be addressed to achieve good real-world performances. For instance, uneven ground might give rise to errors and noise in the actuation phase. To overcome this and other discrepancies between simulated and real environments, we design LoCoNav: an agent that leverages the availability of powerful simulating platforms during training but is tailored for real-world use. In this section, we describe the main characteristics of the LoCoNav design. We deploy our architecture on a LoCoBot [8] and use PyRobot [9] for seamless code integration. Prevent your Agent from Learning Tricks. All simulations are imperfect. One of the main objectives when training an agent for real-world use in simulation is to prevent it from learning simulator-specific tricks instead of the basic navigation skills. During training, we observed that the agent tends to hit the obstacles instead of avoiding them. This behavior is given by the fact that the simulator allows the agent to slide towards its direction even if it is in contact with an obstacle as if there were no friction at all. Unfortunately, this ideal situation does not fit the real world, as the agent needs to actively rotate and head towards a free direction every time it bumps into an obstacle. To replicate the realistic sticky behavior of surfaces, we check the bump t flag before every step. If a collision is detected, we prevent the agent from moving forward. As a result, our final agent is more cautious about any form of collision. Sensor and Actuation Noise. Another important discrepancy between simulation and real-world is the difference in the sensor and actuation systems. Luckily, the Habitat simulator allows for great customization of input-output dynamics, thus being very convenient for our goal. In order to train a model that is more resilient to the camera noise, we apply a Gaussian Noise Model on the RGB observations and a Redwood Noise Model [5] on the depth observations. Unfortunately, the LoCoBot RealSense camera still presents various artifacts and regions with missing depth values. For that reason, we need to restore the observation retrieved from the depth camera before using it in our architecture. To that end, we apply the hole filling algorithm described in [15], followed by the application of a median filter. Regarding the actuation noise, we find out that the use of the incremental pose estimator (employed in the occupancy anticipation model and described in our baseline architecture) is not optimal, especially when combined with the actuation noise typical of real-world scenarios. Luckily, we can count on more precise and reliable information coming from the LoCoBot actuation system. By checking the actual rotation of each wheel at every time step, the robot can update its position step by step. We adapt the odometry sensor of the LoCoBot platform to be compliant with our architecture. To that end, the pose returned by the sensor is converted by resetting it with respect to its state at the beginning of the episode. We name χ 0 = (x 0 , y 0 , θ 0 ) the coordinate triplet given by the odometry sensor at t = 0. We then define: Let us define x t as the augmented position vector (x t , y t , 1) containing the agent position at each step t. We compute the relative position of the robot as: wherex t = (x t ,ỹ t , 1) contains the agent position after the conversion to episode coordinates. The relative position and heading is given byχ t = (x t ,ỹ t ,θ t ). Note that, for t = 0,χ 0 = (x 0 ,ỹ 0 ,θ 0 ) = (0, 0, 0). Hyperparameters. Finally, we noticed that typical hyperparameters employed in simulation do not match the real robot characteristics. For instance, the camera height is set to 1.25m in previous works, but the RealSense camera on the LoCoBot is placed only 0.6m from the floor. During the adaptation to the realworld robot, we change some hyperparameters to align the observation characteristics of the simulated and the real world and to match real robot constraints. These parameters are listed in Table 1.

Experiments
Testing Setup. We run multiple episodes in the real environment, in which the agent needs to navigate from a starting point A to a destination B. The goal is specified by using relative coordinates (in meters) with respect to the agent's starting position and heading. Although the agent knows the position of its destination, it has no prior knowledge of the surrounding environment. Because of this, it cannot immediately plan a direct route to the goal and must check for obstacles and walls before stepping ahead. After each run, we reset the agent memory so that it cannot retain any information from previous episodes. We design five different navigation episodes that take place in three different office rooms and the corridor connecting them (Fig. 2a). For each episode, we run different trials with different configurations: obstacles are added/moved, or people are sitting/standing in the room. In total, we run 50 different experiments, resulting in more than 10 hours of real-world testing.  Evaluation Protocol. An episode is considered successful if the agent sends a specific stop signal within 0.2m from the goal. This threshold corresponds to the radius of the robot base. For every navigation episode, we also track the number of steps and the time required to reach the goal. Since the absolute number of steps is not comparable among different episodes, we ask human users to control the LoCoBot and complete each navigation path via a remote interface (we report human performance in Fig 2b). We then normalize these measures using this information so that results close to 1.00 indicate human-like performances. We provide absolute and normalized length and time for each episode, as well as the popular SPL metric (Success rate weighted by inverse Path Length). We employ a slightly modified version of the SPL, in which the normalization is made basing on the number of steps and not on the effective path length to penalize purposeless rotations. Additionally, we set a boolean flag for each episode that signals whether the robot has bumped into an obstacle, and we report the average Bump Rate (BR). We also report the Hard Failure Rate (HFR) as the fraction of episodes terminated for one of the following reasons: the agent gets stuck and cannot proceed, or the episode length exceeds the limit of 300 steps. Real-world Navigation. In this experiment, we test our robot on five different realistic navigation paths (Fig. 2a). We report the numerical results for these experiments in Table 2, and we plot the main metrics in Fig. 3 to allow for a better visualization of navigation results across different episodes. When a path is contained in a single room (A), the agent achieves optimal results, as it always stops within the success threshold from the goal. The number of steps is slightly higher than the minimum required by the episode (33 instead of 23), but this overhead is necessary as the agent must rotate and "look around" to build a decent map of the surrounding before planning a route to the goal. Paths that involve going outside the room and navigating different spaces (B, C, D, E) are fairly complicated, but the agent can generally terminate the episode without hard failures. When the shortest path to the goal leads to a wall or a dead-end, the agent needs to find an alternative way to circumvent this obstacle (e.g. a door). This leads to a higher episode length because the robot must dedicate  some time to general exploration of the surroundings. Finally, we find out that the most challenging scenario for our LoCoNav is when reaching the goal requires to get out of a room and then enter a door immediately after, on the same side of the corridor (as in E). Since the robot sticks to the shortest path, the low parallax prevents it from identifying the second door correctly. Even in these cases, a bit of general exploration helps to solve the problem. Discussion and Failure Cases. Overall, our experimental setup provides a challenging test-bed for real-world robots. We find out that failures are due to two main issues. First, when the agent must navigate to a different room, it has no access to a map representing the general layout of the environment. This prevents the robot from computing a general plan to reach the long-term goal and forces it to explore the environment before proceeding. If a map was given to the agent, this problem would have been greatly alleviated. A second problem arises when the goal is close in terms (x, y) coordinates but is physically placed in an adjacent room. To solve this problem, one could decompose the navigation between rooms in a multi-goal problem where neighboring nodes are closer. In this way, it is possible to reduce a complex navigation episode in simpler subepisodes (like A or B), in which our agent has proved to be successful.

Conclusion
We have presented LoCoNav, an out-of-the-box architecture for embodied navigation in the real world. Our model takes advantage of two main elements: state-of-art simulating platforms, together with a large number of 3D spaces, for efficient and fast training, and a series of techniques specifically designed for real-world deployment. Experiments are conducted in reality on challenging navigation paths and in a realistic office-like environment. Results demonstrate the validity of our approach and encourage further research in this direction.