A learning approach to the FOM problem
Abstract
Hogan recently provided an heuristic technique called family of modes (FOM) to solve model predictive control (MPC) problems under hybrid constraints and underactuation. The goal of this study is to further develop this new method and to expand its usage in the robotics manipulation community. With that objective in mind, we address some of the method's weaknesses, we provide comparison tools to try to compare the method with traditional MPC solving techniques and we provide a simple and systematic technique to set-up the method's parameters. We conclude the study by presenting our the future lines of research, which consist in generalizing the method for more complex systems and testing it's robustness.
Full text
Title: A Learning Approach To The FOM Problem Author: Eudald Romo Grau Advisor: Maria Alberich Department: Matemàtiques Academic year: 2016-2017 Degree in Mathematics
Universitat Polit`ecnica de Catalunya Facultat de Matem`atiques i Estad´ıstica Degree in Mathematics Bachelor’s Degree Thesis A Learning Approach To The FOM Problem Eudald Romo Grau Supervised by Alberto Rodriguez Garcia and Maria Alberich Carrami˜nana April, 2017
Thanks to Alberto Rodriguez for tutoring my research, for providing me with the required tools and financial support to undertake this project and for hosting me in his laboratory; to Maria Alberich for supervising and tutoring this thesis; to Francois Hogan for sharing his ideas on family of modes trajectory control and for introducing me to his previous work, to Maria Bauza for sharing with me her insights in machine learning techniques; to Nikhil Chavan-Daffle for sharing with me his insights in complementarity constraint problems; to all the members of the MCube Lab for sharing their thoughts on my research, to Centre de Formacio Interdisciplinaria Superior for offering me the possibility and the financial support to take part in this project, to Massachusetts Institute of Technology for providing the required facilities required to develop this project and to Generalitat de Catalunya for their financial support.
Abstract The family of modes (FOM) approach to solving model predictive control (MPC) problems is a novel heuristic technique developed at MIT to reduce the exponential time complexity of traditional MPC solving techniques. This study strives to bring this method closer to the manipulation research community by addressing some of the weaknesses of FOM, by comparing its results to traditional MPC solving techniques and by providing methodologies to choose the parameters required for the heuristic, that will ultimately lead to a FOM-based algorithm capable of tracking complex trajectories. Keywords Optimal Manipulation, Online Control, MPC, FOM, Simulation, MIQP, Underactuation, Hybridness 1
1. Introduction Hogan recently provided an heuristic technique called family of modes (FOM) [16] to respond to the current need for the robotics manipulation community to solve model predictive control (MPC) problems under hybrid constraints and underactuation fast enough to be introduced into control loops. The goal of our study is to bring the FOM technique closer to the manipulation research community. In order to do that, we reinforce the FOM method by fixing some of its weaknesses -as its sequential properties-, we provide comparison tools to test the method against traditional hybrid MPC solving techniques -as mixed integer quadratic programming (MIQP)-, and we provide simple and systematic techniques to set-up the method’s parameters that will ultimately leat to a new variation of the FOM approach that can properly track complex trajectories. We also discuss the new lines of research we plan on exploring before presenting this study to 2017’s International Symposium on Robotics Research (ISRR). They can be summarized as: •To proof the scalability of this method by increasing the complexity of the considered systems beyond the one used in Hogan’s work, that tracked straight lines with a single point pusher and a square slider. •To check the robustness of the FOM method by using it in models different from those it was designed for. We hope that the results from our studies will increase the performance and simplify the implementation of FOM and will bring it closer to the robotics manipulation research community by both providing systematic set-up tools and showing its robustness and scalability. To present our studies and results, we start by providing in chapter 2all the required theoretical background in planar pushing manipulation, that will allow ultimately lead to the concept of hybridness, a concept fundamental to understand the behaviour, the difficulty and the motivation of the FOM controller. Chapter 3is completely dedicated to familiarize the reader with hybrid control. Once the theoretical background is presented, the goal of this study is revisited in chapter 4emphasizing the implications on the manipulation research community of being able to solve trajectory-control MPC problems fast. The necessary formulation is derived afterwards in chapter 5and any theoretic concept that still needs further clarification will be re-discussed here. Having presented the background, objectives and formulation of our study, we present the core of our research. We separate it into two main groups. In chapter 6we study the properties of the FOM method and we test them in a simulation interface we developed. In chapter 7we provide a procedure to select the modes of the FOM and we test it in the simulation interface of the previous chapter. The mode selection procedure will ultimately lead to the concept of Dynamic Family of Modes (DFOM), a trajectory optimization method based on FOM that is capable to track complex trajectories. To conclude the study, all the results we obtained are discussed in chapter 8together with their implications. This discussion ultimately leads to chapter 9, that presents the future lines of research we already mentioned at the beginning of this section. 2
2. Planar Pushing As Mason explained in his talk during his CITRIS People and Robots Seminar Series talk [20], robotics manipulation research has been traditionally based on a pick and place methodology that consisted in solving two fundamental problems: 1. Determine a stable grasping configuration: A stable grasping configuration was generally obtained by finding a set of points that completely constrained the picked object position and orientation with respect to the gripper. 2. Solving a collision-free trajectory planning problem: Once the object was grasped it was rigidly attached to the robot gripper and the trajectory planning problem was completely determined at every point. This methodology was constantly improved as the manipulation community considered broader and more complex problems, as Rodriguez’ and Mason’s study [26], that generalized the concept of stable grasp to caging -a partial immobilization of the grasped object that allows it to move in a bounded space. Other modifications added further constraints to the problem, as the concept of compliant grasping manipulation [21], where the object motion of the object is constrained by the task and the constraint is enforced without exerting heavy force loads on the object. An example of compliant manipulation the process of activating a lever. The lever only has one degree of freedom and can easily be broken by small planning uncertainties if a powerful robotic arm is used and the trajectory is controlled uniquely with the robot position without considering the applied forces. It should be noted that all these variations were applied to the same pick and place grasping problem. Some of the main motivations that made stable grasping so popular are: •Easy to track: The obtained solutions are constrained by the contact points and the gripper pose so, even if the object could move inside the gripper (as in cagings) the object position could be deterministically bounded during all the trajectory. •Robustness: Most grasping point predictions are robust to small sensor noise and applying enough grasping force allows ignoring uncertainties in the grasped object friction coefficients. •Simplicity: As explained, the manipulation problem could be formulated simply by a grasping point identification and a path planning problem. At least as far as on 1980’s, some drift towards the study of the mechanics of planar pushing started to appear with studies as Mason’s [22]. The main motivations for this drift were to handle problems that were not tractable with grasping or to better understand the grasping mechanics. A non-exhaustive list of the motivations of planar pushing could be: •You don’t need to lift: Lifting heavy objects using a traditional robotic arm can put heavy torque strain on the arm in certain arm configurations and the strain can break or topple the arm. If most or all of the planned trajectory can be done through pushing, the required force is usually reduced and when the maximum force is achieved safety mechanisms can be implemented so that the arm doesn’t break. 3
A learning approach to the FOM problem This multiple system state phenomenon (inherent in Coulomb Contact) is commonly referred as hybridness. Hybridness appears in many manipulation situations different than sticking/sliding ones. For example a gripper can throw the object in the air to re-grasp it, change the number of fingers contacting the object, change the pusher-slider contact side while pushing a slider of irregular shape, etc. It also appears in other robotic fields as locomotion, where there are always at least two differentiated states (aerial state and ground state) with clearly different dynamics. In the following chapter, we are going to discuss the hybridness phenomenon in more detail by covering why is it important to take into account, the problems that arise when considering hybridness in planning and control problems and different methods to solve them in each field, that will ultimately lead to the introduction to the FOM method. 3. Hybridness in Manipulation Problems Through all this section, we will compare the role of hybridness in different aspects of manipulation problems. The principal fields we will distinguish are simulation, trajectory planning and trajectory control. Each of these fields take a different role when studying a general manipulation problem, that we can generally defined as follows: Definition 3.1. Manipulation Problem: Given a system conformed by a set of points in a metric space M and a parametrization c(x) (for x in a certain configuration space C) that uniquely describes the position of all the points of interest in the metric space, a manipulation problem consists in changing a certain initial configuration x0into a final configuration xffollowing appropriate constraints. Simulation problems consist on accurately reproducing the real physics of a manipulation problem to safely and quickly study its properties. A key property of most simulation problems is that, at every instant of time, we know the configuration of the system until the current time step and the only variables we need to compute are the ones that define the configuration in the next step. Planning problems consist on finding a trajectory in the configuration state to go from state x0to xf. Most simple planning problems have a state variable that defines the configuration of the object we need to manipulate and a actuator state variable that describes the configuration of the gripper or other tool used to move the object. As opposed to simulation problems, planning problems don’t have full information about the state of the object and actuator state variables for each step of the trajectory, and they are usually variables of the problem. Because of this difference, the equations that describe the evolution of the same actuator-object system can have different properties in planning or simulation problems. As an example, the motion equations we derive in section 5.5 are generally non-linear (they are linear with respect to the object state variables but not with respect to the actuator state variables), but they can be expressed as linear equations on the actuator state variables for the first step of the problem, where we know the initial state of the object. Traditional control designs as PID controllers can successfully control a system by solving only local manipulation problem, in a similar way as simulation. PID only use the notion of the current and past differences between the configuration of the object xand its objective value x∗to devise a control response to stabilize the realized trajectory around the objective one. Such control cannot be used for pushing because of a phenomenon called underactuation. 10
3.1 Underactuation. Trajectory Optimization A control problem with first order motion constraints ˙ x= f(x,u) for some control input uis underactuated when f is non-exhaustive in the configuration velocities space. In most problems, ˙ xis the result of converting a second order Newtonian equation ¨ x=mPFto a system of first order ordinary differential equations (ODEs) and underactuation is usually caused by the controller being able to transmit only a limited set of forces and moments to the object. In stable grasping, the system is fully activated (see remark 3.2) at all times. On the other hand, for a single simple point finger pushing the system is highly underactuated, as the normal force the pusher applies to the slider is non-negative (there cannot be no pulling forces) and the overall contact force lies in the friction cone. As such, the controller must reason only among the forces that can physically be realized at every instant. In a certain way, it can be considered that underactuation distorts the usual metric of the system. The example in Figure 5shows a tracking problem where a single point pusher needs to move a square slider to a configuration situated just behind the current pusher location. Any local pushing control action will bring the system away from the objective configuration if we use a tradition 2D Euclidean metric. If the controller takes into account a certain notion of path and future and tries to minimize the overall distance through the considered control trajectory, it can obtain a solution like the one we show. Remark 3.2.Stable grasping has some some sources of underactuation, but they are linked with the situations were the stable grasp property cannot be held. For example, if an object is too heavy to be lifted or to be kept in a grasp without slipping. These are examples of underactuation, as the gripper cannot transmit enough force to the object, but they are also examples where stable grasping is not possible. A common method to consider future paths in control problems is to solve simplified planning problems at high frequency. The planning problems can usually be expressed as trajectory optimization problems, where the values of the state and control variables are chosen to minimize a cost function along the trajectory, while fulfilling the required motion constraints that represent the kinematics of the real world problem. These optimization problems are usually linearized around the nominal trajectory computed by a planning problem beforehand. This linearization reduces the computational cost of the control problem while ensuring that, in a certain region of attraction, the controlled trajectory converges to the nominal one. It is also common to only consider the control path until a certain finite time horizon (as opposed to planning problems, that usually consider the trajectory until reaching a certain goal). Once stated the need to consider trajectories in pushing control problems we will now justify the need to consider hybridness in the control problems. This justification is threefold: •Optimality: If we consider all the possible modes in a trajectory optimization problem, there’s a wider set of possible feasible states and control laws, so we may be able to obtain a better solution. •Robustness: We need to consider the possible hybrid states and their dynamics so that we can react to execution errors or model uncertainties. We need to understand the mechanics of slipping to be able to return to our optimal pushing point after an accidental slip. •Stability: In section 6.2 we will show that when controlling a hybrid system through its perturbation motion equations, if the nominal trajectory is not feasible in our formulation we will not be able to stabilize our control trajectory around it, because the nominal trajectory will not even be an equilibrium point of our motion equations. 11
A learning approach to the FOM problem Figure 5: Control trajectory obtained when trying to bring the slider to a configuration behind the current position of the pusher. The red slider describes the objective configuration, the blue line describes the trajectory of the slider center of mass during the control trajectory and the blue sliders represent some of the configurations of the system during the tracking trajectory. The position of the slider when we stopped the simulation is highlighted with thicker and more opaque lines. In the next sections we will introduce formulation techniques to add the hybridness concept into manipulation problems. In particular, we will discuss the limitations of some of the formulations to solve control problems at enough frequency. This will ultimately lead to Hogan’s FOM formulation as an approximate method to solve the finite horizon trajectory optimization problem. 3.2 Complementarity Problems Given a variable zand a function on it g(z), a general complementarity problem consists on finding a value for zthat satisfies: z≥0 g(z) ≥0 g(z) z = 0 This formulation derives from traditional linear programming techniques to encode two mutually exclusive constraints on z(z≥0 and g(z) ≥0). The linear complementarity problem (LCP) [7] assumes a linear g function and takes the following form: ω=Rz +u 12
ω≥0 z ≥0ωTz= 0 It was first introduced to predict instantaneous acceleration of rigid bodies in 1996 by Pang and Trinkle [25] and Anitescu and Potra [4], that guaranteed a solution for this formulation on multi-rigid-body Coulomb friction contact and impact problems. This provided a systematic way to formulate hybrid constraints for simulation purposes. Soon after the instantaneous formulation introduction, Steward and Trinkle [27] proposed a time-stepping formulation in the space of impulses and velocities which increased the stability performance of LCP based forward simulation techniques. Remark 3.3.It should be noted that the LCP formulation of the multi-rigid-body Coulomb friction problems used a polyhedral approximation to the friction cone. There are fast algorithms to solve LCP problems that allow the manipulation community to use them in simulation, as in Steward and Trinkle’s study [27], or other instantaneous-nature problems as the studies of Fazeli et al. to identify friction parameters from observed object motions [10] [9]. Figure 6: Figure from [27] with the simulation results obtained when emulating a falling and spinning rod. The simulation step was h = 0.0025 and the simulation time at each time instant is shown in seconds on one of the bar ends. In instantaneous Coulomb contact problems the contact dynamics can be expressed in linear discrete 13
A learning approach to the FOM problem form through Steward and Trinkle’s formulation, but many Newtonian motion equations take a non-linear form in trajectory optimization problems. Then problem becomes non-linear (NCP) and Lemke’s algorithm, the key idea used to provide the LCP solution, cannot be used. The complementarity constraints are usually non-convex and can only be solved in a fast way by using the previously mentioned algorithm. In the case of NCP, it has to be solved with a commercial optimizer and the problem usually cannot be solved fast enough for neither planning nor control. Certain trajectory optimization techniques, as Rapidly expanding Random Trees (RRT) can function solely considering instantaneous dynamics. In these cases LCP can not be generally used as is to solve the trajectory optimization problems, because they also contain non-complementarity subject variables that must hold linear constraints and LCP does not suppor them. Luckily, these problems, called mixed LCP (MLCP) can also be solved with a generalization of Lemke’s algorithm. Nikhil’s work on extrinsic dexterity [6] is an example of MLCP usage in planning. Unfortunately these trajectory optimization techniques used in combination with MLCP are too slow to use in most control problems. 3.3 MPC and MIQP MLCP is usually too slow to be used in trajectory optimization based control problems. Complementarity constraints are generally non-convex, which makes it difficult to use them in other algorithms than LCP or MLCP problems. To tackle the computing cost of complementarity constraints, model predictive control(MPC) can be used. Given an initial state ¯ x0, an MPC problem consists in defining a discrete set of N positions (¯ x1, ..., ¯ xN) and control inputs (¯ u0, ..., ¯ uN−1) to define a trajectory a trajectory. ¯ xi=¯ x(tj), where tj=t0+hj for a certain time step h. Similarly, ¯ uistands for the control input necessary to transition from ¯ xito ¯ xi+1. Given this notation, MPC optimizes the values of all ¯ xiand ¯ uiwith respect to a certain cost function: J(¯ x0, ..., ¯ xN,¯ u0, ..., ¯ uN−1) = ¯ xT NQN¯ xN+ N−1 X i=0 ¯ xT iQ¯ xi+¯ uT iR¯ ui(6) Where terms Q,QN, and Rare weights matrices that penalize the error state, final error state, and control input, respectively. MPC problems consider the hybrid state to be constant during state state transitions. Under this assumption, a hybrid mode can be defined: Definition 3.4. Ahybrid mode is a ordered set of hybrid states. In MPC, an N-length mode completely fixes the hybrid states the system is in along the finite horizon considered trajectory. Remark 3.5.We use the ¯ (.) notation because, as will be explained in sections 5.5 and 5.6, we will use the perturbation of the state and control variables with respect to a nominal trajectory and control inputs as the MPC variables. Remark 3.6.MPC problems are based in the linear quadratic regulators (LQR) controllers. These controllers are used for unconstrained non-hybrid problems described by the motion equation ˙ x=A x +B u and use the same cost functions as MPC. LQR are able to give an analytical control law to minimize the cost function provided for infinite horizon problems. Their term Qfcan be set-up to account for the integral of the cost function from the last point considered until reaching the destination (if the trajectory is finite) or until infinite. If the Qfterm is chosen to follow the Riccati equation: Qf=ATQfA−ATQfB(BTQfB+R)−1BTQfA+Q 14
then the finite horizon LQR controllers will behave as the infinite horizon ones. In MPC problems there’s no closed expression for this term but there are certain techniques to choose a good value to maximize the final region of attraction as the one exposed in Ya-Feng’s et al. study [30], but it is generally based on the LQR technique of solving the Riccati equation . In our model we use a simplification of Ya-Feng’s approach which simply computes the solution of the Riccati equation presented above using the motion equation of the last MPC step, that can be expressed as ˙ x=ANx+BNu. If we consider a manipulation problem with convex dynamics, constraints, and cost function, the overall optimization problem is convex if a hybrid mode that describes the finite horizon is provided. Thus, the global problem consists in selecting the optimal solution from the finite set of optimal solutions for each of the fixed-mode sub-problems. The number of possible modes of length Nis hN, where his the number of possible hybrid states. This exponential growth generally makes a naive exploration of all the possible sub-problems too computationally expensive. In order to reduce the algorithmic strain, a mixed integer programming (MIP) strategy is usually adopted. This will be further explained in chapter 5, but the main idea is that the state space is expanded by adding h binary variables per MPC step that define whether the step iof the MPC is in a hybrid state s. The commercial optimizers provide tools to express state the state related constraints with respect to each of this binary variables so that they only apply when their correspondent variable is activated. Then, if possible, the optimizer will use internal MIP techniques as branch and bound and cutting planes [1] to avoid exploring all the possible modes. In our particular case, we will be able to express all the motion and friction constraints as linear inequalities and the objective cost is a quadratic function on the variables. This kind of mixed integer problems are called mixed integer quadratic problems (MIQP) and they have very fast commercial optimizers (as the one we will use, called Gurobi). The drawback of MIQP is that it doesn’t escalate well with the number of possible hybrid states and, even with a small number of states, the optimizers aren’t generally fast enough to solve the problem online, as required in control problems. Furthermore, the performance of MIQP depends on the geometry of the problem and its execution time can change by orders of magnitude at every control iteration, as will be further explained in section 6.3. . . . . . . n= 0 n= 1 n= 2 n=N Sticking Sliding up Sliding down Figure 7: Figure from [16] that represents the exponential growth of the possible modes tree for a single point finger pusher-slider system. The root is a dummy node and, for every other tree level i, each node represents a possible hybrid state for the ithstate transition. Each possible mode can be represented by a path from the root to one of the tree leaves Using fast iterations of MPC problems to control a hybrid system is a technique used in other robotics fields, as locomotion, and being able to solve them at a frequency high enough to allow direct implementation into a feedback controller design is currently a problem of interest for the robotics community. A proof of this is that in 2016’s Workshop on the Algorithmic Foundations of Robotics (WAFR), held in San Francisco last December, Tedrake presented it as one of the current algorithmic open problems in robotics control problems [28]. 15
A learning approach to the FOM problem 3.4 Family of Modes Responding to the need of obtaining fast solutions to MPC-based control problems Hogan and Rodriguez [16] proposed an heuristic based procedure to approximately solve them called Family of Modes (FOM). In their work, they assumed a finite horizon MPC problem as the one described in the previous section. At every control step the heuristic method explores the optimization problem over only a small set of all the possible combinations of hybrid states to decide the instantaneous controller policy. The approximate MPC is characterized by a family of modes, which is defined as the set of modes to consider. If the MPC family contains K modes, the MPC will only solve the K optimization sub-problems resulting when enforcing each mode’s hybrid state schedule. The optimal solution is approximated by the best solution between the K considered. This solution will consist of the values of ¯ xiand ¯ uifor the optimal control trajectory. The controller will then keep executing the first control policy u1and recomputing the approximate MPC problem frequently to take into account new information as the finite horizon advances in time as well as to tackle external interference with the system and errors in the dynamic model. In his study, Hogan applied FOM to a system consisting on a single finger point pusher and a square slider and he showed that his method was capable of properly tracking straight line trajectories (and composition of straight lines) under external perturbations by using only three modes. The three modes were selected by hand using intuition on the problem structure. They consisted on exploring the three possible hybrid states (using the notation of section 2.3 they were Sticking, Sliding Right, and Sliding Left) on the first step of the MPC and constraining the system to be in a Sticking state for the rest of the steps. In this simple case it is possible to derive a good set of modes intuitively, but for more complex and higher dimensional problems, this may not be possible. Furthermore, adding more modes to consider into this heuristic doesn’t generally translate into better results and, in some cases, it may lead to results far worse than the original one. For some cases, adding new modes to a family that was able to track a line providing asymptotic convergence could even translate into losing this convergence. We believe the FOM approach shows promising results and may be able to partially address the current needs of manipulation research to solve the MPC based hybrid control problem. At the same time, we consider necessary to show its generality and robustness as well as address some of its limitations for it to be adopted in the robotics community. In the next section we introduce key concepts on sequential properties of heuristic based methods, that will be useful to describe some of the FOM limitations described above. In chapter 4we will revisit the main objectives of our study using the concepts presented in previous sections. 3.5 Sequential Properties On the late 90’s, Bertsekas et al. presented a work on the sequential properties of heuristic algorithms [5]. Two important definitions introduced in their study are sequential consistency and sequential improvement. They also introduce the concept of a roll-out algorithm, which holds a close resemblance to the FOM approach to solve MPC problems. At the end of the section we will further discuss this, but we first need to introduce the main definitions and conclusions of the sequential properties study. We will use the same introductory example used in their study because it is similar to the problem we try to solve. The main differences will be mentioned at the end of the section. Let us consider a graph search problem on a directed graph with node set N and arc set A. For simplicity, an initial node s is defined. For consistency, we will keep the formulation presented in Bertsekas’ study, that groups all the search costs in a subset of terminal (with no outgoing arcs) nodes ¯ Ncalled destinations. 16
In this formulation, each path from the origin to a destination node (s,i1,i2, ..., in,¯ i) (see remark 3.7) has an associated cost g(¯ i) solely defined by the destination node. We want to find a directed path that starts at the origin s, ends at one of the destination nodes i∈¯ N, and is such that the cost g(i) is minimized. Remark 3.7.In order for a sequence (i1,i2, ..., in) to uniquely define the path created by the composition of the arcs (i1,i2), (i2,i3), ..., (in−1,in) we need to assume that given an ordered pair of nodes (i, j), there is at most one arc (i, j) with start node i and end node j. This assumption can always be safely made. Remark 3.8.We allow the node and arc sets, Nand A, to contain an infinite number of elements. We require, however, that the number of destination nodes be finite. The search problem can then be formulated as a DP problem with the nodes corresponding to the states of the DP and the arcs corresponding to the possible state transitions, and the destination nodes corresponding to the terminal states. An heuristic His then defined as a path construction algorithm that construct a path from a non-destination node to a destination one (remark 3.9) and H(i) is defined for any node i∈Nas the cost of the destination node of the path constructed by H: H(i) = g(¯ i) Remark 3.9.Implicit in this assumption is that for every non-destination node, there exists at least one path starting at that node and ending at some destination node. Having introduced this definition of heuristic in this search problem, the concept of roll-out algorithm is introduced. The formal definition of roll-out algorithm escapes the scope of this study, but an intuitive definition would be: Definition 3.10. Roll-out Algorithm: Given a starting node s and a heuristic H, we define the roll-out algorithm based on H(called RH) as following: 1. We consider all downstream neighbours i (with |i|=n) of s and we apply Hat each possible i. 2. We consider the n paths (i,i1, ...,¯ i) obtained from the previous step, each of which has an associated cost H(i). 3. We compute the node i∗which minimizes H(i) and we move to the neighbour i∗ 1. 4. The algorithm is then iteratively developed by considering i∗ 1the new start node s and repeating the procedure from step 1 until s is a terminal node. The nature of the roll-out algorithm and the FOM approach are similar in the sense that use simpler base heuristics that would not give satisfying solutions by themselves and keep applying them at every new step, exploring new paths that were not considered when the heuristics were applied to the root node. This study provided some interesting properties that related the heuristic Hwith its roll-out RH. Most of them were properties that guaranteed that RH would eventually stop (a problem we don’t have in our MPC approach, because |N|and |A|are finite) or variations of the roll-out technique that we will discuss later. In order to properly explain them we need to first introduce two main concepts that helped us to understand some of the limitations of the current FOM formulation and that will be discussed on section 6.4. Definition 3.11. Sequential Consistency: The heuristic His said to be sequentially consistent if for every node i, whenever Hgenerates the path (i,i1, ..., im,¯ i) starting at i, it also generates the path (i1, ..., im,¯ i) starting at the node i1. 17
A learning approach to the FOM problem Definition 3.12. Sequential Improvement: Suppose that algorithm Hgenerates, starting at each node i∈N, a path (i,i1, ..., im,¯ i) with the property H(i)≥H(i1). Then the heuristic H is said to be sequentially improving. Figure 8: Excerpt from Bertsekas’ study. It shows the graph associated with a one dimensional walk problem. The highlighted path corresponds to the result obtained by applying both the roll-out algorithm RH1from example 3.13. A plot of the cost function g(i) is shown on the lower part of the picture. We are going to borrow two of Bertsekas’ examples (associated with Figure 8) to illustrate this two concepts. Example 3.13. One dimensional walk with a sequentially consistent heuristic: Consider a person who walks on a straight line in a temporal and spatial discrete world. During each time step, it can move a fixed length unit to the right or to the left (it cannot stay still). At time 0 this person is at position 0 and it walks for a fixed number of time steps Nbefore ending up in a position ¯ i∈[−N,N]. Each terminal point has an associated cost g(¯ i) and the objective is to minimize the cost of the terminal position. Figure 8shows a graph representation of the analogue graph search problem, where each node is defined by a state (k,m) where kis the number of steps taken so far and m is the current position. Each node (k,m) has two outgoing arcs: to (k+ 1, m−1) for the left step and to (k+ 1, m+ 1) for the right one. Let H1be an heuristic defined as follows: If H1applied at node (k,m), it takes N−ksuccessive steps to the right, terminating at the node (N,m+N−k). Note that H1clearly is sequentially consistent. 18
The algorithm RH1applied at node (k,m) uses the roll-out algorithm described above and obtains the path highlighted in Figure 8. In Bertsekas’ study it is further proven that the obtained result is always a local minimum. Example 3.14. Consider the set-up of example 3.13, and let H2be defined as follows: when applied at node (k,m), H2compares the cost g(m+N−k) (corresponding to taking all of the remaining N−k steps to the right) and the cost g(m−N+k) (corresponding to taking all of the remaining N−ksteps to the left). If the first is lower, it takes one step to the right. Otherwise, it takes one step to the left. In Bertsekas’ work it is mentioned that H2has no sequential consistency propriety, but has instead sequential improvement. It is also shown that RH2obtains the global minimum. Using these definitions, Bertsekas et al. derive some relations between the base heuristics and their associate roll-out procedure. In section 6.4 we propose a method to guarantee the sequential improvement of the FOM method when used with a full horizon instead of a finite one. Our method was inspired in a modification of the traditional roll-out technique proposed by Bertsekas called optimal roll-out. Consider that at a given roll-out step, the heuristic Hgenerates the optimal path (i0,i1, ..., im,¯ i). Then the fortified roll-out algorithm stores the maximal suffix S0= (i1, ..., im,¯ i) and, in the next roll-out iteration, it will consider the paths generated by Htogether with the path defined by S0. If the optimal path given by His not better than the one provided by S0, the algorithm executes the next step of S0and stores the next maximal suffix S1= (i2, ..., im,¯ i). If the path provided by His better, its first step is executed and the algorithm stores its maximal suffix. This procedure is followed until reaching one of the terminal nodes. The main idea behind this modified roll-out technique is to simply keep comparing all the possible paths at a certain step with the best path from the previous step. This way the sequential improvement of the algorithm is clearly guaranteed. 4. Goal Revisited To solve MPC problems fast enough to implement them online in a control problem is an open problem of interest for the robotics manipulation community, as explained in section 3.3. We consider that Hogan’s work in the FOM technique is a good way to provide an heuristic-based approximate solution to this problem. The main objective of this study is to bring this method close to the research community by: 1. Improving the properties of FOM: In section 6.2 we will discuss the differences in the formulation used in Hogan’s study and the one used in this one, as well as why is it fundamental for the proper execution of the FOM method. In section 6.4 we will discuss some of its sequential weaknesses and how we addressed them, and in section 7.3 we will present a new FOM-based method to track complex trajectories. 2. Comparing it to other techniques: In section 6.3 we will discuss some of the difficulties we found while trying to compare it to MIQP or MIQP approximations. 3. Providing a systematic set-up: In chapter 7we will present a systematic protocol with an stochastic approach to choose the modes of the family. 4. Showing the system scalability and robustness: We want to track more complex trajectories, more complex systems, and use models of a simple system to solve a problem that uses a more complex 19
A learning approach to the FOM problem It should be noted that equation 16 is different from the linearized motion equation presented in Hogan’s work. This fact will be discussed further in section 6.2 but the main idea is that the term fi(x∗,u∗)−˙ x∗ cannot generally be cancelled as in other traditional control problems because fi(x∗,u∗) will not describe the instantaneous motion of the nominal trajectory if the nominal trajectory is in a hybrid state different from the one defined by i. Similarly to the linearization of the motion equation, the friction constraint equations from 11 to 13 can also be linearized with respect to ¯ x. For consistency with the variables used for the motion equations (¯ xand ¯ u)vxand vyare expressed as v∗ x+ ¯vxand v∗ y+ ¯vyrespectively: Sticking: ((v∗ y+ ¯vy)≤(γt(x∗) + Ct(x∗)¯ x) (v∗ x+ ¯vx) (v∗ y+ ¯vy)≥(γb(x∗) + Cb(x∗)¯ x) (v∗ x+ ¯vx)(17) Sliding Right: (v∗ y+ ¯vy)>(γt(x∗) + Ct(x∗)¯ x) (v∗ x+ ¯vx) (18) Sliding Left: (v∗ y+ ¯vy)<(γb(x∗) + Cb(x∗)¯ x) (v∗ x+ ¯vx) (19) where Ct(x’) = ∂γt ∂¯ xx’ and Cb(x’) = ∂γb ∂¯ xx’ This notation allows us to write all the linearized motion cone constraints in a condensed form suitable for a linear programming optimizer, as equation 16: Ei(x∗,u∗)¯ x+Di(x∗)¯ u≤gi(x∗,u∗) (20) E1(x’,u’) = v0 y−Ct(x’) Cb(x’),E2(x’,u’) = v0 yCt(x’), E3(x’,u’) = −v0 yCb(x’) D1(x’) = −γt(x’) 1 γb(x’)−1,D2(x’) = −γt(x’)−1,D3(x’) = −γb(x’) 1 g1(x’,u’) = −v0 y+γt(x’)v0 x v0 y−γb(x’)v0 x,g2(x’,u’) = v0 y−γt(x’)v0 x−,g3(x’,u’) = −v0 y+γb(x’)v0 x− Remark 5.1.is just a small positive scalar used to express strict inequalities, as the optimizer we used only supported non-strict ones. 5.6 MPC And MIQP Formulation As explained in section 3.3, each MPC mode fixed sub-problem will compute the optimal values for the state and control variables for a discrete finite horizon of N steps, a time step h, and a given initial position ¯ x0to minimize the cost equation provided in equation 6, subject to motion and cone constraints. We will use the perturbation dynamics, so the state and control variables will be (¯ x1, ..., ¯ xN) and (¯ u0, ..., ¯ uN−1); and the initial state will be x0. As MPC considers a discrete framework, we need to discretize the motion equations from previous section. After a first order discretization, the MPC constraints at step j are: if j=0:(¯ x1=¯ x0+hBi0(x0)¯ u0+hfi0+x∗ 0−x∗ 1 Di0¯ u0≤gi0 (21) 26
if j>0 : (¯ xj+1 = (I+hAij )¯ xj+hBij ¯ uj+hfij +x∗ j−x∗ j+1 Eij ¯ xj+Dij ¯ uj≤gij (22) where Aij =Ai(x∗ j,u∗ j), and Eij =Ei(x∗ j,u∗ j), using the notation from section 5.5.fij is defined differently depending on the iteration step: fij =(fi(xj,u∗ j), (if j = 0) fi(x∗ j,u∗ j), (if j >0) Bij ,Dij ,Eij , and gij are defined in an analogue way, evaluating their section 5.5 counterparts on xjfor the first step and on x∗ jfor the following ones. Remark 5.2.For the case j = 0, ¯ x0is known value, so the first order discrete version of equation 14 becomes: x1=¯ x1+x∗ 1=hfi(x0,u0) + x0=hˆ Bi(x0)(¯ u0+u∗ 0) + ¯ x0+x∗ 0(23) and by isolating ¯ x1we can obtain the linear motion equation in expression 21 without having to apply a linearization step. In a similar way, the friction constraints can also be expressed as linear constraints with respect to ¯ u0 Let m= (s0, ..., sN) denote the hybrid mode where at step j of the fixed mode MPC sub-problem the system is in the hybrid state sj. Then, the sub-problem constraints are formulated by substituting i with sj in equations 21 and 22. Then the optimization problem is fed into the commercial optimizer Gurobi [2] to obtain the optimal values of (¯ x1, ..., ¯ xN) and (¯ u0, ..., ¯ uN−1), together with the optimal cost function. The full MPC problem solution is then approximated to be the best sub-problem solution. As will be explained in section 6.3, we also implemented an MIQP solver to compare our FOM against. The formulation we have presented in this section has already linear constraints and quadratic cost function, so we can apply quadratic programming solvers to them. Gurobi allowed us to formulate the mode dependent constraints by using binary decision variables and a big-M notation. The resulting formulation for the motion and friction constraints is as follows: if j=0: x1≤(¯ x0+hBi0(x0)¯ u0+hfi0+x∗ 0−x∗ 1) + M(1 −zi0) −x1≤ −(¯ x0+hBi0(x0)¯ u0+hfi0+x∗ 0−x∗ 1) + M(1 −zi0) Di0¯ u0≤gi0+12×1M(1 −zi0) (24) if j>0 : ¯ xj+1 ≤[(I+hAij )¯ xj+hBij ¯ uj+hfij +x∗ j−x∗ j+1] + M(1 −zij ) −¯ xj+1 ≤ −[(I+hAij )¯ xj+hBij ¯ uj+hfij +x∗ j−x∗ j+1] + M(1 −zij ) Eij ¯ xj+Dij ¯ uj≤gij +12×1M(1 −zij ) (25) z1j+z2j+z3j= 1 (26) The equality constraints a=b(where a and u are functions of xand u) have been broken into two inequality ones a≤band −a≤ −band each mode independent constraint a≤bhas been modified into a≤b+M(1 −zij ) for an appropriate binary variable zij . If the sub-problem is in state i at step j, zij = 1 and the term M(1 −zij ) is zero and the original inequality constrains applies. If the sub-problem is not in that state at step j, zij = 0 and the inequality becomes a≤b+M. If the value of M is high enough (specifically, if it is higher than any possible value of the expression a - b) the inequality becomes redundant. Equation 26 enforces that the MPC sub-problems are in one and only one hybrid state at each step. 27
A learning approach to the FOM problem 6. Simulation Interface The simulations of Hogan’s study were mainly designed for an specific choice of modes and a specific trajectory to follow. In this study, we wanted to study general properties of the FOM problem, to generalize the results to more complex pusher-slider systems and trajectories, and to compare our different FOM strategies to solve the MPC problem with other conventional methods as MIQP. In order to satisfy this needs, we decided to implement a general simulation tool. The code main structure can be described as follows: An abstract state interface is implemented to provide the dynamics and cone constraints of the state as well as their linearized versions at a certain objective state space and control input. To define a certain experimental problem, the dynamics function and constraint equations are derived depending on a general state space variable xand controller action uand the necessary state instances are implemented and a mode is then defined by a vector of state handles. An MPC solver class is also implemented to get an initial condition and an objective trajectory and return a control input. Each MPC solver implementation can include its own member states or modes (as well as other optimization set-up variables) and internally decides how to handle them. At the same time, an Euler integration simulator is implemented. This simulator uses its own state classes to describe the dynamics of the pusher slider system. These states are independent from the optimization ones so that discrepancies between model and reality can be simulated (for example the MPC solver can use linearized dynamics or cone constraints while the Euler integrator uses the non-linearized version, which is more similar to the real experimental set-up than using linearized dynamics in both places). The Euler integration class also holds a member MPC solver that returns the control input to be applied. The integrator then computes the value of the state variable derivative ˙ xand uses a simple quadrature to approximate the next state variable value. The controller (MPC solver) and simulator are decoupled, so they can consider different hybrid states. This allows us to consider more realistic models for the euler integration step of the simulation (we always use non-linearized motion equations for the integration step), to use different parameters in their states (to test controllers designed for a certain slider shape, µg, and µptogether with a simulator set-up with different parameters, to show the robustness of the controller to uncertainties in the models). 6.1 Local, Global and MPC Costs During the previous work at MCubelab, there was no systematic and objective way to evaluate the global trajectory resulting from the FOM control law, the exit or failure of an experiment was mainly determined in a subjective binary way. If the pusher slider didnt show appreciable divergence (at the naked eye) from the planned trajectory it was considered a success, otherwise it was a failure. In a similar fashion if the system was perturbed (by an external interaction), the success lied in recovering the original trajectory in a reasonable time determined subjectively. The main goal of the study was just to demonstrate that FOM could effectively control the pusher slider system to track previously planned trajectories, and that all this process could be done online. Because of this proof-of-concept nature, this approach was sufficient. For this thesis we wanted a more objective way to evaluate how good a control trajectory was and this required a certain notion of metric or score for the global trajectory. We tried to keep coherence between the global and local cost functions, but removed the ¯ xT NQf¯ xNterm of the cost function. As presented in section 3.3, this term is used to account for the information missing because of the finite horizon. When 28
scoring the final trajectory, we have the full horizon information, so this term is no longer required. The obtained cost function is S= M P i=0 (¯ xT iQ¯ xi+¯ uT iR¯ ui), where Mis the number of euler integration steps. We will denote by local cost over time each of the ¯ xT iQ¯ xi+¯ uT iR¯ uivalues. It is important to note that even if this global cost function is used score how close the obtained trajectory was from the desired one, it is not a direct indicator of the MPC solving performance. We will denote the cost function provided in section 3.3 as MPC cost. Then optimizing the MPC cost at each iteration could incur in a larger optimal cost for the global trajectory. If we are currently at the state xi and we consider two modes M1and M2with local costs c1and c2, with c1<c2there’s no guarantee that executing the first step of the trajectory obtained from mode M1will translate in a smaller global cost function. Some causes for this effect are exposed and fixed in 6.4 but, even after fixing them and considering an ideal world scenario (where the models are completely accurate and there’s no sensor noise), the fact that the receding finite horizon adds new information to the problem at every control iteration implies that the optimal state and control pair (xi+1,ui) computed at the control iteration icould technically lose their optimal property when the information from control iteration i+ 1 is introduced. This effect is common in all receding finite horizon problems and there’s usually no way to completely solve it. In order to evaluate the MPC solving performance of our method, some of the simulation results we expose in the following sections show a plot of the local MPC cost over time in addition to a graphical representation of the trajectory and its global or local cost. It will be shown that, when extending a family F1into a family F2by adding more modes, the local cost of F2descends with respect ot F1in the first bifurcation of the local MPC cost over time plot. This will be further discussed in section 6.5. 6.2 Nominal Mode In section 5.5 we noted that, as opposed to the previous study, we do not simplify the term fi(x∗,u∗) + ˙ x∗ in equation 16.x∗can be described by the same motion equations as xusing the hybrid state friction constraints to determine the hybrid state, but it is important to realize that, once we constrain out system to be in a state iat a time instant tj, the specific motion equation that describes this instant-state system fi(xj,uj) may not describe the instantaneous motion of the nominal trajectory. The nominal trajectory will clearly be described by fi0(x∗ j,u∗ j), but there’s no guarantee that i=i0. The error introduced by assuming fi(x∗,u∗) + ˙ x∗= 0 can be critical for the performance of the controller. In Figure 12 we can see the behaviour of the FOM approach when trying to track a circle using a family of modes learned using the procedure described in section 7.2. The red slider follows the nominal trajectory. The trajectory followed by its center of mass trajectory is represented with the black line. The blue slider follows the simulated trajectory and its center of mass follows the blue line. The last position of the simulated slider is highlighted and the other snapshots are faded away. The considered optimal paths the MPC considers are shown at the center of each simulated slider. The chosen path is the yellow one. As can be seen the obtained trajectory diverges from the nominal one. Furthermore, it can be seen how the optimal finite horizon trajectory computed in the MPC problem is completely different from the realized trajectory. In Figure 13 the correspondent local cost over time is shown. The possibility of the hybrid states associated the nominal trajectory to be different from the ones associated with the real trajectory has another important implication. The perturbation state motion equation 16 has the nominal trajectory as an equilibrium point only when i=i0. Otherwise, if we consider x=x∗and u=u∗, we obtain ¯ x=Ai·0+Bi·0+fi(x∗,u∗)−˙ x∗=fi(x∗,u∗)−fi0(x∗,u∗). If none of the MPC modes is the one that the nominal trajectory follows, the solution ¯ xj=¯ uj=0will never be feasible, 29
A learning approach to the FOM problem Figure 12: Snapshot from the video simulating the trajectory obtained when tracking a circular trajectory provided by equation , with d= 0.0249. with the 8 best modes obtained using the procedure presented in section 7.2. and we will never be able to stabilize the planned trajectory on the nominal one, even if the initial state is on the nominal trajectory (x0=0). In order to force the MPC to consider the nominal mode, we can simply compute it at every MPC step (it can be easily determined applying the friction constraints to each pair x∗ j,u∗ j) and add it as one of the modes of the family. 6.3 MIQP and Clustered MIQP We wanted to compare the solutions provided by FOM with traditional MPC solving techniques. In order to do that we decided to implement the MIQP technique using the commercial solver Gurobi. This solver was already used in Hogan’s work in a force-based formulation prior to the final velocity-based one. This formulation was not presented in the final paper, but it allowed to formulate an MIQP problem that was able to run in an average of 3Hz. It should be mentioned that the execution time at every control iteration could range between few milliseconds to 10 seconds depending on the initial condition of the MPC. This is not a problem for simulation, but in a real control environment the frequency at which you can update the controller is not bounded by the average frequency at which you can solve the MPC, but by the worst case scenario one. Otherwise the controller may try to update the control input before it is computed by 30
Figure 13: Local cost over time associated to the trajectory in Figure 12 the optimizer. There may be solutions to this effect in other formulations, but for the one used in Hogan’s work the MIQP controller could run at more than 0.1Hz. We were expecting a similar behaviour in the velocity-based formulation, but it took several orders of magnitude more time to solve each iteration. In order to simulate 500 simulation steps with a finite horizon of 7 steps it took an average of 6 hours of execution time, which implies that the maximum control frequency we could apply would probably not surpass 0.02Hz. We were expecting to have an ”ideal” MIQP result to compare FOM with but, as will be shown in section 6.5, the results obtained with a small finite horizon for the MIQP did not track properly many of the non-trivial nominal trajectories and initial perturbations we fed into it. We looked at techniques to speed up the MIQP execution in the Gurobi website and we found out that our current big-M formulation worked better (both in execution time and in quality of the obtained trajectory) as smaller the M parameter was. As explained in 5.6 each M parameter used in a scalar inequality Ax ≤b+M(1−z) must be greater than max x∈D(Ax −b) (where D is the domain of possible values of the x) so that the inequality is rendered redundant when z = 0. We implemented a version of MIQP that given a vectorial constraint as the ones used in Hogan’s formulation A~ x≤~ b+M(1 −z)·(1, ..., 1)Treplaces the arbitrary constant M by a vector ~ Mwhere each component’s value is Mi= max xi∈D(Aixi−bi). We were not able to improve the execution time, but we were able to obtain better results for the MIQP. The results showed in the next section for the MIQP will use this optimized big-M formulation. In order to compare FOM to other methods using a longer time horizon, we implemented another MPC solving method based on MIQP that we called Clustered MIQP. Given a standard MPC formulation, this method works in the following way: •Consider a clustering factor c, a finite horizon N·cand a set of h hybrid states {H1, ..., Hh}. 31
A learning approach to the FOM problem •The finite horizon is then divided into N clusters of c steps: (C1, ..., CN). •The state space is extended in a similar way as in section 5.6 with 3 binary variables per cluster for a total of 3Nvariables. •Each variable z1iz2i, and z3iis then associated with the hybrid state of the cluster Ci(sticking, sliding down and sliding up respectively). •The constraint z1i+z2i+z3i= 1 is enforced for all i. •The problem constraints are formulated with big M notation as in section 5.6 and the problem is fed into a Gurobi MIQP solver. As we exposed in section 3.3, the MIQP formulation doesn’t escalate well with the number of binary variables added and clustered MIQP allows us to reduce the binary variable dimensionality of the optimization problem by keeping the same state during all the steps of the same cluster. The execution time of this new problem is similar to the execution time of a MIQP problem of Nsteps but the controller inputs can be different at each of the Nc steps, providing a more flexible trajectory than the one given by the MIQP problem of Nsteps. We intended to use this method to approximate MIQP problems with long horizons by using few clusters and we expected to obtain a better trajectory than the ones obtained with FOM. As will be discussed later, the results of this MIQP approximation were usually worse than the ones obtained in the FOM with the original modes from Hogan’s study. In section 6.5 we discuss the implications of these results. 6.4 Chameleon Mode In the previous FOM study there was no guarantee of improvement in the obtained trajectory by considering new modes in a previously used family. It needs to be clarified that, even if in the previous study there was no global score function implemented, this effect could be so big that it could be observed with the naked eye. An illustrative example would be the following. A family containing only the sticking mode F1=Swould greatly outperform the extended family F2=S∪(L,R,S,N−2 ···,S). On the other side a further extension F3=F2∪R1would outperform the two previous families. This behaviour can be shown in Figure 14. The performance decrease experienced in F2can be explained by the fact that the FOM optimizer can choose optimal trajectories that will never be able to be applied. For example, the optimal control solution at a certain optimization iteration can be to choose the second mode of F2: start with an L state for the first time step to then choose a R step and finally choose an S step for the rest of the finite time horizon prediction. The capability of sliding left and right should allow the pusher to take more aggressive turns by sliding to one of the slider edges and then slide back to the center to properly track the straight line. The main problem is that the control law for the controller is to execute the only th first step of the optimal trajectory, so the system will be in an L state for one time step and then the control law will be recomputed. As no mode starts with a sliding right state the slider can never go back to the central position. The conclusion these experiences led us to was that, using Bersekas’ terminology, some families did not have the sequential improvement property. What’s more, the results seemed to indicate that composition or expansion of families that apparently had sequential improvement could lead to losing the property. Solving the MPC using the FOM approach has similarities with the roll-out algorithm presented in their study: Each of the modes can be considered a heuristic and the strategy of recomputing the control policy 32
Figure 14: Local cost over time for families F1,F2, and F3obtained following a straight line on the x axis and using an initial condition x0= (0, 0.05, −π 6, 0)T. at a certain frequency by using the same heuristics can be viewed as a roll-out-like technique. In fact, we could easily reformulate any family of our FOM approach to behave as their roll-out by increasing the finite horizon by one step and substitute each of the original modes by a triplet of copies preceded with an S, L, and R state respectively. We decided not to use an exact roll-out because, as we will show in this section, we were able to find a strategy to guarantee a sense of improvement without having to increase the number of MPC sub-problems to solve by a multiples of the number of possible states. It is important to note that the concepts of sequential consistency or optimality cannot be applied to our case without some previous modifications, because of the existence of a receding finite time horizon, but for every FOM problem we can formulate an associated Full Horizon Family of Modes (FFOM) problem as follows: Definition 6.1. FFOM: Given a FOM problem defined by a finite horizon of Nsteps, a set Hof possible hybrid states, a cost function J, and a family F(0) ={M(0) 1, ..., M(0) k}containing k modes, where M(0) iis a general mode described as M(0) i= (si,1,si,2, ..., si,N), with sij ∈H. Furthermore, consider a cost function Jk= N P i=k¯ xT iQ¯ xi+¯ uT iR¯ ui (defined using the Qand Rmatrices from the FOM cost function J) and the prefixes of each of the modes of the family M(j) i= (si,1, ..., si,N−j). Then the associated FFOM problem is defined iteratively as follows: 1. Solve the FOM-based MPC problem defined by F=F(0) and J=J0, using x0as the initial condition. 2. Use the controller ¯ u0from the optimal solution of the problem solved in the previous step to compute the value of ¯ x1. Under an ideal world assumption (that is, assuming that our motion equations model 33
A learning approach to the FOM problem is accurate) the value of ¯ x1will correspond to the same value obtained in the optimal trajectory of the MPC. 3. Replace Fby F(1) ={M(1) 1, ..., M(1) k},Jby J1, and the initial condition by ¯ x1and go to step 1, solving this time an MPC problem of N−1 steps. 4. Repeat until the horizon has only one step. This formulation represents how the FOM problem would behave be if we had enough computation power to cover a finite horizon that reaches the desired final time step. Using it, we can study the FFOM problem associated to the example families presented at the beginning of this section. For simplicity, we will consider the realized states and control inputs to describe the considered trajectories. Example 6.2. F1is sequentially consistent in its FFOM version and assuming an ideal world: Consider that at a certain control iteration there’s a full horizon of N steps to reach the end of the trajectory. The only considered mode, S, get the optimal path to reach the goal while keeping the sticking contact at all times, obtaining a sequence of position states xS(x0) = (x1,1,x1,2, ..., x1,N) and control inputs uS(x0)=(u0,1,u1,1, ...u1,N−1) for the optimal path from the initial position to the goal. Then, the controller will execute u0for one control step and the pusher slider system will move to x1. The only heuristic it considers in the next optimization step is to stick until reaching the goal, so the optimal trajectory obtained will be xS(x1)=(x1,2, ..., x1,N) and uS(x1)=(u1,1, ...u1,N−1), being sequentially consistent. Example 6.3. On the same conditions, F2is not sequentially consistent nor improving: Let’s call the second mode of family LR1. If this mode is chosen at a certain time step, giving an optimal trajectory xLR1(x0) and control uLR1(x0). In the next step, a mode R1is required in the family to consider the continuation of the previous optimal trajectory, which consists in sliding right and then sticking until the end of the trajectory. As it is not the case, the new FFOM step will not consider the previously optimal trajectory and, if no relation can be proven between the trajectories considered in the current step and the ones considered in the previous step, neither consistency nor improvement cannot be guaranteed. Consider that, at a given step of a FFOM problem, the initial position is given by x0and the optimal trajectory is determined by the mode M(0) 1= (s1,1,s1,2, ..., s1,N). If the family contains a mode whose maximal prefix corresponds to the maximal suffix of M(0) 1,M(0) 2= (s1,2, ..., s1,N,s2,N+1) then sequential improvement will be guaranteed at the next iteration step. That is, if the trajectory provided by M1at the first step is xM(0) 1(x0)=(x1,x2, ..., xN) and uM(0) 1(x0)=(u0,u1, ..., uN−1) and the one provided by M2at the second step is xM(1) 2(x1)=(x’2, ..., x’N) and uM(1) 2(x1) = (u’1, ..., u’N−1), then Lemma 6.4. J1(xM(1) 2(x1), uM(1) 2(x1)) = J1(xM(1) 1(x1), uM(1) 1(x1)): As M(1) 2is the maximal suffix of M(0) 1the continuation of the trajectory provided by M1on the first step is feasible in the mode M2during the second step so, as the trajectory given by M2is optimal, J1(xM(1) 2(x1), uM(1) 2(x1)) ≤J1(xM(1) 1(x1), uM(1) 1(x1)) If we assume J1(xM(1) 2(x1), uM(1) 2(x1)) <J1(xM(1) 1(x1), uM(1) 1(x1)) we can easily reach a contradiction. Let’s define x∗= (x1,x’2, ..., x’N)and u∗= (u0,u’1, ..., u’N−1). This is a feasible trajectory in M(0) 1but J0(x∗,u∗)can be expressed as: J0(x∗,u∗) = xT 0Qx0+uT 0Ru0+J1(xM(1) 2(x1), uM(1) 2(x1)) 34
and we can conclude that J0(x∗,u∗)<xT 0Qx0+uT 0Ru0+J1(xM(1) 1(x1), uM(1) 1(x1)) = J0(xM(0) 1(x0), uM(0) 1(x0)), reaching a contradiction. Let’s now consider an extension state E. That is, a default state to apply mode extensions. We can then define a mode suffix operation as follows. Definition 6.5. Mode Suffix Operation: Given a default extension state E, applying the suffix operation to mode M1= (s1,s2, ..., sN) results in M2=suff (M1)=(s2, ..., sN,E) This definition allows us to announce the following corollary from lemma 6.4. Corollary 6.6. A family F closed by a suffix operation is sequentially improving in the FFOM problem: At any step i of the approximated MPC, a certain mode M will provide the optimal trajectory. As suff (M)∈F we can use lemma 6.4 to guarantee that the trajectory provided by suff (M)in step i + 1 is as good as the one currently provided by M. As the approximated MPC considers the optimal trajectory between all the considered modes, the computed trajectory at i + 1 will be at least as good as the one computed in i. Example 6.7. On the same conditions, F3is sequentially improving: F3is closed by the suffix operation defined using Sas the extension state, so we can use corollary 6.6 to guarantee sequential improvement in the FFOM. We considered important to guarantee sequential improvement for the FFOM problem even taking into account that our problem is not in the ideal world (modelling errors and different frequencies for the optimization problem and the controller can lead the state obtained when applying u0to ¯x0to be different from x1) and that we don’t have a full horizon. As we showed in the examples above, the simulation results were in agreement with these theoretic results as the families that implicitly guaranteed sequential improvement in their FFOM version tended to outperform the ones that did not. In order to guarantee it we decided first decided to only use families that were closed by the suffix operation obtained using Sas the extension mode. The problem with this approach is that for any mode M= (s1, ..., sN) you add to a family F you need to include all of its possible S-extended suffixes. Different modes required adding a different number of suffix modes. For example, an Smode required no extra modes (as it is itself closed by the suffix operation) and for a Rnone you only need to extend the family with an Smode and all the Rimodes for i<n. Even taking this into account, we considered adopting this strategy constrained the problem of family design more than we wanted to and added more extra nodes that was strictly necessary, so we decided to adopt another strategy. This translated into changing from static families to dynamical ones. The strategy we used consisted in including a dynamic mode that we called chameleon mode. If, at a certain step i, the optimal FOM mode is mode M, the chameleon mode is defined in step i+ 1 as suff (M) (using, as before, Sas the extension state). This guaranteed sequential improvement by applying lemma 6.4 in an analogue way as in corollary 6.6. The chameleon mode functionality was added in the simulation interface and its performance was tested in simulation. As we will show in section 6.5, implementing this functionality resulted in an improvement of the sequential behaviour of the FOM algorithm. Being able to safely add arbitrary new modes to the FOM family without fear of losing its sequential properties allowed us to develop an strategy to learn a good family set-up for a general trajectory tracking problem, as will be shown in chapter 7. 35
A learning approach to the FOM problem Figure 20: Example histogram of Ci(¯xj) of the local costs obtained while tracking a circle for 1000 initial conditions and 253 possible modes. The histogram is taken by fixing an initial condition ¯ xjand evaluating the values of Ci(¯xj) for all possible i. Each color represents a different initial condition. The costs are clearly non-comparable Figure 21: Example histogram of ˆ Ci(¯xj) for the same simulation set-up as in Figure 20. The costs are now comparable 42
the full space of modes M, which grows exponentially with the length of the finite horizon. Inspiring ourselves in the original modes from Hogan’s study, that concentrate all their variability on the first step, we devised the following protocol: 1. Consider short horizons that allow to compute ˆ Cifor all the possible modes fast. 2. Gather a number samples of ˆ Cirelatively big compared to the number of possible modes. 3. Select the modes that minimize the cost function in the small horizon environment. 4. Extend the families to a longer horizon with simple S state tails. As we will show in section 7.3, this approach is sufficient in our pusher-slider system to track complex trajectories, but in section 9we discuss an iterative procedure to extend the considered finite horizon. Choosing the set of K modes that minimizes the desired expression can depend exponentially on K, so we used a greedy upper bound approximation to compute it. The greedy approach was defined iteratively as follows: 1. Consider m1=S(it is the nominal mode, so we always need to include it in the family) and C1(¯ xj) = Cm1(¯ xj) 2. Select mi+1 to be the one that minimizes E P j=0 min(Ci(¯ xj), Cmi+1 (¯ xj)) E 3. Let Ci+1(¯ xj) = min(Ci(¯ xj), Cmi+1 (¯ xj)) This algorithm provides an upper bound for min m1,...,mK∈M E P j=0 (K min i=0 Cmi(¯ xj)) Ewe implemented the algorithm and we determined the lower bound of ¯ C(¯ x0;m1, ..., mK) by computing the statistical mean over the minimum of all the modes: E P j=0 ( |M| min i=0 Cmi(¯ xj)) E. Figure 22 shows the evolution of the cost provided by our greedy algorithm as more modes are added to the family. It can be seen that the upper bound quickly converges to the lower one. In the following section we will apply this procedure to linear and circular trajectories. 7.2 Simulation Results. Simple trajectory learning For our initial study, we tried to learn the best modes for single locally invariant trajectories. As proposed in the previous section, we started by obtaining 1000 samples of ¯ xfrom a uniform distribution in a cube in R4. The ¯xand ¯ydisturbances on the xand yposition of the slider center of mass were bounded between 0.5 and 0.5 meters. The slider angle disturbance ¯ θwas bound between -π 4and π 4and the value of pycould lay in any point on the slider surface. For each initial condition, the tracking problem was solved for all the possible modes with a small finite horizon of 5 steps. The number of possible modes was then 243 and each pair mode-sample had an associated single step FOM tracking problem. The cost functions Ci(¯xj) 43
A learning approach to the FOM problem Figure 22: Plot of our greedy approximation to the minimum value of ¯ C(¯ x;m1, ...mK) obtained by using families with K modes. The horizontal bar shows the optimal lower bound obtained when all the families are used. Its exact value is -1.5819. Figure 23: Comparison between the original FOM from Hogan’s study and the families obtained by applying the learning algorithm to a the linear trajectory x∗= (vt, 0, 0, 0)Tu∗(t)=(v, 0)T. The initial condition is ¯ x0= (0, .05, π 6, 0)T. The vertical axis correspond to the optimal value of the finite horizon MPC over time. were computed for each mode-initial condition pair and were normalized following the procedure described in the previous section. 44
Figure 24: Trajectory obtained when tracking the system described in Figure 23 with a family containing the best 4 line modes learned using this section’s procedure. We then used the greedy algorithm we developed to compute and store our approximate ordering of modes and we extend them to a longer horizon of 35 steps and we used the k best modes to track base trajectories. We applied this procedure to several circular trajectories and a horizontal line trajectory defined by x∗= (vt, 0, 0, 0)Tu∗(t) = (v, 0)Tfor a certain pusher velocity v. The results for linear trajectories are shown in Figures 23 and 24. All the learned families properly converge approximately at the same time and have a similar behaviour. The circular trajectories were imposed by continuously pushing perpendicular to the slider side (u∗(t) = (v, 0)T) at a distance dof the center of the slider side (py(t) = d. Applying the motion equations derived in section 5.5 and using the following definitions allows us to nicely compute the analytical nominal trajectory: Let A=v c2+p2 x+d2,B= (c2+p2 x), and C=pxd. Then ˙ θ(t) = −Aso, assuming θ(0) = 0, then θ(t) = −At. Then: ˙x(t) ˙y(t)=A dcos(θ(t))B−sin(θ(t))C sin(θ(t))B+cos(θ(t))C(27) Which can be integrated to obtain: x(t) y(t)=x(0) y(0)+A d˙ θ T Z 0 ˙ θcos(θ(t))B−sin(θ(t))C sin(θ(t))B+cos(θ(t))Cdt 45
A learning approach to the FOM problem considering x(0) = y(0) = 0, we obtain: x(t) y(t)=−1 dsin(θ(t))B+cos(θ(t))C−C −cos(θ(t))B+sin(θ(t))C+B(28) Also, from this expression we can easily compute the curvature associated with this curve, that we will use in the next section: k=−sign(d)1 R=−sign(d)d √B2+C2(29) Remark 7.6.We will use the common mathematical notation for the curvature sign. That is, a positive curvature means that the unit tangent vector rotates counter-clockwise as a function of the parameter along the curve. Figures 25 and 26 show the results of tracking one of the learned circular trajectories. As in the case of the linear trajectory, all the modes have similar behaviour. This is consistent with the properties shown in Figure 22. The normalized cost the modes are minimizing quickly approaches the optimal in few iterations of the greedy algorithm and afterwards there’s minimal improvement until reaching the optimal value. Figure 25: Analogue to Figure 23 for a circle trajectory with a internal disturbance. The circular trajectory corresponds to the one obtained by setting d= 0.0249. The initial condition is ¯ x0= (0.0, −0.05, −0.1, 0.0249)T 46
Figure 26: Trajectory obtained while tracking the system described in Figure 25 with the family formed by the 4 best modes learned for this circle. 7.3 Dynamic FOM. Theory and results The assumption of local invariance for the objective trajectories limited the range of application of the FOM approach as it was presented until now. In section 7.1 we mentioned that we had a motivation to use locally invariant trajectories before obtaining the simulation results from the previous section. This motivation was to train the FOM method on several base locally invariant trajectories that could describe most of the situations the tracking problem would face (For the simple contact pusher-slider system this consisted in a straight line and several circular trajectories of different curvatures). Then we wanted to learn the best k modes for every base trajectory and then approximate complex trajectories them as a piece-wise compositions of base ones. At each controller step we would use the best modes for each base trajectory depending on the base trajectory approximation of the current step. For simplicity, we decided to approximate the motion of the finite horizon by the local geometry of the instantaneous position in the nominal trajectory. We expected that a sufficient control frequency would allow the system to properly track the general trajectory even if its local properties undertook steep temporal changes. For the pusher-slider system mentioned before, the base trajectory was chosen by numerically computing the curvature of the objective trajectory at every control step and using the base trajectory with the most similar curvature value. We would then introduce dynamic families to the FOM problem. At each control step, the family used to track the trajectory would consist on the k best modes for the base trajectory that approximates the local geometry of the objective trajectory (together with the chameleon mode) to solve the MPC problem on that instant. The chameleon mode was shared between the dynamical families to ensure that the sequential 47
A learning approach to the FOM problem Figure 27: DFOM with 20 curvatures using the 4 best modes for each base trajectory. Finite horizon of 35 steps. Figure 28: DFOM with 20 curvatures using the 4 best modes for each base trajectory. Finite horizon of 15 steps. 48
consistency property was not lost. The main motivation for this method was to reduce the online cost of the FOM approach at the expense of more offline computations. We expected that choosing the best family dynamically would reduce the number of modes per family required to obtain good results in a broad range of trajectories. Having n modes in a family implies solving nconvex optimization problems at every control step, so we wanted to keep it as low as possible. The learning algorithm was executed on 10 pairs of curvatures (for each curvature k, we considered the complementary curvature −k) generated by setting the dparameter uniformly from −3b 4to 3b 4, where b is the length of the side of the slider. Using equation 29, the associated curvatures were obtained. Generating general feasible trajectories for the controller to stabilize is a complex problem in itself. We could use MPC to compute an optimal path to a certain destination using the distance to the destination as the cost function but this would have two important drawbacks. The first is that it would probably follow straight lines whenever possible, providing simple trajectories to stabilize. The second is that with MPC we can only obtain a discrete trajectory. We could approximate the obtained trajectory using splines, but we would not be able to guarantee feasibility of the trajectory defined by the state variable and the controller in the interpolated regions between control points. The planning problem escaped the scope of this study and, in order to both simplify it and to check the robustness of the controller, we decided to create trajectories by simple concatenation of linear and circular trajectories. This simplified the planning problem and created punctual discontinuities in the position of the pusher (for the straight lines the pusher was constantly at the center of the slider side, and for the circular trajectories the pusher was constantly at the distance pyassociated to the circle and there were discontinuities at the changes between trajectories). We considered important to study whether the controller was capable to react to these temporally localized points of uncertainty were there was no feasible trajectory to immediately change from one trajectory to the next. Remark 7.7.The circular trajectories used in the simulations of the DFOM had curvatures different than the ones used for the learning protocol, so the DFOM algorithm had to determine the base circle which was more similar to the nominal trajectory one. With this formulation we were able to successfully track the general trajectory and we were able to reduce the required finite horizon to track properly the trajectory to 15 steps, as can be seen in Figure 28 8. Discussion and Conclusion In the previous sections we obtained several positive results regarding the FOM algorithm. In this section we will expose them following the order in which they were presented in the thesis: 1. The results obtained in sections 6.2 and 6.4 are fundamental to approach FOM to the research community. The change in formulation that ultimately lead to the presentation of the nominal mode is fundamental to obtain the good results showed along chapter 7. We want to emphasize that, without it, all the controllers we tested on circular trajectories diverged as the one showed in Figure 12. 2. We would have liked to be able to compare the trajectories obtained by MIQP or by the clustered MIQP implementation we developed. In any case, showing the huge computational cost of MIQP in 49
A learning approach to the FOM problem our velocity based formulation is useful to get an idea of the urge of the manipulation community to find fast solutions to it, even if they are approximated, as FOM. While implementing it, we realized that its drawbacks are not only the lack of scalability as the number of variables increases. Even if the same number of variables is uses, if the geometry of the optimization problem changes the computational cost of the problem can increase several orders of magnitude, as we explained in sections 6.3 and 6.5. 3. The sequential study of the FOM families that ultimately led to the chameleon mode has proven to be critical towards increasing the understanding of the FOM mode and towards keeping it simple. If we had not studied and addressed the sequential weaknesses of FOM, we could not have ultimately devised the mode selection procedure, as adding modes to families would generally imply loss of sequential properties and, thus, worse performance. If we had decided to constraint our families to be sequentially improving (by, for example, enforcing closure with respect to a suffix operation) the size of the FOM families would probably have increased a lot in order to keep the sequential improvement. 4. While implementing the mode selection protocol we were able to better understand why the fast and exact MPC solving is still an open problem. In order to be able to compute the best modes for a certain trajectory in a reasonable time we had to take several layers of assumptions. Fortunately, we were finally able to automatically provide minimal families of around 4 modes that successfully tracked the trajectories they were designed for. 5. Showing that the DFOM is capable to track trajectories with punctual discontinuity is a great result toward proving the robustness and generality of the FOM approach, but we should be able to track other trajectories than compositions of circles and lines if we want to convince the manipulation community that the FOM can be a general controller. If we look at these results as related to the objectives we presented in chapter 4, we can conclude that: 1. The properties and formulation of the FOM have been clearly improved thanks to the concepts of chameleon and nominal modes and all their related theoretical background. 2. We have not been able to compare the results of FOM with those of MIQP. We successfully compared FOM with clustered MIQP, but the fact that the second was worse doesn’t allow us to have any ideal control trajectory to strive for. 3. We successfully provided a simple set-up for the FOM method that is capable to track base trajectories described by straight lines, circles or a combination of both. 4. Being able to track all these new trajectories also accounts to partially show the generality and robustness of the method, but we consider In conclusion, we consider that all the results we obtained will bring the FOM method closer to the robotics manipulation community. However, we will continue this study to improve the FOM method further before presenting it to ISRR. In the next chapter we will expose the main lines of research we are currently studying and the list of studies/experiments we want to do before the symposium. 50
ron cty=f(x) p Figure 29: Graphical representation of a pusher-slider system following a general trajectory. The osculating circle has been computed on the current trajectory state point. 9. Current and Future Lines of Research We want to further study the generality and robustness of the method, as we feel that our current results would not completely convince the manipulation community. We are currently trying to expand the general trajectory tracking of the DFOM method by using a similar approach as in Hogan’s work [14] [15]. Given a nominal trajectory y∗=f(x∗) with x∗(t) = tfor simplicity, then the local curvature of the trajectory can be computed by: k=f00(x) (1 + f0(x)2)3/2, (30) Given the parametrization of the trajectory, we can assume x(t) and y(t) to be the ones defined by the trajectory, θ(t) to be θ(t) = f0(x) and we then assume that the trajectory is defined instantaneously by the osculating circle, so the value of dcan be computed numerically so that equation 29 holds. As in the trajectory from section 7.3, the resulting equation has punctual discontinuities, so we cannot guarantee that the DFOM will be robust enough to track it until we finish the implementation and run the simulations. At the same time, we extended the formulation of the single point pusher to define the motion equations of a line pusher. We are currently trying to reproduce the learning protocol used for the single point pusher with this new system. We will try to analyse the robustness of the FOM approach by using a single point pusher FOM controller to control a line pusher and vice versa. On the learning protocol side, we will soon try an iterative method to learn the best modes for long horizons. The method starts as the procedure we presented in section 7.1. That is by learning the best k modes for a horizon of 5 steps. We then extend these k modes to a horizon of 10 steps by adding all the possible 35tails to each of the best modes of the first iteration. We would then apply the same learning procedure to the new 253kmodes, selecting again the k best. This procedure could be repeated iteratively until reaching a long horizon of around 35 steps. 51