Skip to content

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

Merged
merged 4 commits into from
Dec 20, 2024

Conversation

edantec
Copy link
Collaborator

@edantec edantec commented Dec 19, 2024

No description provided.

mpc.solver
.workspace.problem_data.stage_data[1]
.dynamics_data.continuous_data.xdot[nv:]
)
Copy link
Member

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

Copy link
Member

@ManifoldFR ManifoldFR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just have a few comments

{
ExplicitIntegratorData * int_data =
dynamic_cast<ExplicitIntegratorData *>(&*solver_->workspace_.problem_data.stage_data[t]->dynamics_data);
return int_data->continuous_data->xdot_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please return ConstVectorRef to get a numpy view array in Python (that you can explicitly copy). This avoids doing copies when not needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add an assert() or other runtime check that int_data is not nullptr - which would be a cast error.

{
std::vector<bool> contact_state;
CentroidalFwdDynamics * ode =
problem_->stages_[t]->getDynamics<IntegratorEuler>()->getDynamics<CentroidalFwdDynamics>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here also add a runtime check that ode is not nullptr.

@edantec edantec merged commit 1997888 into main Dec 20, 2024
11 checks passed
@edantec edantec deleted the topic/get_contact_state branch December 20, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants