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

move_base cancelGoal doesn't work while executing recovery behavior #34

Open
corot opened this issue May 2, 2013 · 9 comments
Open

Comments

@corot
Copy link
Contributor

corot commented May 2, 2013

Not sure if this is bug... I posted as ros answer and someone suggested to open an issue. Looks like move_base action client's cancelGoal doesn't work while executing recovery behavior. That is, if I call cancelGoal or cancelAllGoals, the subsequent call to waitForResult doesn't return until all recovery fails. If I disable recovery behavior meanwhile with dynamic_reconfigure. doesn't returns until recovery fails (more than 2 minutes!). I suppose move_base gets somehow blocked when running recovery behavior and don't even attend reconfigure requests.

I'm using hydro-devel code, but I experienced the same with groovy package installation.

@jack-oquin
Copy link

@hershwg
Copy link
Contributor

hershwg commented May 2, 2013

Definitely a bug. The API will have to change to support this though. Currently the runBehavior call does its whole thing in one thread in the one function call, so there's no way to interrupt it.

I could give that function a return value ( boolean) which says whether it is done or not. Then the recovery behavior will need to have its loop opened up so it returns false after each cycle until it's done.

@jack-oquin
Copy link

Is there some way to hack it by setting a global boolean variable for the behavior to check periodically, returning if it's set?

@hershwg
Copy link
Contributor

hershwg commented May 2, 2013

Well, we could always hack it, but I would love to avoid that.

Options I'm seeing so far:

  • change RecoveryBehavior API so each RecoveryBehavior gets a pointer to a MoveBase object or a NodeHandle or even just a boolean that lets it query whether it has been cancelled.
  • change RecoveryBehavior API so runBehavior() returns a boolean indicating "done" or "not done" and the docs are updated to indicated that every call to runBehavior() should take only a short (sub-second) amount of time. This may mean opening loops and implementing state machines to break up long-running recovery behavior functions.
  • Leave the API the same, but run the RecoveryBehavior in a separate thread. When a pre-empt or cancel arrives and the behavior is still running, the thread gets killed. This "option" looks pretty dangerous and non-portable, based on my readings. On Windows you can get situations where the child thread is in the middle of allocating memory and it has a lock on that and then just dies, leaving the memory-allocation lock locked (!). Under Posix threads the situation is a bit better, but still pretty awkward.
  • It is true that we could make a global variable which move_base would write to and which recovery behaviors could read from if they wanted. This is just a backwards-compatible way to change the API.
  • API for RecoveryBehavior could have an added pair of functions: bool isCancelled() and setIsCancelledCallback( boost::function<...> ). Then MoveBase can call setIsCancelledCallback() on every recovery behavior at initialization, and recovery behavior implementers can add calls to isCancelled() at their leisure (when they run into this problem, most likely). This is another backwards-compatible way to change the API which does not involve a global variable. :)

So after typing all that out, my favorite is the last one.

@jack-oquin
Copy link

My naive opinion: your last option looks good.

@corot
Copy link
Contributor Author

corot commented May 6, 2013

Sorry, I'm not familiar with RecoveryBehavior API, so I cannot have an informed opinion.

When do you plan to attack this issue?

@Tutorgaming
Copy link

Hello from 2017, Is there any solution implemented or available to fix this issue?

@ccattywampus
Copy link

@Tutorgaming Hello from 2018! Did you ever find a way to work around this?

@Tutorgaming
Copy link

It seems that I disabled the original RecoveryBehavior and try to recover the robot outside the move_base. Everything works fine .

in the recovery behavior need to somehow connected to the move_base server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants