Hi,

We use Matlab and CasADi to specify our Acados OCPs, and we often have the need to extract information from the OCP solve which is not directly contained in the state or control vector,

For example we might have a rotational velocity ‘w’ as a state and the torque applied to that body as decision variable ‘T’. In this case it could be that we are really interested in the power p=w*T. To get this value we need to re-implement this computation outside of the Acados definition.

This is of course possible, but creates the risk of introducing mistakes since the same expressions must be replicated in two places. We therefore think it would be valueable if we could specify and output function.

As an example assume that F is a CasADi function of the state, decisions variables and parameters, then it would be very convenient if we could set the output_expression like below and have the result of that expression calculated as part of the solver call.

```
ocp_model.set('output_expr_o',F,stage)
```

Currently we achieve this by using CasADi’s s-function generation capabilities CasADi - Blog - CasADi codegen and S-Functions but it would be nice to have similar or more generic/better functionality embedded in Acados.