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

Check limb swing motion has been finished at the end of ConfigMotion if exitWhenLimbSwingFinished is true #10

Conversation

orikuma
Copy link
Contributor

@orikuma orikuma commented Oct 19, 2023

Problem:
ConfigMotionState::run() returns true when the commands stacked in managers become empty, but it does not consider the motion is executing or not. Therefore, the state can exit before the last swing motion has finished.

Solution:
I added exitWhenLimbSwingFinished option in configs for ConfigMotionState. If it is true, ConfigMotionState::run() returns false until all swing motions in LimbMangerSet have finished.

Copy link
Contributor

@gergondet gergondet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than keeping the existing behavior is there any real use to not waiting on the execution to finish? (afaik most use of this controller only have a single motion configured

Comment on lines 170 to 176
bool limbCofingsFinshed = !ctl().limbManagerSet_->contactCommandStacked();
if(exitWhenLimbSwingFinished_)
{
limbCofingsFinshed = limbCofingsFinshed && !ctl().limbManagerSet_->isExecutingLimbSwing();
}

return limbCofingsFinshed && taskConfigList_.empty() && collisionConfigList_.empty();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool limbCofingsFinshed = !ctl().limbManagerSet_->contactCommandStacked();
if(exitWhenLimbSwingFinished_)
{
limbCofingsFinshed = limbCofingsFinshed && !ctl().limbManagerSet_->isExecutingLimbSwing();
}
return limbCofingsFinshed && taskConfigList_.empty() && collisionConfigList_.empty();
return !ctl().limbManagerSet_->contactCommandStacked() && taskConfigList_.empty() && collisionConfigList_.empty() && (!exitWhenLimbSwingFinished_ || !ctl().limbManagerSet_->isExecutingLimbSwing());

(should look nicer after formatting)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for review. I refactored it.

@orikuma
Copy link
Contributor Author

orikuma commented Oct 23, 2023

Other than keeping the existing behavior is there any real use to not waiting on the execution to finish?

I put exitWhenLimbSwingFinished_ just for backward compatibility. Currently the motion is assumed to move one limb at once.

Copy link
Member

@mmurooka mmurooka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! Some small comments.

{
for(const auto & limbManagerKV : *this)
{
const auto & contactCommandList = limbManagerKV.second->contactCommandList();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 97b00df

@@ -89,6 +89,12 @@ void ConfigMotionState::start(mc_control::fsm::Controller & _ctl)
}
}

// Set option to wait for finishing swing motion
if(config_.has("configs") && config_("configs").has("exitWhenLimbSwingFinished"))
Copy link
Member

@mmurooka mmurooka Apr 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, you don't need to change it as I wrote in the following comment.

Same as https://github.com/isri-aist/MultiContactController/pull/7/files#r1560534133

orikuma added a commit to orikuma/MultiContactController that referenced this pull request Apr 12, 2024
@mmurooka mmurooka closed this in #16 Apr 13, 2024
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.

3 participants