Skip to content

Commit d8c837b

Browse files
committed
format
1 parent 4390363 commit d8c837b

File tree

14 files changed

+776
-811
lines changed

14 files changed

+776
-811
lines changed

include/ddp-actuator-solver/costfunction.hh

Lines changed: 61 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,70 @@
33

44
#include <Eigen/Core>
55

6-
template<typename precision,int stateSize,int commandSize>
7-
class CostFunction
8-
{
9-
public:
10-
typedef Eigen::Matrix<precision,stateSize,1> stateVec_t; // 1 x stateSize
11-
typedef Eigen::Matrix<precision,1,stateSize> stateVecTrans_t; // 1 x stateSize
12-
typedef Eigen::Matrix<precision,stateSize,stateSize> stateMat_t; // stateSize x stateSize
13-
typedef Eigen::Matrix<precision,stateSize,stateSize> stateTens_t[stateSize]; // stateSize x stateSize x stateSize
6+
template <typename precision, int stateSize, int commandSize>
7+
class CostFunction {
8+
public:
9+
typedef Eigen::Matrix<precision, stateSize, 1> stateVec_t; // 1 x stateSize
10+
typedef Eigen::Matrix<precision, 1, stateSize> stateVecTrans_t; // 1 x stateSize
11+
typedef Eigen::Matrix<precision, stateSize, stateSize> stateMat_t; // stateSize x stateSize
12+
typedef Eigen::Matrix<precision, stateSize, stateSize> stateTens_t[stateSize]; // stateSize x stateSize x stateSize
1413

15-
// typedef for commandSize types
16-
typedef Eigen::Matrix<precision,commandSize,1> commandVec_t; // commandSize x 1
17-
typedef Eigen::Matrix<precision,1,commandSize> commandVecTrans_t; // 1 x commandSize
18-
typedef Eigen::Matrix<precision,commandSize,commandSize> commandMat_t; // commandSize x commandSize
19-
typedef Eigen::Matrix<precision,commandSize,commandSize> commandTens_t[commandSize]; // stateSize x commandSize x commandSize
14+
// typedef for commandSize types
15+
typedef Eigen::Matrix<precision, commandSize, 1> commandVec_t; // commandSize x 1
16+
typedef Eigen::Matrix<precision, 1, commandSize> commandVecTrans_t; // 1 x commandSize
17+
typedef Eigen::Matrix<precision, commandSize, commandSize> commandMat_t; // commandSize x commandSize
18+
typedef Eigen::Matrix<precision, commandSize, commandSize>
19+
commandTens_t[commandSize]; // stateSize x commandSize x commandSize
2020

21+
// typedef for mixed stateSize and commandSize types
22+
typedef Eigen::Matrix<precision, stateSize, commandSize> stateR_commandC_t; // stateSize x commandSize
23+
typedef Eigen::Matrix<precision, stateSize, commandSize>
24+
stateR_commandC_stateD_t[stateSize]; // stateSize x commandSize x stateSize
25+
typedef Eigen::Matrix<precision, stateSize, commandSize>
26+
stateR_commandC_commandD_t[commandSize]; // stateSize x commandSize x commandSize
27+
typedef Eigen::Matrix<precision, commandSize, stateSize> commandR_stateC_t; // commandSize x stateSize
28+
typedef Eigen::Matrix<precision, commandSize, stateSize>
29+
commandR_stateC_stateD_t[stateSize]; // commandSize x stateSize x stateSize
30+
typedef Eigen::Matrix<precision, commandSize, stateSize>
31+
commandR_stateC_commandD_t[commandSize]; // commandSize x stateSize x commandSize
32+
typedef Eigen::Matrix<precision, stateSize, stateSize>
33+
stateR_stateC_commandD_t[commandSize]; // stateSize x stateSize x commandSize
34+
typedef Eigen::Matrix<precision, commandSize, commandSize>
35+
commandR_commandC_stateD_t[stateSize]; // commandSize x commandSize x stateSize
2136

37+
public:
38+
private:
39+
protected:
40+
// attributes //
41+
public:
42+
private:
43+
protected:
44+
double dt;
45+
double final_cost;
46+
double running_cost;
47+
stateVec_t lx;
48+
stateMat_t lxx;
49+
commandVec_t lu;
50+
commandMat_t luu;
51+
commandR_stateC_t lux;
52+
stateR_commandC_t lxu;
53+
// methods //
54+
public:
55+
virtual void computeCostAndDeriv(const stateVec_t& X, const stateVec_t& Xdes, const commandVec_t& U) = 0;
56+
virtual void computeFinalCostAndDeriv(const stateVec_t& X, const stateVec_t& Xdes) = 0;
2257

23-
// typedef for mixed stateSize and commandSize types
24-
typedef Eigen::Matrix<precision,stateSize,commandSize> stateR_commandC_t; // stateSize x commandSize
25-
typedef Eigen::Matrix<precision,stateSize,commandSize> stateR_commandC_stateD_t[stateSize]; // stateSize x commandSize x stateSize
26-
typedef Eigen::Matrix<precision,stateSize,commandSize> stateR_commandC_commandD_t[commandSize]; // stateSize x commandSize x commandSize
27-
typedef Eigen::Matrix<precision,commandSize,stateSize> commandR_stateC_t; // commandSize x stateSize
28-
typedef Eigen::Matrix<precision,commandSize,stateSize> commandR_stateC_stateD_t[stateSize]; // commandSize x stateSize x stateSize
29-
typedef Eigen::Matrix<precision,commandSize,stateSize> commandR_stateC_commandD_t[commandSize]; // commandSize x stateSize x commandSize
30-
typedef Eigen::Matrix<precision,stateSize,stateSize> stateR_stateC_commandD_t[commandSize]; // stateSize x stateSize x commandSize
31-
typedef Eigen::Matrix<precision,commandSize,commandSize> commandR_commandC_stateD_t[stateSize]; // commandSize x commandSize x stateSize
32-
33-
public:
34-
private:
35-
protected:
36-
// attributes //
37-
public:
38-
private:
39-
40-
protected:
41-
double dt;
42-
double final_cost;
43-
double running_cost;
44-
stateVec_t lx;
45-
stateMat_t lxx;
46-
commandVec_t lu;
47-
commandMat_t luu;
48-
commandR_stateC_t lux;
49-
stateR_commandC_t lxu;
50-
// methods //
51-
public:
52-
virtual void computeCostAndDeriv(const stateVec_t& X,const stateVec_t& Xdes, const commandVec_t& U)=0;
53-
virtual void computeFinalCostAndDeriv(const stateVec_t& X,const stateVec_t& Xdes)=0;
54-
private:
55-
protected:
56-
// accessors //
57-
public:
58-
double& getRunningCost() { return running_cost;}
59-
double& getFinalCost() { return final_cost; }
60-
stateVec_t& getlx() {return lx;}
61-
stateMat_t& getlxx() {return lxx;}
62-
commandVec_t& getlu() {return lu;}
63-
commandMat_t& getluu() {return luu;}
64-
commandR_stateC_t& getlux() {return lux;}
65-
stateR_commandC_t& getlxu() {return lxu;}
58+
private:
59+
protected:
60+
// accessors //
61+
public:
62+
double& getRunningCost() { return running_cost; }
63+
double& getFinalCost() { return final_cost; }
64+
stateVec_t& getlx() { return lx; }
65+
stateMat_t& getlxx() { return lxx; }
66+
commandVec_t& getlu() { return lu; }
67+
commandMat_t& getluu() { return luu; }
68+
commandR_stateC_t& getlux() { return lux; }
69+
stateR_commandC_t& getlxu() { return lxu; }
6670
};
6771

68-
#endif // COSTFUNCTION_H
72+
#endif // COSTFUNCTION_H

0 commit comments

Comments
 (0)