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

[rtc/AutoBalancer/GaitGenerator.h] set initial state to modify bug of leg coords generator at walk with no double support phase #1157

Merged
merged 1 commit into from
Jun 20, 2017

Conversation

Tnoriaki
Copy link
Contributor

get_trajectory_point関数を使う脚軌道の時に両脚支持期を0にすると脚軌道の最初のpos等がsetされず値が飛ぶbugがあり,それを直すPRです.

@snozawa
Copy link
Contributor

snozawa commented Jun 19, 2017

別途if文を追加するというよりは、今あるif文で条件をかえて対応できればと思ってます。

ところでこれは

diff --git a/rtc/AutoBalancer/GaitGenerator.h b/rtc/AutoBalancer/GaitGenerator.h                                                                                                             
index 00c9c8a..59afe1c 100644                                                                                                                                                                
--- a/rtc/AutoBalancer/GaitGenerator.h                                                                                                                                                       
+++ b/rtc/AutoBalancer/GaitGenerator.h                                                                                                                                                       
@@ -443,7 +443,7 @@ namespace rats
       };                                                                                                                                                                                    
       void get_trajectory_point (hrp::Vector3& ret, const hrp::Vector3& start, const hrp::Vector3& goal, const double height)                                                               
       {                                                                                                                                                                                     
-        if ( double_support_count_before <= current_count && current_count < one_step_count - double_support_count_after ) { // swing phase                                                 
+        if ( double_support_count_before < current_count && current_count < one_step_count - double_support_count_after ) { // swing phase                                                  
           size_t swing_remain_count = one_step_count - current_count - double_support_count_after;                                                                                          
           size_t swing_one_step_count = one_step_count - double_support_count_before - double_support_count_after;                                                                          
           double final_path_distance_ratio = calc_antecedent_path(start, goal, height);                                                                                                     
@@ -470,7 +470,7 @@ namespace rats
           } else {                                                                                                                                                                          
             pos(2) = goal(2);                                                                                                                                                               
           }                                                                                                                                                                                 
-        } else if ( current_count < double_support_count_before ) { // first double support phase                                                                                           
+        } else if ( current_count <= double_support_count_before ) { // first double support phase                                                                                          
           pos = start;                                                                                                                                                                      
           vel = hrp::Vector3::Zero();                                                                                                                                                       
           acc = hrp::Vector3::Zero();       

みたいに、beforeのほうのswing期の境界がどっちに含まれるかをかえるのでも治ったりするのかな。
これで問題ないか(両脚0でとぶバグがなおる+今までの使い方でも問題ない)を確認してもらえるとたすかります。
(もしかしたら1カウント分、ゆう脚期がすくなくなってしまう?)

@Tnoriaki
Copy link
Contributor Author

@snozawaさん
if文を変えるだけでも治りますが,1カウント分遊脚期間が少なくなるのでif文を付け足しました.
ただ1カウント分だけですし,コードが読みにくくなるのでif文の条件を変えるようにします.

@snozawa
Copy link
Contributor

snozawa commented Jun 19, 2017

if文を変えるだけでも治りますが,1カウント分遊脚期間が少なくなるのでif文を付け足しました.

やはり1カウント文短くなるんだね。
@kyawawa , @YutaKojio, @Tnoriaki
的に問題ないのかな?

ただ1カウント分だけですし,コードが読みにくくなるのでif文の条件を変えるようにします.

もともとのPRはif文追加だったので、似たようなif文が2こでてしまうのと、
current_count==0な状況では、新たに追加したif文ともとからあるif文のうちの

        } else if ( current_count < double_support_count_before ) { // first double support phase                                                                                           

の2箇所にヒットしてしまうので、まとめられればと思いました。
まとめかたは
#1157 (comment)
がぱっと思いついたのでかいてみましたが、1カウント少なくなるのは問題かなあと思います。
他には、double_support_count_beforeが0かどうかをチェックするという方法もありそうかな。

@kyawawa
Copy link
Contributor

kyawawa commented Jun 19, 2017

1カウント少なくするこの方法だと
https://github.com/fkanehiro/hrpsys-base/pull/1157/files#diff-c0c1106962689a7d535262184ade16dbR448
ここも変更する必要があるかと思います.

if-elseのまとまりが増えますが,

else if ( current_count <= double_support_count_before )

の部分をまとめて一番上に持っていく方法もありそうです

@YutaKojio
Copy link
Contributor

1制御周期なので1カウント少なくなるのは実用上問題ないと思いますが,
1カウント少なくならないほうが意図した挙動なのでできるなら減らないほうがいい気がします.

@Tnoriaki
Copy link
Contributor Author

@kyawawa, @YutaKojio さんの意見を参考に
1カウント少なくならないようにしてみましたがどうでしょうか

@snozawa
Copy link
Contributor

snozawa commented Jun 19, 2017

@Tnoriaki
内容確認しました。
travisが通ってないのでrestartするという意味もこめて、
追加でコミットが3つになってるところを1個にまとめて(コミットメッセージは元の内容と個々での議論の内容がいいかんじではいるようにしてもらうと良いかも)
git push -fしてもらえますでしょうか。

…phase and last double support phase to modify bug of no double support walk without reducing swing count.
@Tnoriaki
Copy link
Contributor Author

commitを一つにしてpushし,travisも通りました.

@snozawa
Copy link
Contributor

snozawa commented Jun 20, 2017

@Tnoriaki
LGTM、ありがとう

@fkanehiro さん
お手すきの時で構いませんのでご確認いただけますと幸いです。

@fkanehiro fkanehiro merged commit e41ddbb into fkanehiro:master Jun 20, 2017
@snozawa
Copy link
Contributor

snozawa commented Jun 20, 2017

ありがとうございます。

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.

5 participants