1 Introduction
Robots can perform impressive tasks under human control, including surgery (Lanfranco et al., 2004) and household chores (Wyrobek et al., 2008). However, designing the perception and control software for autonomous operation remains a major challenge, even for basic tasks. Policy search methods hold the promise of allowing robots to automatically learn new behaviors through experience (Kober et al., 2010b; Deisenroth et al., 2011; Kalakrishnan et al., 2011; Deisenroth et al., 2013). However, policies learned using such methods often rely on a number of handengineered components for perception and control, so as to present the policy with a more manageable and lowdimensional representation of observations and actions. The vision system in particular can be complex and prone to errors, and it is typically not improved during policy training, nor adapted to the goal of the task.
In this article, we aim to answer the following question: can we acquire more effective policies for sensorimotor control if the perception system is trained jointly with the control policy, rather than separately? In order to represent a policy that performs both perception and control, we use deep neural networks. Deep neural network representations have recently seen widespread success in a variety of domains, such as computer vision and speech recognition, and even playing video games. However, using deep neural networks for realworld sensorimotor policies, such as robotic controllers that map image pixels and joint angles to motor torques, presents a number of unique challenges. Successful applications of deep neural networks typically rely on large amounts of data and direct supervision of the output, neither of which is available in robotic control. Realworld robot interaction data is scarce, and task completion is defined at a high level by means of a cost function, which means that the learning algorithm must determine on its own which action to take at each point. From the control perspective, a further complication is that observations from the robot’s sensors do not provide us with the full state of the system. Instead, important state information, such as the positions of taskrelevant objects, must be inferred from inputs such as camera images.
We address these challenges by developing a guided policy search algorithm for sensorimotor deep learning, as well as a novel CNN architecture designed for robotic control. Guided policy search converts policy search into supervised learning, by iteratively constructing the training data using an efficient modelfree trajectory optimization procedure. We show that this can be formalized as an instance of Bregman ADMM (BADMM)
(Wang and Banerjee, 2014), which can be used to show that the algorithm converges to a locally optimal solution. In our method, the full state of the system is observable at training time, but not at test time. For most tasks, providing the full state simply requires positioning objects in one of several known positions for each trial during training. At test time, the learned CNN policy can handle novel, unknown configurations, and no longer requires full state information. Since the policy is optimized with supervised learning, we can use standard methods like stochastic gradient descent for training. Our CNNs have 92,000 parameters and 7 layers, including a novel spatial feature point transformation that provides accurate spatial reasoning and reduces overfitting. This allows us to train our policies with relatively modest amounts of data and only tens of minutes of realworld interaction time.
We evaluate our method by learning policies for inserting a block into a shape sorting cube, screwing a cap onto a bottle, fitting the claw of a toy hammer under a nail with various grasps, and placing a coat hanger on a rack with a PR2 robot (see Figure 1). These tasks require localization, visual tracking, and handling complex contact dynamics. Our results demonstrate improvements in consistency and generalization from training visuomotor policies endtoend, when compared to training the vision and control components separately. We also present simulated comparisons that show that guided policy search outperforms a number of prior methods when training highdimensional neural network policies. Some of the material in this article has previously appeared in two conference papers (Levine and Abbeel, 2014; Levine et al., 2015), which we extend to introduce visual input into the policy.
2 Related Work
Reinforcement learning and policy search methods (Gullapalli, 1990; Williams, 1992) have been applied in robotics for playing games such as table tennis (Kober et al., 2010b), object manipulation (Gullapalli, 1995; Peters and Schaal, 2008; Kober et al., 2010a; Deisenroth et al., 2011; Kalakrishnan et al., 2011), locomotion (Benbrahim and Franklin, 1997; Kohl and Stone, 2004; Tedrake et al., 2004; Geng et al., 2006; Endo et al., 2008), and flight (Ng et al., 2004). Several recent papers provide surveys of policy search in robotics (Deisenroth et al., 2013; Kober et al., 2013). Such methods are typically applied to one component of the robot control pipeline, which often sits on top of a handdesigned controller, such as a PD controller, and accepts processed input, for example from an existing vision pipeline (Kalakrishnan et al., 2011). Our method learns policies that map visual input and joint encoder readings directly to the torques at the robot’s joints. By learning the entire mapping from perception to control, the perception layers can be adapted to optimize task performance, and the motor control layers can be adapted to imperfect perception.
We represent our policies with convolutional neural networks (CNNs). CNNs have a long history in computer vision and deep learning (Fukushima, 1980; LeCun et al., 1989; Schmidhuber, 2015), and have recently gained prominence due to excellent results on a number of vision benchmarks (Ciresan et al., 2011; Krizhevsky et al., 2012; Ciresan et al., 2012; Girshick et al., 2014a; Tompson et al., 2014; LeCun et al., 2015; He et al., 2015). Most applications of CNNs focus on classification, where locational information is discarded by means of successive pooling layers to provide for invariance (Lee et al., 2009). Applications to localization typically either use a sliding window (Girshick et al., 2014a) or object proposals (Endres and Hoiem, 2010; Uijlings et al., 2013; Girshick et al., 2014b) to localize the object, reducing the task to classification, perform regression to a heatmap of manually labeled keypoints (Tompson et al., 2014), requiring precise knowledge of the object position in the image and camera calibration, or use 3D models to localize previously scanned objects (Pepik et al., 2012; Savarese and FeiFei, 2007). Many prior robotic applications of CNNs do not directly consider control, but employ CNNs for the perception component of a larger robotic system (Hadsell et al., 2009; Sung et al., 2015; Lenz et al., 2015b; Pinto and Gupta, 2015). We use a novel CNN architecture for our policies that automatically learn feature points that capture spatial information about the scene, without any supervision beyond the information from the robot’s encoders and camera.
Applications of deep learning in robotic control have been less prevalent in recent years than in visual recognition. Backpropagation through the dynamics and the image formation process is typically impractical, since they are often nondifferentiable, and such longrange backpropagation can lead to extreme numerical instability, since the linearization of a suboptimal policy is likely to be unstable. This issue has also been observed in the related context of recurrent neural networks
(Hochreiter et al., 2001; Pascanu and Bengio, 2012). The high dimensionality of the network also makes reinforcement learning difficult (Deisenroth et al., 2013). Pioneering early work on neural network control used small, simple networks (Pomerleau, 1989; Hunt et al., 1992; Bekey and Goldberg, 1992; Lewis et al., 1998; Bakker et al., 2003; Mayer et al., 2006), and has largely been supplanted by methods that use carefully designed policies that can be learned efficiently with reinforcement learning (Kober et al., 2013). More recent work on sensorimotor deep learning has tackled simple taskspace motions (Lenz et al., 2015a; Lampe and Riedmiller, 2013)and used unsupervised learning to obtain lowdimensional state spaces from images
(Lange et al., 2012). Such methods have been demonstrated on tasks with a lowdimensional underlying structure: Lenz et al. (2015a) controls the endeffector in 2D space, while Lange et al. (2012) controls a 2dimensional slot car with 1dimensional actions. Our experiments include full torque control of 7DoF robotic arms interacting with objects, with 3040 state dimensions. In simple synthetic environments, control from images has been addressed with image features (Jodogne and Piater, 2007), nonparametric methods (van Hoof et al., 2015), and unsupervised statespace learning (Böhmer et al., 2013; Jonschkowski and Brock, 2014). CNNs have also been trained to play video games with Qlearning, Monte Carlo tree search, and stochastic search (Mnih et al., 2013; Koutník et al., 2013; Guo et al., 2014), and have been applied to simple simulated control tasks (Watter et al., 2015; Lillicrap et al., 2015). However, such methods have only been demonstrated on synthetic domains that lack the visual complexity of the real world, and require an impractical number of samples for realworld robotic learning. Our method is sample efficient, requiring only minutes of interaction time. To the best of our knowledge, this is the first method that can train deep visuomotor policies for complex, highdimensional manipulation skills with direct torque control.Learning visuomotor policies on a real robot requires handling complex observations and high dimensional policy representations. We tackle these challenges using guided policy search. In guided policy search, the policy is optimized using supervised learning, which scales gracefully with the dimensionality of the policy. The training set for supervised learning can be constructed using trajectory optimization under known dynamics (Levine and Koltun, 2013a, b, 2014; Mordatch and Todorov, 2014) and trajectorycentric reinforcement learning methods that operate under unknown dynamics (Levine and Abbeel, 2014; Levine et al., 2015)
, which is the approach taken in this work. In both cases, the supervision is adapted to the policy, to ensure that the final policy can reproduce the training data. The use of supervised learning in the inner loop of iterative policy search has also been proposed in the context of imitation learning
(Ross et al., 2011, 2013). However, such methods typically do not address the question of how the supervision should be adapted to the policy.The goal of our approach is also similar to visual servoing, which performs feedback control on feature points in a camera image (Espiau et al., 1992; Mohta et al., 2014; Wilson et al., 1996). However, our visuomotor policies are entirely learned from realworld data, and do not require feature points or feedback controllers to be specified by hand. This allows our method much more flexibility in choosing how to use the visual signal. Our approach also does not require any sort of camera calibration, in contrast to many visual servoing methods (though not all – see e.g. Jägersand et al. (1997); Yoshimi and Allen (1994)).
3 Background and Overview
In this section, we define the visuomotor policy learning problem and present an overview of our approach. The core component of our approach is a guided policy search algorithm that separates the problem of learning visuomotor policies into separate supervised learning and trajectory learning phases, each of which is easier than optimizing the policy directly. We also discuss a policy architecture suitable for endtoend learning of vision and control, and a training setup that allows our method to be applied to real robotic platforms.
3.1 Definitions and Problem Formulation
In policy search, the goal is to learn a policy that allows an agent to choose actions in response to observations to control a dynamical system, such as a robot. The policy comes from some parametric class parameterized by , which could be, for example, the weights of a neural network. The system is defined by states , actions , and observations . For example, might include the joint angles of the robot, the positions of objects in the world, and their time derivatives, might consist of motor torque commands, and might include an image from the robot’s onboard camera. In this paper, we address finite horizon episodic tasks with . The states evolve in time according to the system dynamics , and the observations are, in general, a stochastic consequence of the states, according to . Neither the dynamics nor the observation distribution are assumed to be known in general. For notational convenience, we will use to denote the distribution over actions under the policy conditioned on the state. However, since the policy is conditioned on the observation , this distribution is in fact given by . The dynamics and together induce a distribution over trajectories :
The goal of a task is given by a cost function , and the objective in policy search is to minimize the expectation , which we will abbreviate as . A summary of the notation used in the paper is provided in Table 1.
symbol  definition  example/details 

Markovian system state at time step 
joint angles, endeffector pose, object positions, and their velocities; dimensionality: 14 to 32 

control or action at time step 
joint motor torque commands; dimensionality: 7 (for the PR2 robot) 

observation at time step 
RGB camera image, joint encoder readings & velocities, endeffector pose; dimensionality: around 200,000 

trajectory:

notational shorthand for a sequence of states and actions 

cost function that defines the goal of the task 
distance between an object in the gripper and the target 

unknown system dynamics 
physics that govern the robot and any objects it interacts with 

unknown observation distribution 
stochastic process that produces camera images from system state 

learned nonlinear global policy parameterized by weights 
convolutional neural network, such as the one in Figure 2 


notational shorthand for observationbased policy conditioned on state 

learned local timevarying linearGaussian controller for initial state 
timevarying linearGaussian controller has form 

trajectory distribution for : 
notational shorthand for trajectory distribution induced by a policy 
3.2 Approach Summary
Our methods consists of two main components, which are illustrated in Figure 3. The first is a supervised learning algorithm that trains policies of the form , where both and are general nonlinear functions. In our implementation, is a deep convolutional neural network, while is an observationindependent learned covariance, though other representations are possible. The second component is a trajectorycentric reinforcement learning (RL) algorithm that generates guiding distributions that provide the supervision used to train the policy. These two components form a policy search algorithm that can be used to learn complex robotic tasks using only a highlevel cost function . During training, only samples from the guiding distributions are generated by running rollouts on the physical system, which avoids the need to execute partially trained neural network policies on physical hardware.
Supervised learning will not, in general, produce a policy with good longhorizon performance, since a small mistake on the part of the policy will place the system into states that are outside the distribution in the training data, causing compounding errors. To avoid this issue, the training data must come from the policy’s own state distribution (Ross et al., 2011). We achieve this by alternating between trajectorycentric RL and supervised learning. The RL stage adapts to the current policy , providing supervision at states that are iteratively brought closer to the states visited by the policy. This is formalized as a variant of the BADMM algorithm (Wang and Banerjee, 2014) for constrained optimization, which can be used to show that, at convergence, the policy and the guiding distributions will exhibit the same behavior. This algorithm is derived in Section 4. The guiding distributions are substantially easier to optimize than learning the policy parameters directly (e.g., using modelfree reinforcement learning), because they use the full state of the system , while the policy only uses the observations. This means that the method requires the full state to be known during training, but not at test time. This makes it possible to efficiently learn complex visuomotor policies, but imposes additional assumptions on the observability of during training that we discuss in Section 4.
When learning visuomotor tasks, the policy is represented by a novel convolutional neural network (CNN) architecture, which we describe in Section 5.2. CNNs have enjoyed considerable success in computer vision (LeCun et al., 2015), but the most popular architectures rely on large datasets and focus on semantic tasks such as classification, often intentionally discarding spatial information. Our architecture, illustrated in Figure 2, uses a fixed transformation from the last convolutional layer to a set of spatial feature points, which form a concise representation of the visual scene suitable for feedback control. Our network has 7 layers and around 92,000 parameters, which presents a major challenge for standard policy search methods (Deisenroth et al., 2013).
To reduce the amount of experience needed to train visuomotor policies, we also introduce a pretraining scheme that allows us to train effective policies with a relatively small number of iterations. The pretraining steps are illustrated in Figure 3. The intuition behind our pretraining is that, although we ultimately seek to obtain sensorimotor policies that combine both vision and control, lowlevel aspects of vision can be initialized independently. To that end, we pretrain the convolutional layers of our network by predicting elements of that are not provided in the observation , such as the positions of objects in the scene. We also initially train the guiding trajectory distributions independently of the convolutional network until the trajectories achieve a basic level of competence at the task, and then switch to full guided policy search with endtoend training of . In our implementation, we also initialize the first layer filters from the model of Szegedy et al. (2014)
, which is trained on ImageNet
(Deng et al., 2009) classification. The initialization and pretraining scheme is described in Section 5.2.4 Guided Policy Search with BADMM
Guided policy search transforms policy search into a supervised learning problem, where the training set is generated by a simple trajectorycentric RL algorithm. This algorithm optimizes linearGaussian controllers , and is described in Section 4.2. We refer to the trajectory distribution induced by as . Each succeeds from different initial states. For example, in the task of placing a cap on a bottle, these initial states correspond to different positions of the bottle. By training on trajectories for multiple bottle positions, the final CNN policy can succeed from all initial states, and can generalize to other states from the same distribution.
The final policy learned with guided policy search is only provided with observations of the full state , and the dynamics are assumed to be unknown. A diagram of this method, which corresponds to an expanded version of the guided policy search box in Figure 3, is shown on the right. In the outer loop, we draw sample trajectories for each initial state on the physical system by running the corresponding controller . The samples are used to fit the dynamics that are used to improve , and serve as training data for the policy. The inner loop alternates between optimizing each and optimizing the policy to match these trajectory distributions. The policy is trained to predict the actions along each trajectory from the observations , rather than the full state . This allows the policy to directly use raw observations at test time. This alternating optimization can be framed as an instance of the BADMM algorithm (Wang and Banerjee, 2014), which converges to a solution where the trajectory distributions and the policy have the same state distribution. This allows greedy supervised training of the policy to produce a policy with good longhorizon performance.
4.1 Algorithm Derivation
Policy search methods minimize the expected cost , where is a trajectory, and is the cost of an episode. In the fully observed case, the expectation is taken under . The final policy is conditioned on the observations , but can be recovered as . We will present the derivation in this section for , but we do not require knowledge of in the final algorithm. As discussed in Section 4.3, the integral will be evaluated with samples from the real system, which include both and . We begin by rewriting the expected cost minimization as a constrained problem:
(1) 
where we will refer to as a guiding distribution. This formulation is equivalent to the original problem, since the constraint forces the two distributions to be identical. However, if we approximate the initial state distribution with samples , we can choose to be a class of distributions that is much easier to optimize than , as we will show later. This will allow us to use simple local learning methods for , without needing to train the complex neural network policy directly with reinforcement learning, which would require a prohibitive amount of experience on real physical systems.
The constrained problem can be solved by a dual descent method, which alternates between minimizing the Lagrangian with respect to the primal variables, and incrementing the Lagrange multipliers by their subgradient. Minimization of the Lagrangian with respect to and is done in alternating fashion: minimizing with respect to corresponds to supervised learning (making match ), and minimizing with respect to consists of one or more trajectory optimization problems. The dual descent method we use is based on BADMM (Wang and Banerjee, 2014), a variant of ADMM (Boyd et al., 2011)
that augments the Lagrangian with a Bregman divergence between the constrained variables. We use the KLdivergence as the Bregman constraint, which is particularly convenient for working with probability distributions. We will also modify the constraint
by multiplying both sides by , to get . This constraint is equivalent, but has the convenient property that we can express the Lagrangian in terms of expectations. The BADMM augmented Lagrangians for and are therefore given bywhere is the Lagrange multiplier for state and action at time , and are are expectations of the KLdivergences:
Dual descent with alternating primal minimization is then described by the following steps:
This procedure is an instance of BADMM, and therefore inherits its convergence guarantees. Note that we drop terms that are independent of the optimization variables on each line. The parameter is a step size. As with most augmented Lagrangian methods, the weight
is set heuristically, as described in Appendix
A.1.The dynamics only affect the optimization with respect to . In order to make this optimization efficient, we choose to be a mixture of Gaussians , one for each initial state sample . This makes the action conditionals and the dynamics linearGaussian, as discussed in Section 4.2. This is a reasonable choice when the system is deterministic, or the noise is Gaussian or small, and we found that this approach is sufficiently tolerant to noise for use on real physical systems. Our choice of also assumes that the policy is conditionally Gaussian. This is also reasonable, since the mean and covariance of can be any nonlinear function of the observations , which themselves are a function of the unobserved state . In Section 4.2, we show how these assumptions enable each to be optimized very efficiently. We will refer to as guiding distributions, since they serve to focus the policy on good, lowcost behaviors.
Aside from learning , we must choose a tractable way to represent the infinite set of constraints . One approximate approach proposed in prior work is to replace the exact constraints with expectations of features (Peters et al., 2010)
. When the features consist of linear, quadratic, or higher order monomial functions of the random variable, this can be viewed as a constraint on the moments of the distributions. If we only use the first moment, we get a constraint on the expected action:
. If the stochasticity in the dynamics is low, as we assumed previously, the optimal solution for each will have low entropy, making this first moment constraint a reasonable approximation. The KLdivergence terms in the augmented Lagrangians will still serve to softly enforce agreement between the higher moments. While this simplification is quite drastic, we found that it was more stable in practice than including higher moments, likely because these higher moments are harder to estimate accurately with a limited number of samples. The alternating optimization is now given by(2)  
(3)  
where is the Lagrange multiplier on the expected action at time . In the rest of the paper, we will use and to denote the two augmented Lagrangians in Equations (2) and (3), respectively. In the next two sections, we will describe how can be optimized with respect to under unknown dynamics, and how can be optimized for complex, highdimensional policies. Implementation details of the BADMM optimization are presented in Appendix A.1.
4.2 Trajectory Optimization under Unknown Dynamics
Since the Lagrangian in the previous section factorizes over the mixture elements in , we describe the trajectory optimization method for a single Gaussian . When there are multiple mixture elements, this procedure is applied in parallel to each . Since is Gaussian, the conditionals and , which correspond to the dynamics and the controller, are timevarying linearGaussian, and given by
This type of controller can be learned efficiently with a small number of realworld samples, making it a good choice for optimizing the guiding distributions. Since a different set of timevarying linearGaussian dynamics is fitted for each initial state, this dynamics representation can model any continuous deterministic system that can be locally linearized. Stochastic dynamics can violate the local linearity assumption in principle, but we found that in practice this representation was well suited for a wide variety of noisy realworld tasks.
The dynamics are determined by the environment. If they are known, can be optimized with a variant of the iterative linearquadraticGaussian regulator (iLQG) (Li and Todorov, 2004; Levine and Koltun, 2013a), which is a variant of DDP (Jacobson and Mayne, 1970). In the case of unknown dynamics, we can fit to sample trajectories sampled from the trajectory distribution at the previous iteration, denoted . If is too different from , these samples will not give a good estimate of , and the optimization will diverge. To avoid this, we can bound the change from to in terms of their KLdivergence by a step size , producing the following constrained problem:
This type of policy update has previously been proposed by several authors in the context of policy search (Bagnell and Schneider, 2003; Peters and Schaal, 2008; Peters et al., 2010; Levine and Abbeel, 2014). In the case when is Gaussian, this problem can be solved efficiently using dual gradient descent, while the dynamics are fitted to samples gathered by running the previous controller
on the robot. Fitting a global Gaussian mixture model to tuples
and using it as a prior for fitting the dynamics serves to greatly reduce the sample complexity. We describe the dynamics fitting procedure in detail in Appendix A.3.Note that the trajectory optimization cost function also depends on the policy , while we only have access to . In order to compute a local quadratic expansion of the KLdivergence term inside for iLQG, we also estimate a linearization of the mean of the conditionally Gaussian policy with respect to the state , using the same procedure that we use to linearize the dynamics. The data for this estimation consists of tuples , which we can obtain because both the states and the observations are available for all of the samples evaluated on the real physical system.
This constrained optimization is performed in the “inner loop” of the optimization described in the previous section, and the KLdivergence constraint imposes a step size on the trajectory update. The overall algorithm then becomes an instance of generalized BADMM (Wang and Banerjee, 2014). Note that the augmented Lagrangian consists of an expectation under of a quantity that is independent of . We can locally approximate this quantity with a quadratic by using a quadratic expansion of , and fitting a linearGaussian to with the same method we used for the dynamics. We can then solve the primal optimization in the dual gradient descent procedure with a standard LQR backward pass. This is significantly simpler and much faster than the forwardbackward dynamic programming procedure employed in previous work (Levine and Abbeel, 2014; Levine and Koltun, 2014). This improvement is enabled by the use of BADMM, which allows us to always formulate the KLdivergence term in the Lagrangian with the distribution being optimized as the first argument. Since the KLdivergence is convex in its first argument, this makes the corresponding optimization significantly easier. The details of this LQRbased dual gradient descent algorithm are derived in Appendix A.4.
We can further improve the efficiency of the method by allowing samples from multiple trajectories to be used to fit a shared dynamics , while the controllers are allowed to vary. This makes sense when the initial states of these trajectories are similar, and they therefore visit similar regions. This allows us to draw just a single sample from each at each iteration, allowing us to handle many more initial states.
4.3 Supervised Policy Optimization
Since the policy parameters participate only in the constraints of the optimization problem in Equation (1), optimizing the policy corresponds to minimizing the KLdivergence between the policy and trajectory distribution, as well as the expectation of . For a conditional Gaussian policy of the form , the objective is
where is the mean of and is the covariance, and the expectation is evaluated using samples from each with corresponding observations . The observations are sampled from by recording camera images on the real system. Since the input to and is not the state , but only an observation , we can train the policy to directly use raw observations. Note that is simply a weighted quadratic loss on the difference between the policy mean and the mean action of the trajectory distribution, offset by the Lagrange multiplier. The weighting is the precision matrix of the conditional in the trajectory distribution, which is equal to the curvature of its costtogo function (Levine and Koltun, 2013a). This has an intuitive interpretation: penalizes deviation from the trajectory distribution, with a penalty that is locally proportional to its costtogo. At convergence, when the policy takes the same actions as , their Qfunctions are equal, and the supervised policy objective becomes equivalent to the policy iteration objective (Levine and Koltun, 2014)
In this work, we optimize with respect to using stochastic gradient descent (SGD), a standard method for neural network training. The covariance of the Gaussian policy does not depend on the observation in our implementation, though adding this dependence would be straightforward. Since training complex neural networks requires a substantial number of samples, we found it beneficial to include sampled observations from previous iterations into the policy optimization, evaluating the action at their corresponding states using the current trajectory distributions. Since these samples come from the wrong state distribution, we use importance sampling and weight them according to the ratio of their probability under the current distribution and the one they were sampled from, which is straightforward to evaluate under the estimated linearGaussian dynamics (Levine and Koltun, 2013b).
4.4 Comparison with Prior Guided Policy Search Methods
We presented a guided policy search method where the policy is trained on observations, while the trajectories are trained on the full state. The BADMM formulation of guided policy search is new to this work, though several prior guided policy search methods based on constrained optimization have been proposed. Levine and Koltun (2014) proposed a formulation similar to Equation (1), but with a constraint on the KLdivergence between and . This results in a more complex, nonconvex forwardbackward trajectory optimization phase. Since the BADMM formulation solves a convex problem during the trajectory optimization phase, it is substantially faster and easier to implement and use, especially when the number of trajectories is large.
The use of ADMM for guided policy search was also proposed by Mordatch and Todorov (2014) for deterministic policies under known dynamics. This approach requires known, deterministic dynamics and trains deterministic policies. Furthermore, because this approach uses a simple quadratic augmented Lagrangian term, it further requires penalty terms on the gradient of the policy to account for local feedback. Our approach enforces this feedback behavior due to the higher moments included in the KLdivergence term, but does not require computing the second derivative of the policy.
5 EndtoEnd Visuomotor Policies
Guided policy search allows us to optimize complex, highdimensional policies with raw observations, such as when the input to the policy consists of images from a robot’s onboard camera. However, leveraging this capability to directly learn policies for visuomotor control requires designing a policy representation that is both dataefficient and capable of learning complex control strategies directly from raw visual inputs. In this section, we describe a deep convolutional neural network (CNN) model that is uniquely suited to this task. Our approach combines a novel spatial softargmax layer with a pretraining procedure that provides for flexibility and dataefficiency.
5.1 Visuomotor Policy Architecture
Our visuomotor policy runs at 20 Hz on the robot, mapping monocular RGB images and the robot configurations to joint torques on a 7 DoF arm. The configuration includes the angles of the joints and the pose of the endeffector (defined by 3 points in the space of the endeffector), as well as their velocities, but does not include the position of the target object or goal, which must be determined from the image. CNNs often use pooling to discard the locational information that is necessary to determine positions, since it is an irrelevant distractor for tasks such as object classification (Lee et al., 2009). Because locational information is important for control, our policy does not use pooling. Additionally, CNNs built for spatial tasks such as human pose estimation often also rely on the availability of location labels in imagespace, such as handlabeled keypoints (Tompson et al., 2014). We propose a novel CNN architecture capable of estimating spatial information from an image without direct supervision in image space. Our pose estimation experiments, discussed in Section 5.2, show that this network can learn useful visual features using only 3D position information provided by the robot, and no camera calibration. Further training the network with guided policy search to directly output motor torques causes it to acquire taskspecific visual features. Our experiments in Section 6.4 show that this improves performance beyond the level achieved with features trained only for pose estimation.
Our network architecture is shown in Figure 2. The visual processing layers of the network consist of three convolutional layers, each of which learns a bank of filters that are applied to patches centered on every pixel of its input. These filters form a hierarchy of local image features. Each convolutional layer is followed by a rectifying nonlinearity of the form for each channel and each pixel coordinate . The third convolutional layer contains response maps with resolution . These response maps are passed through a spatial softmax function of the form . Each output channel of the softmax is a probability distribution over the location of a feature in the image. To convert from this distribution to a coordinate representation , the network calculates the expected image position of each feature, yielding a 2D coordinate for each channel: and , where is the imagespace position of the point in the response map. Since this is a linear operation, it corresponds to a fixed, sparse fully connected layer with weights and . The combination of the spatial softmax and expectation operator implement a kind of softargmax. The spatial feature points are concatenated with the robot’s configuration and fed into two fully connected layers, each with 40 rectified units, followed by linear connections to the torques. The full network contains about 92,000 parameters, of which 86,000 are in the convolutional layers.
The spatial softmax and the expected position computation serve to convert pixelwise representations in the convolutional layers to spatial coordinate representations, which can be manipulated by the fully connected layers into 3D positions or motor torques. The softmax also provides lateral inhibition, which suppresses low, erroneous activations, only keeping strong activations that are more likely to be accurate. This makes our policy more robust to distractors, providing generalization to novel visual variation. We compare our architecture with more standard alternatives in Section 6.3 and evaluate robustness to visual distractors in Section 6.4. However, the proposed architecture is also in some sense more specialized for visuomotor control, in contrast to more general standard convolutional networks. For example, not all perception tasks require information that can be coherently summarized by a set of spatial locations.
5.2 Visuomotor Policy Training
The guided policy search trajectory optimization phase uses the full state of the system, though the final policy only uses the observations. This type of instrumented training is a natural choice for many robotics tasks, where the robot is trained under controlled conditions, but must then act intelligently in uncontrolled, realworld situations. In our tasks, the unobserved variables are the pose of a target object (e.g. the bottle on which a cap must be placed). During training, this target object is typically held in the robot’s left gripper, while the robot’s right arm performs the task, as shown to the right. This allows the robot to move the target through a range of known positions. The final visuomotor policy does not receive this position as input, but must instead use the camera images. Due to the modest amount of training data, distractors that are correlated with taskrelevant variables can hamper generalization. For this reason, the left arm is covered with cloth to prevent the policy from associating its appearance with the object’s position.
While we can train the visuomotor policy entirely from scratch, the algorithm would spend a large number of iterations learning basic visual features and arm motions that can more efficiently be learned by themselves, before being incorporated into the policy. To speed up learning, we initialize both the vision layers in the policy and the trajectory distributions for guided policy search by leveraging the fully observed training setup. To initialize the vision layers, the robot moves the target object through a range of random positions, recording camera images and the object’s pose, which is computed automatically from the pose of the gripper. This dataset is used to train a pose regression CNN, which consists of the same vision layers as the policy, followed by a fully connected layer that outputs the 3D points that define the target. Since the training set is still small (we use 1000 images collected from random arm motions), we initialize the filters in the first layer with weights from the model of Szegedy et al. (2014), which is trained on ImageNet (Deng et al., 2009) classification. After training on pose regression, the weights in the convolutional layers are transferred to the policy CNN. This enables the robot to learn the appearance of the objects prior to learning the behavior.
To initialize the linearGaussian controllers for each of the initial states, we take 15 iterations of guided policy search without optimizing the visuomotor policy. This allows for much faster training in the early iterations, when the trajectories are not yet successful, and optimizing the full visuomotor policy is unnecessarily time consuming. Since we still want the trajectories to arrive at compatible strategies for each target position, we replace the visuomotor policy during these iterations with a small network that receives the full state, which consisted of two layers with 40 rectified linear hidden units in our experiments. This network serves only to constrain the trajectories and avoid divergent behaviors from emerging for similar initial states, which would make subsequent policy learning difficult.
After initialization, we train the full visuomotor policy with guided policy search. During the supervised policy optimization phase, the fully connected motor control layers are first optimized by themselves, since they are not initialized with pretraining. This can be done very quickly because these layers are small. Then, the entire network is further optimized endtoend. We found that first training the upper layers before endtoend optimization prevented the convolutional layers from forgetting useful features learning during pretraining, when the error signal due to the untrained upper layers is very large. The entire pretraining scheme is summarized in the diagram on the right. Note that the trajectories can be pretrained in parallel with the vision layer pretraining, which does not require access to the physical system. Furthermore, the entire initialization procedure does not use any additional information that is not already available from the robot.
6 Experimental Evaluation
In this section, we present a series of experiments aimed at evaluating our approach and answering the following questions:

How does the guided policy search algorithm compare to other policy search methods for training complex, highdimensional policies, such as neural networks?

Does our trajectory optimization algorithm work on a real robotic platform with unknown dynamics, for a range of different tasks?

How does our spatial softmax architecture compare to other, more standard convolutional neural network architectures?

Does training the perception and control systems in a visuomotor policy jointly endtoend provide better performance than training each component separately?
Evaluating a wide range of policy search algorithms on a real robot would be extremely time consuming, particularly for methods that require a large number of samples. We therefore answer question (1) by using a physical simulator and simpler policies that do not use vision. This also allows us to test the generality of guided policy search on tasks that include manipulation, walking, and swimming. To answer question (2), we present a wide range of experiments on a PR2 robot. These experiments allow us to evaluate the sample efficiency of our trajectory optimization algorithm. To address question (3), we compare a range of different policy architectures on the task of localizing a target object (the cube in the shape sorting cube task). Since localizing the target object is a prerequisite for completing the shape sorting cube task, this serves as a good proxy for evaluating different architectures. Finally, we answer the last and most important question (4) by training visuomotor policies for hanging a coat hanger on a clothes rack, inserting a block into a shape sorting cube, fitting the claw of a toy hammer under a nail with various grasps, and screwing on a bottle cap. These tasks are illustrated in Figure 8.
6.1 Simulated Comparisons to Prior Policy Search Methods
In this section, we compare our method against prior policy search techniques on a range of simulated robotic control tasks. These results previously appeared in our conference paper that introduced the trajectory optimization procedure with local linear models (Levine and Abbeel, 2014). In these tasks, the state consists of the joint angles and velocities of each robot, and the actions consist of the torques at each joint. The neural network policies used one hidden layer and soft rectifier nonlinearities of the form . Since these policies use the state as input, they only have a few hundred parameters, far fewer than our visuomotor policies. However, even this number of parameters can pose a major challenge for prior policy search methods (Deisenroth et al., 2013).
Experimental tasks.
We simulated 2D and 3D peg insertion, octopus arm control, and planar swimming and walking. The difficulty in the peg insertion tasks stems from the need to align the peg with the slot and the complex contacts between the peg and the walls, which result in discontinuous dynamics. Octopus arm control involves moving the tip of a flexible arm to a goal position (Engel et al., 2005). The challenge in this task stems from its high dimensionality: the arm has degrees of freedom, corresponding to state dimensions. The swimming task requires controlling a threelink snake, and the walking task requires a sevenlink biped to maintain a target velocity. The challenge in these tasks comes from underactuation. Details of the simulation and cost for each task are in Appendix B.1.
Prior methods.
We compare to REPS (Peters et al., 2010), rewardweighted regression (RWR) (Peters and Schaal, 2007; Kober and Peters, 2009), the crossentropy method (CEM) (Rubinstein and Kroese, 2004), and PILCO (Deisenroth and Rasmussen, 2011). We also use iLQG (Li and Todorov, 2004) with a known model as a baseline, shown as a black horizontal line in all plots. REPS is a modelfree method that, like our approach, enforces a KLdivergence constraint between the new and old policy. We compare to a variant of REPS that also fits linear dynamics to generate 500 pseudosamples (Lioutikov et al., 2014), which we label “REPS (20 + 500).” RWR is an EM algorithm that fits the policy to previous samples weighted by the exponential of their reward, and CEM fits the policy to the best samples in each batch. With Gaussian trajectories, CEM and RWR only differ in the weights. These methods represent a class of RL algorithms that fit the policy to weighted samples, including PoWER and PI2 (Kober and Peters, 2009; Theodorou et al., 2010; Stulp and Sigaud, 2012). PILCO is a modelbased method that uses a Gaussian process to learn a global dynamics model that is used to optimize the policy. We used the opensource implementation of PILCO provided by the authors. Both REPS and PILCO require solving large nonlinear optimizations at each iteration, while our method does not. Our method used rollouts with the Gaussian mixture model prior, and without. Due to its computational cost, PILCO was provided with rollouts per iteration, while other prior methods used and
. For all prior methods with free hyperparameters (such as the fraction of elites for CEM), we performed hyperparameter sweeps and chose the most successful settings for the comparison.
Gaussian trajectory distributions.
In the first set of comparisons, we evaluate only the trajectory optimization procedure for training linearGaussian controllers under unknown dynamics to determine its sampleefficiency and applicability to complex, highdimensional problems. The results of this comparison for the peg insertion, octopus arm, and swimming tasks appears in Figure 4. The horizontal axis shows the total number of samples, and the vertical axis shows the minimum distance between the end of the peg and the bottom of the slot, the distance to the target for the octopus arm, or the total distance travelled by the swimmer. Since the peg is units long, distances above this amount correspond to controllers that cannot perform an insertion. Our method learned much more effective controllers with fewer samples, especially when using the Gaussian mixture model prior. On 3D insertion, it outperformed the iLQG baseline, which used a known model. Contact discontinuities cause problems for derivativebased methods like iLQG, as well as methods like PILCO that learn a smooth global dynamics model. We use a timevarying local model, which preserves more detail, and fitting the model to samples has a smoothing effect that mitigates discontinuity issues. Prior policy search methods could servo to the hole, but were unable to insert the peg. On the octopus arm, our method succeeded despite the high dimensionality of the state and action spaces.^{1}^{1}1The high dimensionality of the octopus arm made it difficult to run PILCO, though in principle, such methods should perform well on this task given the arm’s smooth dynamics. Our method also successfully learned a swimming gait, while prior modelfree methods could not initiate forward motion. PILCO also learned an effective gait due to the smooth dynamics of this task, but its GPbased optimization required orders of magnitude more computation time than our method, taking about 50 minutes per iteration. In the case of prior modelfree methods, the high dimensionality of the timevarying linearGaussian controllers likely caused considerable difficulty (Deisenroth et al., 2013), while our approach exploits the structure of linearGaussian controllers for efficient learning.
Neural network policies.
In the second set of comparisons, shown in Figure 5, we compare guided policy search to RWR and CEM^{2}^{2}2PILCO cannot optimize neural network policies, and we could not obtain reasonable results with REPS. Prior applications of REPS generally focus on simpler, lowerdimensional policy classes (Peters et al., 2010; Lioutikov et al., 2014). on the challenging task of training highdimensional neural network policies for the peg insertion and locomotion tasks. The variant of guided policy search used in this comparison differs somewhat from the version described in Section 4, in that it used a simpler dual gradient descent formulation, rather than BADMM. In practice, we found the performance of these methods to be very similar, though the BADMM variant was substantially faster and easier to implement.
On swimming, our method achieved similar performance to the linearGaussian case, but since the neural network policy was stationary, the resulting gait was much smoother. Previous methods could only solve this task with samples per iteration, with RWR eventually obtaining a distance of 0.5m after 4000 samples, and CEM reaching 2.1m after 3000. Our method was able to reach such distances with many fewer samples. Following prior work (Levine and Koltun, 2013a), the walker trajectory was initialized from a demonstration, which was stabilized with simple linear feedback. The RWR and CEM policies were initialized with samples from this controller to provide a fair comparison. The graph shows the average distance travelled on rollouts that did not fall, and shows that only our method was able to learn walking policies that succeeded consistently.
On peg insertion, the neural network was trained to insert the peg without precise knowledge of the position of the hole, resulting in a partially observed problem. The holes were placed in a region of radius 0.2 units in 2D and 0.1 units in 3D. The policies were trained on four different hole positions, and then tested on four new hole positions to evaluate generalization. The hole position was not provided to the neural network, and the policies therefore had to search for the hole, with only joint angles and velocities as input. Only our method could acquire a successful strategy to locate both the training and test holes, although RWR was eventually able to insert the peg into one of the four holes in 2D.
These comparisons show that training even mediumsized neural network policies for continuous control tasks with a limited number of samples is very difficult for many prior policy search algorithms. Indeed, it is generally known that modelfree policy search methods struggle with policies that have over 100 parameters (Deisenroth et al., 2013). In subsequent sections, we will evaluate our method on real robotic tasks, showing that it can scale from these simulated tasks all the way up to endtoend learning of visuomotor control.
6.2 Learning LinearGaussian Controllers on a PR2 Robot
In this section, we demonstrate the range of manipulation tasks that can be learned using our trajectory optimization algorithm on a real PR2 robot. These experiments previously appeared in our conference paper on guided policy search (Levine et al., 2015). Since performing trajectory optimization is a prerequisite for guided policy search to learn effective visuomotor policies, it is important to evaluate that our trajectory optimization can learn a wide variety of robotic manipulation tasks under unknown dynamics. The tasks in these experiments are shown in Figure 6, while Figure 7 shows the learning curves for each task. For all robotic experiments in this article, the tasks were learned entirely from scratch,
with the initialization of the controllers described in Appendix B.2. The number of samples required to learn each controller is around 2025, substantially lower than many prior policy search methods in the literature (Peters and Schaal, 2008; Kober et al., 2010b; Theodorou et al., 2010; Deisenroth et al., 2013). Total learning time was about ten minutes for each task, of which only 34 minutes involved system interaction. The rest of the time was spent resetting the robot to the initial state and on computation.
The linearGaussian controllers are optimized for a specific condition – e.g., a specific position of the target lego block. To evaluate their robustness to errors in the specified target position, we conducted experiments on the lego block and ring tasks where the target object (the lower block and the peg) was perturbed at each trial during training, and then tested with various perturbations. For each task, controllers were trained with Gaussian perturbations with standard deviations of , , and cm in the position of the target object, and each controller was tested with perturbations of radius , , , and cm. Note that with a radius of cm, the peg would be placed about one ringwidth away from the expected position. The results are shown in Table 2. All controllers were robust to perturbations of cm, and would often succeed at cm. Robustness increased slightly when more noise was injected during training, but even controllers trained without noise exhibited considerable robustness, since the linearGaussian controllers themselves add noise during sampling. We also evaluated a kinematic baseline for each perturbation level, which planned a straight path from a point 5 cm above the target to the expected (unperturbed) target location. This baseline was only able to place the lego block in the absence of perturbations. The rounded top of the peg provided an easier condition for the baseline, with occasional successes at higher perturbation levels. Our controllers outperformed the baseline by a wide margin.
All of the robotic experiments discussed in this section may be viewed in the corresponding supplementary video, available online: http://rll.berkeley.edu/icra2015gps. A video illustration of the visuomotor policies, discussed in the following sections, is also available: http://sites.google.com/site/visuomotorpolicy.
test perturbation  

lego block  ring on peg  
0 cm  1 cm  2 cm  3 cm  0 cm  1 cm  2 cm  3 cm  
training perturb.  0 cm  5/5  5/5  3/5  2/5  5/5  5/5  0/5  0/5 
1 cm  5/5  5/5  3/5  2/5  5/5  5/5  3/5  0/5  
2 cm  5/5  5/5  5/5  3/5  5/5  5/5  3/5  0/5  
kinematic baseline  5/5  0/5  0/5  0/5  5/5  3/5  0/5  0/5 
6.3 Spatial Softmax CNN Architecture Evaluation
In this section, we evaluate the neural network architecture that we propose in Section 5.1 in comparison to more standard convolutional networks. To isolate the architectures from other confounding factors, we measure their accuracy on the pose estimation pretraining task described in Section 5.2. This is a reasonable proxy for evaluating how well the network can overcome two major challenges in visuomotor learning: the ability to handle relatively small datasets without overfitting, and the capability to learn tasks that are inherently spatial. We compare to a network where the expectation operator after the softmax is replaced with a learned fully connected layer, as is standard in the literature, a network where both the softmax and the expectation operators are replaced with a fully connected layer, and a version of this network that also uses max pooling with stride at the first two layers. These alternative architectures have many more parameters, since the fully connected layer takes the entire bank of response maps from the third convolutional layer as input. Pooling helps to reduce the number of parameters, but not to the same degree as the spatial softmax and expectation operators in our architecture.
The results in Table 3 indicate that using the softmax and expectation operators improves pose estimation accuracy substantially. Our network is able to outperform the more standard architectures because it is forced by the softmax and expectation operators to learn feature points, which provide a concise representation suitable for spatial inference. Since most of the parameters in this architecture are in the convolutional layers, which benefit from extensive weight sharing, overfitting is also greatly reduced. By removing pooling, our network also maintains higher resolution in the convolutional layers, improving spatial accuracy. Although we did attempt to regularize the larger standard architectures with higher weight decay and dropout, we did not observe a significant improvement on this dataset. We also did not extensively optimize the parameters of this network, such as filter size and number of channels, and investigating these design decisions further would be valuable to investigate in future work.
network architecture  test error (cm) 

softmax + feature points (ours)  1.30 0.73 
softmax + fully connected layer  2.59 1.19 
fully connected layer  4.75 2.29 
maxpooling + fully connected  3.71 1.73 
6.4 Deep Visuomotor Policy Evaluation
In this section, we present an evaluation of our full visuomotor policy training algorithm on a PR2 robot. The aim of this evaluation is to answer the following question: does training the perception and control systems in a visuomotor policy jointly endtoend provide better performance than training each component separately?
Experimental tasks.
We trained policies for hanging a coat hanger on a clothes rack, inserting a block into a shape sorting cube, fitting the claw of a toy hammer under a nail with various grasps, and screwing on a bottle cap. The cost function for these tasks encourages low distance between three points on the endeffector and corresponding target points, low torques, and, for the bottle task, spinning the wrist. The equations for these cost functions and the details of each task are presented in Appendix B.2. The tasks are illustrated in Figure 8. Each task involved variation of 1020 cm in each direction in the position of the target object (the rack, shape sorting cube, nail, and bottle). In addition, the coat hanger and hammer tasks were trained with two and three grasps, respectively. The current angle of the grasp was not provided to the policy, but had to be inferred from observing the robot’s gripper in the camera images. All tasks used the same policy architecture and model parameters.
Experimental conditions.
We evaluated the visuomotor policies in three conditions: (1) the training target positions and grasps, (2) new target positions not seen during training and, for the hammer, new grasps (spatial test), and (3) training positions with visual distractors (visual test). A selection of these experiments is shown in the supplementary video.^{3}^{3}3The video can be viewed at http://sites.google.com/site/visuomotorpolicy For the visual test, the shape sorting cube was placed on a table rather than held in the gripper, the coat hanger was placed on a rack with clothes, and the bottle and hammer tasks were done in the presence of clutter. Illustrations of this test are shown in Figure 9.
Comparison.
The success rates for each test are shown in Figure 9. We compared to two baselines, both of which train the vision layers in advance for pose prediction, instead of training the entire policy endtoend. The features baseline discards the last layer of the pose predictor and uses the feature points, resulting in the same architecture as our policy, while the prediction baseline feeds the predicted pose into the control layers. The pose prediction baseline is analogous to a standard modular approach to policy learning, where the vision system is first trained to localize the target, and the policy is trained on top of it. This variant achieves poor performance. As discussed in Section 6.3, the pose estimate is accurate to about 1 cm. However, unlike the tasks in Section 6.2, where robust controllers could succeed even with inaccurate perception, many of these tasks have tolerances of just a few millimeters. In fact, the pose prediction baseline is only successful on the coat hanger, which requires comparatively little accuracy. Millimeter accuracy is difficult to achieve even with calibrated cameras and checkerboards. Indeed, prior work has reported that the PR2 can maintain a camera to end effector accuracy of about 2 cm during open loop motion (Meeussen et al., 2010). This suggests that the failure of this baseline is not atypical, and that our visuomotor policies are learning visual features and control strategies that improve the robot’s accuracy. When provided with pose estimation features, the policy has more freedom in how it uses the visual information, and achieves somewhat higher success rates. However, full endtoend training performs significantly better, achieving high accuracy even on the challenging bottle task, and successfully adapting to the variety of grasps on the hammer task. This suggests that, although the vision layer pretraining is clearly beneficial for reducing computation time, it is not sufficient by itself for discovering good features for visuomotor policies.
Visual distractors.
The policies exhibit moderate tolerance to distractors that are visually separated from the target object. This is enabled in part by the spatial softmax, which has a lateral inhibition effect that suppresses nonmaximal activations. Since distractors are unlikely to activate each feature as much as the true object, their activations are therefore suppressed. However, as expected, the learned policies tend to perform poorly under drastic changes to the backdrop, or when the distractors are adjacent to or occluding the manipulated objects, as shown in the supplementary video. A standard solution to this issue to expose the policy to a greater variety of visual situations during training. This issue could also be mitigated by artificially augmenting the image samples with synthetic transformations, as discussed in prior work in computer vision (Simard et al., 2003)
, or even incorporating ideas from transfer and semisupervised learning.
6.5 Features Learned with EndtoEnd Training
The visual processing layers of our architecture automatically learn features points using the spatial softmax and expectation operators. These feature points encapsulate all of the visual information received by the motor layers of the policy. In Figure 10, we show the features points discovered by our visuomotor policy through guided policy search. Each policy learns features on the target object and the robot manipulator, both clearly relevant to task execution. The policy tends to pick out robust, distinctive features on the objects, such as the left pole of the clothes rack, the left corners of the shapesorting cube and the bottomleft corner of the toy tool bench. In the bottle task, the endtoend trained policy outputs points on both sides of the bottle, including one on the cap, while the pose prediction network only finds points on the right edge of the bottle.
In Figure 11, we compare the feature points learned through guided policy search to those learned by a CNN trained for pose prediction. After endtoend training, the policy acquired a distinctly different set of feature points compared to the pose prediction CNN used for initialization. The endtoend trained model finds more feature points on taskrelevant objects and fewer points on background objects. This suggests that the policy improves its performance by acquiring goaldriven visual features that differ from those learned for object localization.
The feature point representation is very simple, since it assumes that the learned features are present at all times, and only one instance of each feature is ever present in the image. While this is a drastic simplification, both the pose predictor and the policy still achieve good results. A more flexible architecture that still learns a concise feature point representation could further improve policy performance. We hope to explore this in future work.
6.6 Computational Performance and Sample Efficiency
We used the Caffe deep learning library
(Jia et al., 2014) for CNN training. Each visuomotor policy required a total of 34 hours of training time: 2030 minutes for the pose prediction data collection on the robot, 4060 minutes for the fully observed trajectory pretraining on the robot and offline pose pretraining (which can be done in parallel), and between 1.5 and 2.5 hours for endtoend training with guided policy search. The coat hanger task required two iterations of guided policy search, the shape sorting cube and the hammer required three, and the bottle task required four. Only about 15 minutes of the training time consisted of executing trials on the robot. Since training was dominated by computation, we expect significant speedup from a more efficient implementation. The number of samples for training each policy is shown in Table 4. Each trial was five seconds in length, and the numbers do not include the time needed to collect about 1000 images for pretraining the visual processing layers of the policy.number of trials  

task  trajectory pretraining  endtoend training  total 
coat hanger  120  36  156 
shape cube  90  81  171 
toy hammer  150  90  240 
bottle cap  180  108  288 
7 Discussion and Future Work
In this paper, we presented a method for learning robotic control policies that use raw input from a monocular camera. These policies are represented by a novel convolutional neural network architecture, and can be trained endtoend using our guided policy search algorithm, which decomposes the policy search problem in a trajectory optimization phase that uses full state information and a supervised learning phase that only uses the observations. This decomposition allows us to leverage stateoftheart tools from supervised learning, making it straightforward to optimize extremely highdimensional policies. Our experimental results show that our method can execute complex manipulation skills, and that endtoend training produces significant improvements in policy performance compared to using fixed vision layers trained for pose prediction.
Although we demonstrate moderate generalization over variations in the scene, our current method does not generalize to dramatically different settings, especially when visual distractors occlude the manipulated object or break up its silhouette in ways that differ from the training. The success of CNNs on exceedingly challenging vision tasks suggests that this class of models is capable of learning invariance to irrelevant distractor features (LeCun et al., 2015), and in principle this issue can be addressed by training the policy in a variety of environments, though this poses certain logistical challenges. More practical alternatives that could be explored in future work include simultaneously training the policy on multiple robots, each of which is located in a different environment, developing more sophisticated regularization and pretraining techniques to avoid overfitting, and introducing artificial data augmentation to encourage the policy to be invariant to irrelevant clutter. However, even without these improvements, our method has numerous applications in, for example, an industrial setting where the robot must repeatedly and efficiently perform a task that requires visual feedback under moderate variation in background and clutter conditions.
Our method takes advantage of a known, fully observed state space during training. This is both a weakness and a strength. It allows us to train linearGaussian controllers for guided policy search using a very small number of samples, far more efficiently than standard policy search methods. However, the requirement to observe the full state during training limits the tasks to which the method can be applied. In many cases, this limitation is minor, and the only “instrumentation” required at training is to position the objects in the scene at consistent positions. However, tasks that require, for example, manipulating freely moving objects require more extensive instrumentation, such as motion capture. A promising direction for addressing this limitation is to combine our method with unsupervised statespace learning, as proposed in several recent works, including our own (Lange et al., 2012; Watter et al., 2015; Finn et al., 2015).
In future work, we hope to explore more complex policy architectures, such as recurrent policies that can deal with extensive occlusions by keeping a memory of past observations. We also hope to extend our method to a wider range of tasks that can benefit from visual input, as well as a variety of other rich sensory modalities, including haptic input from pressure sensors and auditory input. With a wider range of sensory modalities, endtoend training of sensorimotor policies will become increasingly important: while it is often straightforward to imagine how vision might help to localize the position of an object in the scene, it is much less apparent how sound can be integrated into robotic control. A learned sensorimotor policy would be able to naturally integrate a wide range of modalities and utilize them to directly aid in control.
Acknowledgements
This research was funded in part by DARPA through a Young Faculty Award, the Army Research Office through the MAST program, NSF awards IIS1427425 and IIS1212798, the Berkeley Vision and Learning Center, and a Berkeley EECS Department Fellowship.
Appendix A Guided Policy Search Algorithm Details
In this appendix, we describe a number of implementation details of our BADMMbased guided policy search algorithm and our linearGaussian controller optimization method.
a.1 BADMM Dual Variables and Weight Adjustment
Recall that the inner loop alternating optimization is given by
We use a step size of in all of our experiments, which we found to be more stable than . The weights are initialized to and incremented based on the following schedule: at every iteration, we compute the average KLdivergence between and at each time step, as well as its standard deviation over time steps. The weights corresponding to time steps where the KLdivergence is higher than the average are increased by a factor of 2, and the weights corresponding to time steps where the KLdivergence is two standard deviations or more below the average are decreased by a factor of 2. The rationale behind this schedule is to adjust the KLdivergence penalty to keep the policy and trajectory in agreement by roughly the same amount at all time steps. Increasing too quickly can lead to the policy and trajectory becoming “locked” together, which makes it difficult for the trajectory to decrease its cost, while leaving it too low requires more iterations for convergence. We found this schedule to work well across all tasks, both during trajectory pretraining and while training the visuomotor policy.
To update the dual variables , we evaluate the expectations over by using the latest batch of sampled trajectories. For each state along these sampled trajectories, we evaluate the expectations over under and
, which correspond simply to the means of these conditional Gaussian distributions, in closed form.
a.2 Policy Variance Optimization
As discussed in Section 4
, the variance of the Gaussian policy
does not depend on the observation, though this dependence would be straightforward to add. Analyzing the objective , we can write out only the terms that depend on :Differentiating and setting the derivative to zero, we obtain the following equation for :
where the expectation under is omitted, since does not depend on .
a.3 Dynamics Fitting
Optimizing the linearGaussian controllers that induce the trajectory distributions requires fitting the system dynamics at each iteration to samples generated on the physical system from the previous controller . In this section, we describe how these dynamics are fitted. As in Section 4, we drop the subscript , since the dynamics are fitted the same way for all of the trajectory distributions.
The linearGaussian dynamics are defined as , and the data that we obtain from the robot can be viewed as tuples
. A simple way to fit these linearGaussian dynamics is to use linear regression to determine
, , and , and fit based on the errors. However, the sample complexity of linear regression scales with the dimensionality of . For a highdimensional robotic system, we might need an impractically large number of samples at each iteration to obtain a good fit. However, we can observe that the dynamics at nearby time steps are strongly correlated, and we can dramatically reduce the sample complexity of the dynamics fitting by bringing in information from other time steps, and even prior iterations. We will bring in this information by fitting a global model to all of the transitions for all and all tuples from several prior iterations (we use three prior iterations in our implementation), and then use this model as a prior for fitting the dynamics at each time step. Note that this global model does not itself need to be a good forward dynamics model – it just needs to serve as a good prior to reduce the sample complexity of linear regression.To make it more convenient to incorporate a datadriven prior, we will first reformulate this linear regression fit and view it as fitting a Gaussian model to the dataset at each time step , and then conditioning this Gaussian to obtain . While this is equivalent to linear regression, it allows us to easily incorporate a normalinverseWishart prior on this Gaussian in order to bring in prior information. Let be the empirical covariance of our dataset, and let be the empirical mean. The normalinverseWishart prior is defined by prior parameters , , , and
. Under this prior, the maximum a posteriori estimates for the covariance
and mean are given byHaving obtained and , we can obtain an estimate of the dynamics by conditioning the distribution on , which produces linearGaussian dynamics . The parameters of the normalinverseWishart prior are obtained from the global model of the dynamics which, as described previously, is fitted to all available tuples .
The simplest prior can be obtained by fitting a Gaussian distribution to vectors
. If the mean and covariance of this data are given by and , the prior is given by and , while and should be set to the number of data points in the datasets. In practice, settings and to tends to produce better results, since the prior is fitted to many more samples than are available for linear regression at each time step. While this prior is simple, we can obtain a better prior by employing a nonlinear model.The particular global model we use in this work is a Gaussian mixture model over vectors . Systems of articulated rigid bodies undergoing contact dynamics, such as robots interacting with their environment, can be coarsely modeled as having piecewise linear dynamics. The Gaussian mixture model provides a good approximation for such piecewise linear systems, with each mixture element corresponding to a different linear mode (KhansariZadeh and Billard, 2010). Under this model, the state transition tuple is assumed to come from a distribution that depends on some hidden state , which corresponds to the mixture element identity. In practice, this hidden state might correspond to the type of contact profile experienced by a robotic arm at step . The prior for the dynamics fit at time step is then obtained by inferring the hidden state distribution for the transition dataset