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

[contact switching] Added setPrimaryFoot method and switch with contact makes #411

Merged
merged 3 commits into from
Feb 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ namespace iDynTree
* @param pattern switching pattern
*/
void setContactSwitchingPattern(SwitchingPattern pattern) { m_pattern = pattern; }

/**
* set primary foot
* This method was mainly intended to be called by an external process
* to set the primary foot in the initial setting, before any contact is broken.
* In case it is set to UNKNOWN_FOOT, it waits for the foot normal force measurements (checks left first and then right),
* and activates corresponding foot, handled in the detectTransitions() method.
* @param foot primary foot
*/
void setPrimaryFoot(contactFoot foot) { m_primaryFoot = foot; }

// unique pointer to contact state machine for left foot
std::unique_ptr<ContactStateMachine> m_leftFootContactClassifier;
Expand Down
8 changes: 3 additions & 5 deletions src/estimation/src/BipedFootContactClassifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace iDynTree
{

BipedFootContactClassifier::BipedFootContactClassifier(const SchmittParams& leftFootSchmittParams,
const SchmittParams& rightFootSchmittParams) : m_primaryFoot(LEFT_FOOT),
const SchmittParams& rightFootSchmittParams) : m_primaryFoot(RIGHT_FOOT),
m_leftFootContactState(true),
m_rightFootContactState(true),
m_pattern(ALTERNATE_CONTACT)
Expand Down Expand Up @@ -35,8 +35,7 @@ void BipedFootContactClassifier::detectFeetTransition()
case SwitchingPattern::ALTERNATE_CONTACT:
if (m_primaryFoot == LEFT_FOOT)
{
if ((leftFootTransition == ContactStateMachine::CONTACT_BREAK && rightFootTransition == ContactStateMachine::CONTACT_MAKE)
|| (leftFootTransition == ContactStateMachine::CONTACT_BREAK && rightFootTransition == ContactStateMachine::STABLE_ONCONTACT))
if ( rightFootTransition == ContactStateMachine::CONTACT_MAKE && m_leftFootContactState == true)
{
m_primaryFoot = RIGHT_FOOT;
}
Expand All @@ -55,8 +54,7 @@ void BipedFootContactClassifier::detectFeetTransition()
}
else if (m_primaryFoot == RIGHT_FOOT)
{
if ((rightFootTransition == ContactStateMachine::CONTACT_BREAK && leftFootTransition == ContactStateMachine::CONTACT_MAKE)
|| (rightFootTransition == ContactStateMachine::CONTACT_BREAK && leftFootTransition == ContactStateMachine::STABLE_ONCONTACT))
if ( leftFootTransition == ContactStateMachine::CONTACT_MAKE && m_rightFootContactState == true)
{
m_primaryFoot = LEFT_FOOT;
}
Expand Down