-
Notifications
You must be signed in to change notification settings - Fork 6
Add getters for contact vector and state derivative #31
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,10 @@ | |
| /////////////////////////////////////////////////////////////////////////////// | ||
| #pragma once | ||
|
|
||
| #include <aligator/core/stage-data.hpp> | ||
| #include <aligator/fwd.hpp> | ||
| #include <aligator/modelling/dynamics/fwd.hpp> | ||
| #include <aligator/modelling/dynamics/integrator-explicit.hpp> | ||
| #include <aligator/solvers/proxddp/solver-proxddp.hpp> | ||
|
|
||
| #include "simple-mpc/deprecated.hpp" | ||
|
|
@@ -17,6 +21,7 @@ | |
|
|
||
| namespace simple_mpc | ||
| { | ||
| using ExplicitIntegratorData = dynamics::ExplicitIntegratorDataTpl<double>; | ||
|
|
||
| struct MPCSettings | ||
| { | ||
|
|
@@ -171,6 +176,13 @@ namespace simple_mpc | |
| } | ||
| } | ||
|
|
||
| const Eigen::VectorXd getStateDerivative(const std::size_t t) | ||
| { | ||
| ExplicitIntegratorData * int_data = | ||
| dynamic_cast<ExplicitIntegratorData *>(&*solver_->workspace_.problem_data.stage_data[t]->dynamics_data); | ||
| return int_data->continuous_data->xdot_; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please return
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also add an |
||
| } | ||
|
|
||
| void switchToWalk(const Vector6d & velocity_base); | ||
|
|
||
| void switchToStand(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -278,6 +278,18 @@ namespace simple_mpc | |
| return active_contacts; | ||
| } | ||
|
|
||
| std::vector<bool> CentroidalOCP::getContactState(const std::size_t t) | ||
| { | ||
| std::vector<bool> contact_state; | ||
| CentroidalFwdDynamics * ode = | ||
| problem_->stages_[t]->getDynamics<IntegratorEuler>()->getDynamics<CentroidalFwdDynamics>(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here also add a runtime check that |
||
|
|
||
| for (auto name : model_handler_.getFeetNames()) | ||
| contact_state.push_back(ode->contact_map_.getContactState(name)); | ||
|
|
||
| return contact_state; | ||
| } | ||
|
|
||
| CostStack CentroidalOCP::createTerminalCost() | ||
| { | ||
| auto ter_space = VectorSpace(nx_); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh my god it was so long