Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

初期化 #123

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/schneider_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,11 @@ inline void Schneider::cal_tjacob() {
void Schneider::cal_q() {
using std::pow;
// 初期値
const float coef = (x_d[0] >= 0 && x_d[1] >= 0) ? 1
: (x_d[0] >= 0 && x_d[1] < 0) ? -1
: (x_d[0] < 0 && x_d[1] >= 0) ? 3
: 5;
float coef;
coef = (x_d[0] >= 0 && x_d[1] >= 0) ? 1
: (x_d[0] >= 0 && x_d[1] < 0) ? -1
: (x_d[0] < 0 && x_d[1] >= 0) ? 3
: 5;
for (int i = 2; i < 4; ++i) {
q[i] = coef * schneider_PI / 4 - phi;
}
Expand All @@ -138,7 +139,8 @@ void Schneider::cal_q() {
for (int i = 0; i < trial_num; i++) {
state_equation();

double diff = pow(x[0] - x_d[0], 2) + pow(x[1] - x_d[1], 2) + pow(x[2] - x_d[2], 2);
double diff;
diff = pow(x[0] - x_d[0], 2) + pow(x[1] - x_d[1], 2) + pow(x[2] - x_d[2], 2);
if (diff < 1e-3) {
break;
}
Expand Down
Loading