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

PathController step/loiter doesn't run when DesiredPath is updated #142

Open
krisgry opened this issue Aug 29, 2018 · 2 comments
Open

PathController step/loiter doesn't run when DesiredPath is updated #142

krisgry opened this issue Aug 29, 2018 · 2 comments

Comments

@krisgry
Copy link
Contributor

krisgry commented Aug 29, 2018

Looking into PathController again: I realized that if you receive DesiredPath at the same frequency as m_cperiod, step/loiter will not be called at all.

In consume(desiredPath), m_ts.now = now

m_ts.start_time = now;
m_ts.end_time = -1;
m_ts.now = m_ts.start_time;

while consume(EstimatedState) returns before calling step/loiter if the time between "last run" and now is less than m_cperiod:
if (now < m_ts.now + m_cperiod)
return;

which causes step/loiter to not be run at all.

I discovered this while working with FollowReference, where I update the Reference at the same frequency as the PathController. This might be a "user problem", since I have little experience with FollowReference (so please correct me if I do something wrong :) ). From a control perspective, of course the inner loop should be faster than the outer loop, but I still think the inner loop should run :) Haven't tried, but I guess this also means that every time you receive a new path, step/loiter will be skipped. Is there a rationale behind this?

Thanks!

@krisgry
Copy link
Contributor Author

krisgry commented Sep 28, 2018

One thing I did not mention; when I increased the frequency of the PathControllers (so that it is faster than my update of IMC::Reference, and thereby DesiredPath), this problem is circumvented.

@krisgry
Copy link
Contributor Author

krisgry commented Feb 13, 2019

Our suspicions have been confirmed; when commenting out lines 658-658 above, this is no longer an issue. My suggestion is then to add some debug printout in the if, so that the user is warned. E.g. something like

if (now < m_ts.now + m_cperiod) 
   {
      debug("Not running step/loiter! Too little time since last run or arrival of new path");
      return;
   }

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

No branches or pull requests

1 participant