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

Update st transition bugs #1102

Merged
merged 2 commits into from
Mar 6, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
[rtc/Stabilizer/Stabilizer.cpp] Reset prev_ref_cog for transition (MO…
…DE_IDLE=>MODE_ST) because the coordinates for ref_cog differs among st algorithms.
  • Loading branch information
snozawa committed Mar 6, 2017
commit 22ac61a1d1ebd76bc92b4c4f643bfa5931b8a8db
12 changes: 9 additions & 3 deletions rtc/Stabilizer/Stabilizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ void Stabilizer::getTargetParameters ()
if ( transition_count == 0 ) {
transition_smooth_gain = 1.0;
} else {
double max_transition_count = transition_time / dt;
double max_transition_count = calcMaxTransitionCount();
transition_smooth_gain = 1/(1+exp(-9.19*(((max_transition_count - std::fabs(transition_count)) / max_transition_count) - 0.5)));
}
if (transition_count > 0) {
Expand Down Expand Up @@ -1153,6 +1153,12 @@ void Stabilizer::getTargetParameters ()
}
// <= Reference world frame

// Reset prev_ref_cog for transition (MODE_IDLE=>MODE_ST) because the coordinates for ref_cog differs among st algorithms.
if (transition_count == (-1 * calcMaxTransitionCount() + 1)) { // max transition count. In MODE_IDLE => MODE_ST, transition_count is < 0 and upcounter. "+ 1" is upcount at the beginning of this function.
prev_ref_cog = ref_cog;
std::cerr << "[" << m_profile.instance_name << "] Reset prev_ref_cog for transition (MODE_IDLE=>MODE_ST)." << std::endl;
}

if (st_algorithm != OpenHRP::StabilizerService::TPCC) {
// Reference foot_origin frame =>
hrp::Vector3 foot_origin_pos;
Expand Down Expand Up @@ -1711,7 +1717,7 @@ void Stabilizer::sync_2_st ()
ikp.d_foot_pos = ikp.d_foot_rpy = ikp.ee_d_foot_rpy = hrp::Vector3::Zero();
}
if (on_ground) {
transition_count = -1 * transition_time / dt;
transition_count = -1 * calcMaxTransitionCount();
control_mode = MODE_ST;
} else {
transition_count = 0;
Expand All @@ -1723,7 +1729,7 @@ void Stabilizer::sync_2_idle ()
{
std::cerr << "[" << m_profile.instance_name << "] [" << m_qRef.tm
<< "] Sync ST => IDLE" << std::endl;
transition_count = transition_time / dt;
transition_count = calcMaxTransitionCount();
for (int i = 0; i < m_robot->numJoints(); i++ ) {
transition_joint_q[i] = m_robot->joint(i)->q;
}
Expand Down
4 changes: 4 additions & 0 deletions rtc/Stabilizer/Stabilizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ class Stabilizer
{
return (prev_act_force_z[idx] > 25.0);
};
inline int calcMaxTransitionCount ()
{
return (transition_time / dt);
};

protected:
// Configuration variable declaration
Expand Down