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

Call reset before initializing the task #644

Open
wants to merge 1 commit into
base: ros2
Choose a base branch
from

Conversation

pac48
Copy link
Contributor

@pac48 pac48 commented Jan 7, 2025

@henrygerardmoore @rhaschke I have been investigating this issue where calling plan() on the same task more than once can lead to a segfault. The is some internal state the task that is modified during planning, which causes subsequent planning to fail. For example, the states_ field of StagePrivate contained some values from the last run on the subsequent run. My solution is to call the reset() method on the MTC Task object before calling init() and planning. This fixed the segfault we were seeing and also generated valid plans.

Let me know if this is a suitable solution or if there is another recommended way to avoid stale task objects causing failures.

@pac48
Copy link
Contributor Author

pac48 commented Jan 7, 2025

Looks like CI failed due to a segfault caused by this change

moveit::task_constructor::InterfaceState::Priority::operator<(moveit::task_constructor::InterfaceState::Priority const&) const
    Segmentation fault (Address not mapped to object [0xed])

@rhaschke
Copy link
Contributor

rhaschke commented Jan 7, 2025

In principle, it should be possible to (re)run plan() without resetting beforehand - for example to continue planning when a previous run prematurely stopped, e.g. due to a timeout. If that's not working for you, I would like to see a minimal example reproducing this.

Unfortunately, your PR revealed another issue: calling reset() before plan() should be possible as well - namely, if you want to plan from scratch instead of continuing.

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