{'fraction_non_alphanumeric': 0.028509274101213646, 'fraction_numerical': 0.01900618273414243, 'mean_word_length': 4.914014895057549, '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}}
Evaluation of Deep Reinforcement Learning Methods for Modular Robots

We propose a novel framework for Deep Reinforcement Learning (DRL) in modular robotics using traditional robotic tools that extend state-of-the-art DRL implementations and provide an end-to-end approach which trains a robot directly from joint states. Moreover, we present a novel technique to transfer these DLR methods into the real robot, aiming to close the simulation-reality gap. We demonstrate the robustness of the performance of state-of-the-art DRL methods for continuous action spaces in modular robots, with an empirical study both in simulation and in the real robot where we also evaluate how accelerating the simulation time affects the robot's performance. Our results show that extending the modular robot from 3 degrees-of-freedom (DoF), to 4 DoF, does not affect the robot's learning. This paves the way towards training modular robots using DRL techniques.


INTRODUCTION
Current robot systems are designed, built and programmed by teams with multidisciplinary skills. The traditional approach to program such systems is typically referred to as the robotics control pipeline and requires going from observations to final low-level control commands through: a) state estimation, b) modeling and prediction, c) planning, and d) low level control translation. As introduced by Zamalloa et al. (2017), the whole process requires fine tuning of every step in the pipeline incurring into a relevant complexity where optimization at every step is critical and has a direct impact in the final result.
In recent years, several techniques for DRL have shown good success in learning complex behaviour skills and solving challenging control tasks in high-dimensional state-space (Levine & Koltun, 2013;Peters & Schaal, 2008;Schulman et al., 2015;Wu et al., 2017). However, many of the benchmarked environments, such as Atari (Mnih et al., 2013) and Mujoco (Todorov et al., 2012), rarely deal with realistic or complex environments (Nogueira et al., 2017;Zamora et al., 2016), or utilize the tools commonly used in robotics such as the Robot Operating System (ROS) (Quigley et al., 2009). The research conducted in the previous work can only be translated into real world robots with a considerable amount of effort for each particular robot. Thus, the scalability of previous methods for modular robots is questionable.
Modular robots can extend their components seamlessly. This brings clear advantages for their construction, however, training them with current DRL methods becomes cumbersome due to the following reasons: every small change in the physical structure of the robot will require a new training, building the tools to train modular robots (such as the simulation model, virtual drivers) is a time consuming process, and transferring the results to the real robot is complex given the flexibility of these systems.
In this work we present a framework that employs the traditional tools in the robotics field, such as Gazebo (Koenig & Howard (2004)) and ROS, which simplifies the process of building modular robots and their corresponding tools. Our framework includes baseline implementations  for the most common DRL techniques dealing with policy iteration methods. Using this framework, we present configurations with 3 and 4 degrees-of-freedom (DoF), while performing the same task. In addition, we introduce our insights about the impact of the simulation acceleration in the final reward.

PREVIOUS WORK
DRL methods have shown great success when dealing with high-dimensional, continuous state and action spaces found in robotics. For our experiments, we focus on the DRL methods that have shown best performance and highest robustness against different environments and hyperparameter configurations, namely the Proximal Policy Optimization (PPO)  methods. In a nutshell, PPO alternates between sampling data trough interaction with the environment and optimizing the 'surrogate' objective by clipping the policy probability ratio.
Previous work focused on the simulation-to-reality transfer problem, Barrett et al. (2010); Rusu et al. (2016); James & Johns (2016), presents partial success of transferring learned behavior in simulation to a real robot. These works explain the importance of having scenes in simulation as similar as possible to the reality in order to simplify the process of transferring the learned behavior to real scenarios. Zhu et al. (2017) describe a high-quality and realistic 3D scenes. The approach of Tobin et al. (2017) randomizes the rendering in simulation, reaching enough variability in the simulator. This allows for the images in the real world to be considered as just another variation in the simulator. To the best of our knowledge, the work conducted in previous approaches focuses on restricted scenarios in a controlled environment, where specific algorithms for solving particular task were used. This is not the case when a robotic system needs to be deployed in realistic scenarios, specially if the robot is modular and can therefore present a number of different configurations.

EXPERIMENTAL SETUP
As previously presented in Zamora et al. (2016), our novel technique for transferring any network trained in simulation using DRL techniques to the real robot relies on our extension of the OpenAI gym which is tailored for robotics. For our experiments, we train two modular robots, namely the SCARA 3DoF and 4DoF robots, where the Gazebo simulator and corresponding ROS packages convert the actions generated from each algorithm to appropriate trajectories the robot can execute.
The initial position of the robot is set to zero for all joints. The reward is modeled as Residual Mean Square Error (RMSE) between the current position of the end-effector and the goal. The goal is set to be in a selected point in the environment, particularly, the center of the H letter in the workspace of the robot. This translates to coordinates [0.3305805, −0.1326121, 0.3746] for the 3DoF Scara robot and [0.3305805, −0.1326121, 0.4868] for the 4DoF Scara robot, with respect to the origin of the environment, which in our case is set to be the base of the robot. The range of the reward is set to be between [−1, 1]. The robot gets a positive reward when the RMSE is smaller than 0.005 and negative reward otherwise. The robot is reset to the initial position when RMSE is smaller than 0.005, or when the number of steps exceeds the maximum timesteps for an episode.

EXPERIMENTAL RESULTS
We have evaluated how the trajectory execution time influences the reward of PPO1 and PPO2 during training as shown in Figure 3.2. We have evaluated PPO1 and PPO2 methods with a trajectory execution time of 1s, 100ms, 10ms or 1ms. Figure 4 illustrates the recorded trajectories when executing previously trained behaviour to the real 3DoF and 4DoF modular Scara robot and Table  1 summarizes the results of the Euclidean Distance, given in millimeters, between reached endeffector position and the real target. As we can observe from the obtained results, for PPO1 and PPO2 the 3DoF robot has best performance when the training time is set to 1ms. On the other hand, when the trajectory execution time is set to 1s, PPO1 and PPO2 have worst performance. In the case of the 4DoF robot, PPO1 shows best performance when the trajectory execution time is set to 10ms and worst performance when the trajectory execution time is set to 100ms. On the other hand, PPO2 for the 4DoF Scara has best performance when the simulation time is set to 1ms, and worst performance when the trajectory execution time is 1s. Accelerating simulation time allows PPO1 and PPO2 to converge faster as they need a lower number of time steps. As a result, faster convergence reduces the training time while preserving performance. We can conclude that training networks with accelerated trajectory execution times provides equal or even better results than training the robot in real-time. There still remain many challenges within the DRL field for robotics. The main problems are the long training times, the simulation-to-real robot transfer, reward shaping, sample efficiency and extending the behaviour to diverse tasks and robot configurations.
So far, our work with modular robots has focused on simple tasks like reaching a point in space. In order to have an end-to-end training framework (from pixels to motor torques) and to perform more complex tasks, we aim to integrate additional rich sensory input, such as vision. We envision the future of robotics to be about modular robots where the trained network can generalize online to modifications in the robot such as change of a component or dynamic obstacle avoidance.