Skip to content

Commit 03ad6c7

Browse files
hcw mpc simulations (#72)
1 parent 1d9c72f commit 03ad6c7

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

examples/mpc_hcw.cpp

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ int main() {
5353
x_ref << 0.0, 0.0, 0.0, 0.0, 0.0, 0.0;
5454

5555
// Input constraints
56-
double u_max = 0.8; // for each dimension
57-
double u_min = -0.8; // for each dimension
56+
double u_max = 1.0; // for each dimension
57+
double u_min = -1.0; // for each dimension
5858

5959
// Cost weighting
6060
Eigen::MatrixXd Q = Eigen::MatrixXd::Zero(6,6);
6161
{
62-
Q(0,0) = 1e+0; Q(1,1) = 1e+0; Q(2,2) = 1e+0;
63-
Q(3,3) = 1e-1; Q(4,4) = 1e-1; Q(5,5) = 1e-1;
62+
Q(0,0) = 1e+1; Q(1,1) = 1e+1; Q(2,2) = 1e+1;
63+
Q(3,3) = 1e-0; Q(4,4) = 1e-0; Q(5,5) = 1e-0;
6464
}
6565

6666
Eigen::MatrixXd R = Eigen::MatrixXd::Zero(3,3);
@@ -107,6 +107,33 @@ int main() {
107107
{100.0,-75.0/sqrt3, 0, 0, 0, 0}
108108
};
109109

110+
// std::vector<std::vector<double>> ics_data = {
111+
// {25.0/sqrt3, 25.0, 0, 0, 0, 0},
112+
// {0, 25.0, 0, 0, 0, 0},
113+
// {-25.0/sqrt3, 25.0, 0, 0, 0, 0},
114+
// {50.0/sqrt3, 50.0, 0, 0, 0, 0},
115+
// {0, 50.0, 0, 0, 0, 0},
116+
// {-50.0/sqrt3, 50.0, 0, 0, 0, 0},
117+
// {75.0/sqrt3, 75.0, 0, 0, 0, 0},
118+
// {0, 75.0, 0, 0, 0, 0},
119+
// {-75.0/sqrt3, 75.0, 0, 0, 0, 0},
120+
// {100.0/sqrt3, 100.0, 0, 0, 0, 0},
121+
// {0, 100.0, 0, 0, 0, 0},
122+
// {-100.0/sqrt3,100.0, 0, 0, 0, 0},
123+
// {25.0/sqrt3, 75.0, 0, 0, 0, 0},
124+
// {-25.0/sqrt3, 75.0, 0, 0, 0, 0},
125+
// {25.0/sqrt3, 100.0, 0, 0, 0, 0},
126+
// {-25.0/sqrt3, 100.0, 0, 0, 0, 0},
127+
// {50.0/sqrt3, 75.0, 0, 0, 0, 0},
128+
// {-50.0/sqrt3, 75.0, 0, 0, 0, 0},
129+
// {50.0/sqrt3, 100.0, 0, 0, 0, 0},
130+
// {-50.0/sqrt3, 100.0, 0, 0, 0, 0},
131+
// {75.0/sqrt3, 75.0, 0, 0, 0, 0},
132+
// {-75.0/sqrt3, 75.0, 0, 0, 0, 0},
133+
// {75.0/sqrt3, 100.0, 0, 0, 0, 0},
134+
// {-75.0/sqrt3, 100.0, 0, 0, 0, 0}
135+
// };
136+
110137
for (auto &data : ics_data) {
111138
Eigen::VectorXd x0(6);
112139
x0 << data[0], data[1], data[2], data[3], data[4], data[5];
@@ -286,14 +313,17 @@ int main() {
286313
// axis limit
287314
plt::xlim(-10, 110);
288315
plt::ylim(-100, 100);
316+
317+
// plt::xlim(-100, 100);
318+
// plt::ylim(-10, 110);
289319
plt::grid(true);
290320

291321
// Create results directory
292322
const std::string plotDirectory = "../results/simulations";
293323
if (!fs::exists(plotDirectory)) {
294324
fs::create_directories(plotDirectory);
295325
}
296-
std::string figPath = plotDirectory + "/hcw_mpc_cddp_trajectories.png";
326+
std::string figPath = plotDirectory + "/hcw_mpc_cddp_xaxis_trajectories.png";
297327
plt::save(figPath);
298328
// plt::show();
299329
}
-7.66 KB
Loading
Loading
Loading

0 commit comments

Comments
 (0)