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

Add PostureManager #7

Closed
wants to merge 14 commits into from
Closed

Conversation

orikuma
Copy link
Contributor

@orikuma orikuma commented Sep 25, 2023

Problem:
When I want to play multi-contact motion planned by a multi-contact motion planner, resulting motion of MultiContactController is different from the planned motion because the reference joint angle is always the same in QP solved in MultiContactController.

Solution:
To specify target postures in multi-contact locomotion, I added PostureManager.
It loads target postures from nominalPostureList in MultiContactController.yaml and set them to PostureTask in QP according to the specified time.
The entry in the yaml file should be as follows.

  MCC::ConfigMotion_:
    base: MCC::ConfigMotion
    configs:
      baseTime: Relative
      nominalPostureList:
        - time: 0.4
          target:
            JOINT0: [0.05]
            JOINT1: [0.01]

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! Sorry for the detailed (and in some cases personal preference) remarks.

/** \brief Remove entries from the logger. */
virtual void removeFromLogger(mc_rtc::Logger & logger);

/** \brief Append a nominal centroidal pose
Copy link
Member

Choose a reason for hiding this comment

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

Comment is not valid.

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 3e96498

/** \brief Append a nominal centroidal pose
\param t time
\param PostureMap map from joint names to joint angle
\return whether nominalCentroidalPose is appended
Copy link
Member

Choose a reason for hiding this comment

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

Comment is not valid.

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 3e96498


This method should be called once when controller is reset.
*/
virtual void reset(const PostureManager::PostureMap & initialPosture);
Copy link
Member

Choose a reason for hiding this comment

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

initialPosture = {}とデフォルト値を指定して,引数無しのresetメソッドは消去することってできるんでしたでしょうか?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

確かにデフォルト値の指定ができたので 3e96498 で修正しました

void PostureManager::update()
{
// Set data
PostureManager::PostureMap ref = getNominalPosture(ctl().t());
Copy link
Member

Choose a reason for hiding this comment

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

Is PostureManager:: necessary for PostureMap here?

ref -> nominalPosture

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 3e96498

PostureManager::PostureMap PostureManager::getNominalPosture(double t) const
{
// if nominalPostureList_ is empty or specified past time, return empty map
PostureManager::PostureMap postures;
Copy link
Member

Choose a reason for hiding this comment

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

postures -> nominalPosture

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 3e96498

return postures;
}

bool PostureManager::appendNominalPosture(double t, const PostureManager::PostureMap & postures)
Copy link
Member

Choose a reason for hiding this comment

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

postures -> nominalPosture (same for header)

Copy link
Contributor Author

@orikuma orikuma Apr 12, 2024

Choose a reason for hiding this comment

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

Fixed in 3e96498

{
time += baseTime;
}
PostureManager::PostureMap refPosture = nominalPostureConfig("target");
Copy link
Member

Choose a reason for hiding this comment

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

refPosture -> nominalPosture

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 3e96498

if(config_.has("configs") && config_("configs").has("nominalPosture"))
{
mc_rtc::Configuration nominalPostureConfig = config_("configs")("nominalPosture");
PostureManager::PostureMap initPosture = nominalPostureConfig("target");
Copy link
Member

Choose a reason for hiding this comment

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

initPosture -> initialPosture

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 3e96498


/** \brief Append a nominal centroidal pose
\param t time
\param PostureMap map from joint names to joint angle
Copy link
Member

Choose a reason for hiding this comment

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

Please write [rad] or [deg]

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 3e96498


PostureManager::PostureMap PostureManager::getNominalPosture(double t) const
{
// if nominalPostureList_ is empty or specified past time, return empty map
Copy link
Member

Choose a reason for hiding this comment

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

if -> If

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 3e96498

*/
virtual void stop();

// TODO: implement GUI functions
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.

以下のように現在指定している関節数がGUIで表示できたら良いかと思いますがいかがでしょうか.

Number of specified joints: 6

Copy link
Contributor Author

Choose a reason for hiding this comment

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

21e4efa でRvizに現在nominalPostureとして指定されている関節数を表示するようにしました

orikuma added a commit to orikuma/MultiContactController that referenced this pull request Apr 11, 2024
@@ -89,6 +105,11 @@ void ConfigMotionState::start(mc_control::fsm::Controller & _ctl)
}
}

if(config_.has("configs") && config_("configs").has("exitWhenPostureManagerFinished"))
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, but after reading the following page, I thought that the original expression was safer and needless to change, since it allowed us to check corectness of the type.
https://jrl-umi3218.github.io/mc_rtc/tutorials/usage/mc_rtc_configuration.html

Could this be replaced by the following?

if(config_.has("configs"))
{
    config_("configs")("exitWhenPostureManagerFinished", exitWhenPostureManagerFinished_);
}

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