Giter Site home page Giter Site logo

Comments (9)

jack-oquin avatar jack-oquin commented on May 21, 2024

Q&A page is here: http://answers.ros.org/question/61720/move_base-cannot-cancel-while-executing-recovery-behavior/

from navigation.

hershwg avatar hershwg commented on May 21, 2024

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.

from navigation.

jack-oquin avatar jack-oquin commented on May 21, 2024

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

from navigation.

hershwg avatar hershwg commented on May 21, 2024

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.

from navigation.

jack-oquin avatar jack-oquin commented on May 21, 2024

My naive opinion: your last option looks good.

from navigation.

corot avatar corot commented on May 21, 2024

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

When do you plan to attack this issue?

from navigation.

Tutorgaming avatar Tutorgaming commented on May 21, 2024

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

from navigation.

ccattywampus avatar ccattywampus commented on May 21, 2024

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

from navigation.

Tutorgaming avatar Tutorgaming commented on May 21, 2024

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

from navigation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.