Skip to content

Commit

Permalink
[rtc/AutoBalancer/GaitGenerator] Fix invalid access for step_count_li…
Browse files Browse the repository at this point in the history
  • Loading branch information
snozawa committed Jun 19, 2017
1 parent 5e22e9a commit f4a38b5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rtc/AutoBalancer/GaitGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,13 @@ namespace rats
refzmp_count--;
} else {
refzmp_index++;
refzmp_count = one_step_count = step_count_list[refzmp_index];
thp.set_one_step_count(one_step_count);
// Check length of step_count_list and refzmp_index
// The case if !(refzmp_index <= step_count_list.size()-1) is finalizing of gait_generator.
// If finalizing, this can be neglected.
if (refzmp_index <= step_count_list.size()-1) {
refzmp_count = one_step_count = step_count_list[refzmp_index];
thp.set_one_step_count(one_step_count);
}
//std::cerr << "fs " << fs_index << "/" << fnl.size() << " rf " << refzmp_index << "/" << refzmp_cur_list.size() << " flg " << std::endl;
}
};
Expand Down

0 comments on commit f4a38b5

Please sign in to comment.