Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Feature/add path avoidance #12

Merged
merged 16 commits into from Aug 13, 2019
Merged

Feature/add path avoidance #12

merged 16 commits into from Aug 13, 2019

Conversation

uchikun2493
Copy link
Contributor

game.pyの中で,アクション実行後(pathが生成されたcontrol_target)にpath_avoidを使うことで中間パスを生成してcontrol_target.pathに追加してくれるようにした

@uchikun2493 uchikun2493 changed the base branch from master to game August 12, 2019 08:16
@ShotaAk
Copy link
Contributor

ShotaAk commented Aug 13, 2019

# ロボットが検出できている場合
if info.detected:

ロボットの存在判定にはdetected is Trueではなく、disappeared is Falseを使ってください。

detectedはノイズやデータ欠落で頻繁にFalseになります。

@ShotaAk
Copy link
Contributor

ShotaAk commented Aug 13, 2019

後の調整を考え、これらはメンバ変数(self._{SOMETHING})にしてください。

# 検出の幅
threshold_tr_y = 0.4
margin_tr_x = 0.2

# 一番近い敵ロボットの座標
tr_robot_pose = trans.transform(robot_pose)
tr_robot_pose.x += 0.2
tr_robot_pose.y -= 0.5

@ShotaAk
Copy link
Contributor

ShotaAk commented Aug 13, 2019

ここはfloat値同士が等しいかどうかチェックしているので修正してください。

# 敵と味方それぞれどちらが近い障害物か比較して近い方を優先する
if min_dist_our == min_dist_their:
avoid_pose = None

やりたいことは、障害物がないときは回避位置を生成しない、だと思うので

dist_our, obst_dist_our, obst_id_our = self.detect_dist_and_id(
trans, my_pose, goal_pose, self._robot_info['our'])
dist_their, obst_dist_their, obst_id_their = self.detect_dist_and_id(
trans, my_pose, goal_pose, self._robot_info['their'])
# 進路上の障害物から避ける経路を生成

detect_dist_and_id()の後に

if len(obst_id_our) == 0 and len(obst_id_their) == 0:
    avoid_pose = None
else:
    # avoid_poseの計算

return avoid_pose

とするのはどうでしょうか?

@uchikun2493
Copy link
Contributor Author

コメント反映してコミットしました

ちなみに変数名が
threshold_tr_y = 0.4 → self._range_tr_y = 0.4
margin_tr_x = 0.2 → self._range_tr_x = 0.2

tr_robot_pose.x += 0.2
tr_robot_pose.y -= 0.5
の加算する値を
self._tr_move_x = 0.2
self._tr_move_y = 0.5
としてinitに追加しました

def __init__(self):

        # ボール情報の初期化
        self._ball_info = BallInfo()
        # ロボット情報の初期化
        self._robot_info = RobotInfo()

        # 検出の幅
        self._range_tr_y = 0.4
        self._range_tr_x = 0.2

        # 経路生成時の相対的に移動する位置(ロボットから見た座標系)
        self._tr_move_x = 0.2
        self._tr_move_y = 0.5

@ShotaAk
Copy link
Contributor

ShotaAk commented Aug 13, 2019

良いと思います。マージします。

@ShotaAk ShotaAk merged commit 1fd47d0 into game Aug 13, 2019
@uchikun2493 uchikun2493 deleted the feature/add_path_avoidance branch August 13, 2019 03:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants