Page 1 of 1

How to compute cost breakdown given trajectory?

Posted: Wed Mar 03, 2021 12:45 pm
by jiachengweng
Hi all,

Let's say I have a predictive study defined as MocoStudy with cost terms C1 and C2. After solving the problem using study.solve(), I obtain the optimal trajectory A. I can access the cost breakdown of trajectory A (values of C1 and C2 term) either in the MocoSolution, or the header of the generated .sto trajectory file.

Question: now, if I have another trajectory B that is dynamically feasible but is not obtained from the predictive study (e.g. from tracking), how can I evaluate the cost breakdown of the trajectory B with the cost formulation from the previous predictive study (values of C1 and C2 term)? In another word, how can we obtain the cost breakdown of a trajectory without modifying the trajectory in Moco?

I tried to run study.solve() with only 1 iteration to get an approximation of the cost breakdown, but this approximation is not completely the same as the true values since the trajectory has been updated slightly.

Thanks,
Jiacheng