Skip to content

Commit d24790b

Browse files
committed
switch to jump
1 parent f532fb5 commit d24790b

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

include/simple-mpc/mpc.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ namespace simple_mpc
185185

186186
void switchToStand();
187187

188+
void switchToJump();
189+
188190
// Footstep timings for each end effector
189191
std::map<std::string, std::vector<int>> foot_takeoff_times_, foot_land_times_;
190192
std::size_t one_horizon_iterator_;

src/mpc.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ namespace simple_mpc
275275

276276
void MPC::recedeWithCycle()
277277
{
278-
if (now_ == MOTION)
278+
if (now_ == MOTION or one_horizon_iterator_ > 0)
279279
{
280280
ocp_handler_->getProblem().replaceStageCircular(*one_horizon_[0]);
281281
solver_->cycleProblem(ocp_handler_->getProblem(), one_horizon_data_[0]);
@@ -290,7 +290,9 @@ namespace simple_mpc
290290
now_ = STANDING;
291291
}
292292
}
293-
if (now_ == WALKING or ocp_handler_->getContactSupport(ocp_handler_->getSize() - 1) < ee_names_.size())
293+
if (
294+
now_ == WALKING
295+
or (now_ == STANDING and ocp_handler_->getContactSupport(ocp_handler_->getSize() - 1) < ee_names_.size()))
294296
{
295297

296298
ocp_handler_->getProblem().replaceStageCircular(*cycle_horizon_[0]);
@@ -462,4 +464,10 @@ namespace simple_mpc
462464
velocity_base_.setZero();
463465
}
464466

467+
void MPC::switchToJump()
468+
{
469+
now_ = MOTION;
470+
velocity_base_.setZero();
471+
}
472+
465473
} // namespace simple_mpc

0 commit comments

Comments
 (0)