GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/temperature_control/costtemp.cpp Lines: 0 19 0.0 %
Date: 2023-06-02 15:50:43 Branches: 0 106 0.0 %

Line Branch Exec Source
1
#include "ddp-actuator-solver/temperature_control/costtemp.hh"
2
3
CostTemp::CostTemp() {
4
  Q << 1.0, 0.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,
5
      0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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, 0.0;
11
  lxu << 0.0, 0.0, 0.0, 0.0, 0.0;
12
  lx.setZero();
13
  final_cost = 0;
14
  running_cost = 0;
15
}
16
17
void CostTemp::computeCostAndDeriv(const stateVec_t& X, const stateVec_t& Xdes,
18
                                   const commandVec_t& U) {
19
  running_cost =
20
      ((X - Xdes).transpose() * Q * (X - Xdes) + U.transpose() * R * U)(0, 0);
21
  lx = Q * (X - Xdes);
22
  lu = R * U;
23
}
24
25
void CostTemp::computeFinalCostAndDeriv(const stateVec_t& X,
26
                                        const stateVec_t& Xdes) {
27
  lx = 1.0 * Q * (X - Xdes);
28
  lxx = 1.0 * Q;
29
}