Skip to content

Improved the re-usability and efficiency of the computation of cost value and its quadratic approximation

Carlos Mastalli requested to merge (removed):cost into devel

In this PR I have improved all the cost related classes. Basically, we gained re-usability of the code and we improved efficiency for computing the cost value and its derivatives. These are the set of task:

  • Abstraction for defining residual function and its linear approximation (Newton-Gauss assumption). This allows us to reuse code. (commit 7250243b)
  • Splitting the cost model into terminal and running one. (commit 7250243b)
  • Creating data structure for terminal and running cost. Now we don't create unnecessary data (commit 7250243b)
  • Abstraction for quadratic cost (terminal and running). Again this allows us to reuse code. (commit a723f917)
  • Renaming forwardXXXCalc and backwardXXXCalc to updateCost and updateQuadraticApprox, respectively. General speaking, DDP in its forward or backward passes update the cost value or its quadratic approximation. For instance, we might want to use dynamic classes for slightly different OC problems. Furthermore, these names have a semantic meaning inside a cost concept. (commit a723f917)
  • Cost data creation is done through x-u dimensions. Passing a dynamicModel isn't needed, this makes the API cleaner and faster to compile. (commit 830088f7)
  • Moving cost data classes from cost-manager to cost. Semantically the cost data should be in cost.py. The cost-manager include them. (commit 1e019d6d)
  • Using the cost data classes to compute cost values and its quadratic approximation. This fixed the following bug #9 (closed). (commits 0fa77995 to 9847e983).
  • Setting the set of reference per each cost function. This allows us to define an entire reference trajectory per each task (commit 3f615880).
  • Moved the setInitial to DDPModel class. This is DDP model definition. (commit 38f54342).

All the changes were tested on the HyQ problem. We need to include all the Talos arm and linear system for a complete validation.

@rbudhira please have a look. I will merge today if you don't have any objection.

Edited by Carlos Mastalli

Merge request reports