Skip to content

Commit 8b6bcf7

Browse files
committed
[tmp] undo changes to predict & applyControlSequenceConstraints
1 parent d3eb7aa commit 8b6bcf7

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

‎nav2_mppi_controller/include/nav2_mppi_controller/motion_models.hpp‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,20 @@ class MotionModel
119119

120120
// constrain u_virt 0 & 1 to make sure accelerations are limited at the first step (state.vx(0) is from feedback)
121121
// also constrain u_virt_1 as this is published as command
122-
if (i <= 2)
123-
{
124-
state.cvx.col(i - 1) = state.vx.col(i);
125-
state.cwz.col(i - 1) = state.wz.col(i);
126-
}
122+
// if (i <= 2)
123+
// {
124+
// state.cvx.col(i - 1) = state.vx.col(i);
125+
// state.cwz.col(i - 1) = state.wz.col(i);
126+
// }
127127

128-
// also apply velocity limits constrains
129-
state.vx.col(i) = state.vx.col(i)
130-
.cwiseMax(control_constraints_.vx_min)
131-
.cwiseMin(control_constraints_.vx_max);
128+
// // also apply velocity limits constrains
129+
// state.vx.col(i) = state.vx.col(i)
130+
// .cwiseMax(control_constraints_.vx_min)
131+
// .cwiseMin(control_constraints_.vx_max);
132132

133-
state.wz.col(i) = state.wz.col(i)
134-
.cwiseMax(-control_constraints_.wz)
135-
.cwiseMin(control_constraints_.wz);
133+
// state.wz.col(i) = state.wz.col(i)
134+
// .cwiseMax(-control_constraints_.wz)
135+
// .cwiseMin(control_constraints_.wz);
136136

137137

138138
// also constrain wz base
@@ -148,13 +148,13 @@ class MotionModel
148148
.cwiseMax(lower_bound_vy)
149149
.cwiseMin(upper_bound_vy);
150150

151-
state.vy.col(i) = state.cvy.col(i - 1)
152-
.cwiseMax(-control_constraints_.vy)
153-
.cwiseMin(control_constraints_.vy);
151+
// state.vy.col(i) = state.cvy.col(i - 1)
152+
// .cwiseMax(-control_constraints_.vy)
153+
// .cwiseMin(control_constraints_.vy);
154154
}
155155
}
156156

157-
applyConstraints(state);
157+
// applyConstraints(state);
158158
}
159159

160160
/**

‎nav2_mppi_controller/src/optimizer.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,6 @@ void Optimizer::applyControlSequenceConstraints()
402402
// TODO 4 or ideally based on last published command
403403

404404
// at this point, control_sequence_ contains the softmax mean of state_.cu (u_virt)]
405-
/*
406405
float vx_last = utils::clamp(s.constraints.vx_min, s.constraints.vx_max, control_sequence_.vx(0));
407406
float wz_last = utils::clamp(-s.constraints.wz, s.constraints.wz, control_sequence_.wz(0));
408407

@@ -413,8 +412,8 @@ void Optimizer::applyControlSequenceConstraints()
413412
vy_last = utils::clamp(-s.constraints.vy, s.constraints.vy, control_sequence_.vy(0));
414413
control_sequence_.vy(0) = vy_last;
415414
}
416-
*/
417415

416+
/*
418417
// limit acceleration between current feedback speed and first control in the sequence
419418
float vx_last = static_cast<float>(state_.speed.linear.x);
420419
float wz_last = static_cast<float>(state_.speed.angular.z);
@@ -423,8 +422,9 @@ void Optimizer::applyControlSequenceConstraints()
423422
if (isHolonomic()) {
424423
vy_last = static_cast<float>(state_.speed.linear.y);
425424
}
425+
*/
426426

427-
for (unsigned int i = 0; i != control_sequence_.vx.size(); i++) {
427+
for (unsigned int i = 1; i != control_sequence_.vx.size(); i++) {
428428
float & vx_curr = control_sequence_.vx(i);
429429
vx_curr = utils::clamp(s.constraints.vx_min, s.constraints.vx_max, vx_curr);
430430
if(vx_last > 0) {

0 commit comments

Comments
 (0)