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

The getIsStancePhase logic on devel is broken #66

Closed
S-Dafarra opened this issue Aug 31, 2020 · 6 comments · Fixed by #68
Closed

The getIsStancePhase logic on devel is broken #66

S-Dafarra opened this issue Aug 31, 2020 · 6 comments · Fixed by #68
Assignees
Labels
bug Something isn't working

Comments

@S-Dafarra
Copy link
Collaborator

We noticed that while testing #65, the robot was not able to walk anymore. When substituting

m_walkingZMPController->setPhase(m_isStancePhase.front());
with

double threshold = 0.001;
bool stancePhase = iDynTree::toEigen(m_DCMVelocityDesired.front()).norm() < threshold;
m_walkingZMPController->setPhase(stancePhase);

we managed to restore the expected performances.
cc @GiulioRomualdi

@S-Dafarra
Copy link
Collaborator Author

S-Dafarra commented Aug 31, 2020

While looking at the code, the line

stancePhaseDelayCounter = stancePhaseDelayCounter == 0 ? 0 : stancePhaseDelayCounter--;
is suspicious.
The Clang static analyzer is showing the following warning:

TrajectoryGenerator.cpp:669: warning: multiple unsequenced modifications to 'stancePhaseDelayCounter'

Indeed, its behavior is probably undefined https://stackoverflow.com/questions/47507558/multiple-unsequenced-modifications-to-a-a-a.

This may be coherent with the fact that the robot seems to never exit the stance phase. A possible fix is

stancePhaseDelayCounter = stancePhaseDelayCounter == 0 ? 0 : stancePhaseDelayCounter - 1;

We may try this on the robot and check if it is working.

@S-Dafarra
Copy link
Collaborator Author

Unfortunately, the patch proposed in #66 (comment) does not fix the problem.

@GiulioRomualdi
Copy link
Member

GiulioRomualdi commented Sep 18, 2020

I've probably found the bug. m_isStancePhase is not advanced like the others. This means that we are always in the stance phase even if the robot is walking. I open a PR for fixing this. If @S-Dafarra and @prashanthr05 are going to test something on the robot I would give it a try.

@S-Dafarra
Copy link
Collaborator Author

I've probably found the bug. m_isStancePhase is not advanced like the others. This means that we are always in the stance phase even if the robot is walking. I open a PR for fixing this. If @S-Dafarra and @prashanthr05 are going to test something on the robot I would give it a try.

I can give it a try!

@GiulioRomualdi
Copy link
Member

That's the PR: #68

@GiulioRomualdi GiulioRomualdi linked a pull request Sep 18, 2020 that will close this issue
@GiulioRomualdi
Copy link
Member

#68 fixes the problem. We can close the issue

@GiulioRomualdi GiulioRomualdi added the bug Something isn't working label Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants