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 gaitgenerator and fix bugs #918

Merged
merged 4 commits into from
Dec 19, 2015
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
3 changes: 2 additions & 1 deletion .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ case $TEST_PACKAGE in
# Print results of each rosunit-*.xml file
# Get rosunit*.xml file path from rostest-*.xml file by usig awk and cut.
# Files are assumed to include "xxx results are in [/home/xxx/rosunit-yy.xml]"
cat $(find ~/.ros/test_results -type f -iname "*`basename $test_file .test`.xml" -print -exec echo "=== {} ===" \; -exec cat {} \; | grep "results are in" | awk -F'results are in ' '{print $2}' | cut -d\[ -f2 | cut -d\] -f1)
rosunit_xml_result_files=$(find ~/.ros/test_results -type f -iname "*`basename $test_file .test`.xml" -print -exec echo "=== {} ===" \; -exec cat {} \; | grep "results are in" | awk -F'results are in ' '{print $2}' | cut -d\[ -f2 | cut -d\] -f1)
if [ "${rosunit_xml_result_files}" != "" ]; then cat ${rosunit_xml_result_files}; fi
travis_time_end 31
fi
done
Expand Down
19 changes: 10 additions & 9 deletions rtc/AutoBalancer/GaitGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ namespace rats
}
if (footstep_index < fnsl.size()) {
one_step_count = static_cast<size_t>(fnsl[footstep_index].front().step_time/dt);
thp_ptr->set_one_step_count(one_step_count);
}
if (footstep_index + 1 < fnsl.size()) {
next_one_step_count = static_cast<size_t>(fnsl[footstep_index+1].front().step_time/dt);
Expand Down Expand Up @@ -542,7 +543,15 @@ namespace rats
}
bool solved = preview_controller_ptr->update(refzmp, cog, swing_foot_zmp_offsets, rzmp, sfzos, (refzmp_exist_p || finalize_count < preview_controller_ptr->get_delay()-default_step_time/dt));
/* update refzmp */
if ( lcg.get_lcg_count() == static_cast<size_t>(footstep_nodes_list[lcg.get_footstep_index()][0].step_time/dt * 0.5) - 1 ) { // Almost middle of step time
if (emergency_flg == EMERGENCY_STOP && lcg.get_footstep_index() > 0) {
leg_type cur_leg = footstep_nodes_list[lcg.get_footstep_index()].front().l_r;
overwrite_footstep_nodes_list.push_back(boost::assign::list_of(step_node(cur_leg==RLEG?LLEG:RLEG, footstep_nodes_list[lcg.get_footstep_index()-1].front().worldcoords, 0, default_step_time, 0, 0)));
overwrite_footstep_nodes_list.push_back(boost::assign::list_of(step_node(cur_leg, footstep_nodes_list[lcg.get_footstep_index()].front().worldcoords, 0, default_step_time, 0, 0)));
overwrite_footstep_nodes_list.push_back(boost::assign::list_of(step_node(cur_leg==RLEG?LLEG:RLEG, footstep_nodes_list[lcg.get_footstep_index()-1].front().worldcoords, 0, default_step_time, 0, 0)));
overwrite_refzmp_queue(overwrite_footstep_nodes_list);
overwrite_footstep_nodes_list.clear();
emergency_flg = STOPPING;
} else if ( lcg.get_lcg_count() == get_overwrite_check_timing() ) {
if (velocity_mode_flg != VEL_IDLING && lcg.get_footstep_index() > 0) {
/* Currently biped only */
std::vector< std::vector<coordinates> > cv;
Expand All @@ -565,14 +574,6 @@ namespace rats
get_overwritable_index() == overwrite_footstep_index ) {
overwrite_refzmp_queue(overwrite_footstep_nodes_list);
overwrite_footstep_nodes_list.clear();
} else if (emergency_flg == EMERGENCY_STOP && lcg.get_footstep_index() > 0) {
leg_type cur_leg = footstep_nodes_list[lcg.get_footstep_index()].front().l_r;
overwrite_footstep_nodes_list.push_back(boost::assign::list_of(step_node(cur_leg==RLEG?LLEG:RLEG, footstep_nodes_list[lcg.get_footstep_index()-1].front().worldcoords, 0, default_step_time, 0, 0)));
overwrite_footstep_nodes_list.push_back(boost::assign::list_of(step_node(cur_leg, footstep_nodes_list[lcg.get_footstep_index()].front().worldcoords, 0, default_step_time, 0, 0)));
overwrite_footstep_nodes_list.push_back(boost::assign::list_of(step_node(cur_leg==RLEG?LLEG:RLEG, footstep_nodes_list[lcg.get_footstep_index()-1].front().worldcoords, 0, default_step_time, 0, 0)));
overwrite_refzmp_queue(overwrite_footstep_nodes_list);
overwrite_footstep_nodes_list.clear();
emergency_flg = STOPPING;
}
}
rg.update_refzmp(footstep_nodes_list);
Expand Down
1 change: 1 addition & 0 deletions rtc/AutoBalancer/GaitGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,7 @@ namespace rats
const std::map<leg_type, std::string> get_leg_type_map () const { return leg_type_map; };
size_t get_optional_go_pos_finalize_footstep_num () const { return optional_go_pos_finalize_footstep_num; };
bool is_finalizing (const double tm) const { return ((preview_controller_ptr->get_delay()*2 - default_step_time/dt)-finalize_count) <= (tm/dt)-1; };
size_t get_overwrite_check_timing () const { return static_cast<size_t>(footstep_nodes_list[lcg.get_footstep_index()][0].step_time/dt * 0.5) - 1;}; // Almost middle of step time
void print_param (const std::string& print_str = "")
{
double stride_fwd_x, stride_y, stride_th, stride_bwd_x;
Expand Down