Hey Andrea,
I havenâ€™t looked at that example prior to asking the question, since I assumed there would not be any documentation or examples for the python interface yet. After looking at the example, I think that I understand how the costs are implemented. However I have two points which need to be clear. I would appreciate if you can confirm or correct them:

The Vx, Vu and Vz costs do not serve a purpose in Nonlinear Least Squares, since everything can now be expressed as W and the cost_r terms

The Nonlinear Least Squares allows for costs expressed as sum of weighted squares of residual functions r(), which can only depend on state x and control u and time t, e.g. r(x,u,t). This formulations does not allow for negative or linear cost terms and trying to implement a linear cost c(x,u,t) by defining the residuals as square root of c() would cause numerical problems
Thanks and Cheers,
Can