GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
#include "ddp-actuator-solver/romeo_actuator/costfunctionromeoactuator.hh" |
||
2 |
|||
3 |
CostFunctionRomeoActuator::CostFunctionRomeoActuator() { |
||
4 |
Q << 1.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, |
||
5 |
0.0, 0.0; |
||
6 |
R << 0.0001; |
||
7 |
|||
8 |
lxx = Q; |
||
9 |
luu = R; |
||
10 |
lux << 0.0, 0.0, 0.0, 0.0; |
||
11 |
lxu << 0.0, 0.0, 0.0, 0.0; |
||
12 |
lx.setZero(); |
||
13 |
final_cost = 0; |
||
14 |
running_cost = 0; |
||
15 |
} |
||
16 |
|||
17 |
void CostFunctionRomeoActuator::computeCostAndDeriv(const stateVec_t& X, |
||
18 |
const stateVec_t& Xdes, |
||
19 |
const commandVec_t& U) { |
||
20 |
running_cost = |
||
21 |
((X - Xdes).transpose() * Q * (X - Xdes) + U.transpose() * R * U)(0, 0); |
||
22 |
lx = Q * (X - Xdes); |
||
23 |
lu = R * U; |
||
24 |
} |
||
25 |
|||
26 |
void CostFunctionRomeoActuator::computeFinalCostAndDeriv( |
||
27 |
const stateVec_t& X, const stateVec_t& Xdes) { |
||
28 |
lx = 1.0 * Q * (X - Xdes); |
||
29 |
lxx = 1.0 * Q; |
||
30 |
} |
Generated by: GCOVR (Version 4.2) |