Conversation
|
test_scenario_kickoff.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16904335626/artifacts/3742959644 |
|
test_scenario_penalty.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16904335626/artifacts/3742962204 |
|
test_scenario_kickoff.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16904335626/artifacts/3745297432 |
|
test_scenario_penalty.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16904335626/artifacts/3745299398 |
|
キックオフとペナルティのシナリオで失敗しているので、何が起きてるのか確認お願いします! ログファイルの確認方法も上のリンク先に書いてあります |
ShotaAk
left a comment
There was a problem hiding this comment.
コメントしました。
evaluationの実装方針を変えたほうが良いですね 👀
| """ | ||
| WorldModelProviderNode モジュール. | ||
|
|
||
| このモジュールは ROS2 ノードとして動作する. | ||
| Referee メッセージや TrackedFrame を受け取り, ワールドモデルをリアルタイムに更新する. | ||
| """ |
| """ | ||
| タイマーにより定期的に呼び出され、WorldModelの状態を更新する. | ||
|
|
||
| ロボットのアクティビティやボール位置を再計算する. | ||
| """ |
There was a problem hiding this comment.
ball_evaluationは使ってないので このPRから削除お願いします。
(中身もBallPositionModelになってます)
There was a problem hiding this comment.
巨大なファイルになっているので分割しましょう。
1関数/1ファイルになっても良いです。
| @dataclass | ||
| class Threat: | ||
| score: int # 0以上 | ||
| robot_id: int # 相手のロボットID | ||
|
|
||
| class ThreatsModel: |
|
|
||
|
|
||
| # kick_target_model.py | ||
| def _obstacle_exists(target: State2D, ball: BallModel, robots: dict[int, Robot], tolerance) -> bool: |
There was a problem hiding this comment.
obstacle_exists.pyに抽出しましょう。
関数名も、アンダーバーをつけずにobstacle_exists にしてください。
| return True | ||
| return False | ||
|
|
||
| def _is_robot_inside_pass_area(ball: BallModel, robot: Robot, _half_width: Field) -> bool: |
There was a problem hiding this comment.
is_robot_inside_pass_area.pyに抽出しましょう。
関数名もアンダーバーを外してください。
| # robot_activity_model.py | ||
| """未完了.""" | ||
| @dataclass | ||
| class ReceiveScore: | ||
| """ボールをどれだけ受け取りやすいかを保持するデータクラス.""" | ||
|
|
||
| robot_id: int = 0 | ||
| intercept_time: float = float("inf") # あと何秒後にボールを受け取れるか | ||
|
|
||
| def calc_ball_receive_score_list( | ||
| robots: dict[int, Robot], ball: BallModel, ball_activity: BallActivityModel, game_config: GameConfigModel | ||
| ) -> list[ReceiveScore]: | ||
| """ロボットごとにボールを受け取れるスコアを計算する.""" | ||
|
|
||
| # ボールが動いていない場合は、スコアをデフォルト値にする | ||
| if not ball_activity.ball_is_moving: | ||
| return [ReceiveScore(robot_id=robot.robot_id) for robot in robots.values()] | ||
|
|
||
| score_list = [] | ||
| for robot in robots.values(): | ||
| score_list.append( | ||
| ReceiveScore( | ||
| robot_id=robot.robot_id, | ||
| intercept_time=calc_intercept_time(robot, ball, game_config), | ||
| ) | ||
| ) | ||
|
|
||
| # intercept_timeが小さい順にソート | ||
| score_list.sort(key=lambda x: x.intercept_time) | ||
| return score_list | ||
|
|
||
| def calc_intercept_time(robot: Robot, ball: BallModel, game_config: GameConfigModel) -> float: |
There was a problem hiding this comment.
未完了コードはPRから外しましょう〜。
また、依存関係によってはrobot_evaluationに入れずに、他の関数と同様に独立させてもいいと思います。
| self.very_close_to_ball_threshold = 0.3 | ||
| self.do_receive = do_receive | ||
|
|
||
| self.evaluation: Evaluation = Evaluation() |
There was a problem hiding this comment.
evaluationをメンバに持ってますが、
evaluationを更新する仕組みが用意されてないので期待通りに動かないと思います。
最初はworld_modelのメンバにevaluationを追加する、という仕組みにしてみてほしいです。
| # dribble.py | ||
| def ball_is_front(ball_pos: State2D, robot_pos: State2D, target_pos: State2D) -> bool: | ||
| """ボールがロボットの前にあるかどうかを判定する.""" |
There was a problem hiding this comment.
ballの関数なので別ファイルに抽出しましょう。
ball_is_front.py にしても良いです。
|
test_scenario_force_start.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16928602572/artifacts/3751843279 |
|
test_scenario_free_kick.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16928602572/artifacts/3751844120 |
|
yellow_invert/test_scenario_yellow_invert_kickoff.py failed. Failure logs: |
|
test_scenario_kickoff.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16928602572/artifacts/3751845988 |
|
test_scenario_ball_placement2.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16928602572/artifacts/3751850707 |
|
test_scenario_ball_placement.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16928602572/artifacts/3751850820 |
|
test_scenario_obstacle_avoidance.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16928602572/artifacts/3751851364 |
|
test_scenario_penalty.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16928926600/artifacts/3751942475 |
|
test_scenario_kickoff.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16930057125/artifacts/3752283786 |
|
test_scenario_penalty.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16930057125/artifacts/3752284986 |
|
test_scenario_kickoff.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16930057125/artifacts/3752423742 |
|
test_scenario_penalty.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16930057125/artifacts/3752424521 |
|
test_scenario_kickoff.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16930057125/artifacts/3760574650 |
|
test_scenario_penalty.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16930057125/artifacts/3760575613 |
|
test_scenario_penalty.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16930057125/artifacts/3760600600 |
|
test_scenario_force_start.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16986324251/artifacts/3772490311 |
|
test_scenario_obstacle_avoidance.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16986324251/artifacts/3772491484 |
|
test_scenario_free_kick.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16986324251/artifacts/3772491741 |
|
yellow_invert/test_scenario_yellow_invert_kickoff.py failed. Failure logs: |
|
test_scenario_kickoff.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16986324251/artifacts/3772493188 |
|
test_scenario_penalty.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16986324251/artifacts/3772496028 |
|
test_scenario_ball_placement2.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16986324251/artifacts/3772498240 |
|
test_scenario_ball_placement.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16986324251/artifacts/3772498588 |
|
test_scenario_obstacle_avoidance.py failed. Failure logs: https://github.com/SSL-Roots/consai_ros2/actions/runs/16986436278/artifacts/3772527868 |
ShotaAk
left a comment
There was a problem hiding this comment.
リファクタリングの方針良いと思います。
気になるところをコメントしました!
consai_game/consai_game/world_model/perception/robot_decision.py
Outdated
Show resolved
Hide resolved
consai_game/consai_game/world_model/perception/robot_decision.py
Outdated
Show resolved
Hide resolved
| self.last_ball_pos_to_detect_moving: Optional[State2D] = None | ||
|
|
||
| # ボールの予測クラスのインスタンスを生成 | ||
| self.ball_prediction = BallPrediction() |
There was a problem hiding this comment.
ここでpredictionのインスタンスが存在しているのが気になります。
world_model、evaluation、perceptionは並列の関係(親子関係じゃない)のはずなので、
インスタンスをメンバとして持たないほうがいいと思いました。
概要
関連チケット
変更内容
動作確認内容
確認したReferee Command
影響範囲
new file: consai_game/consai_game/evaluation/__init__.py new file: consai_game/consai_game/evaluation/ball_evaluation.py new file: consai_game/consai_game/evaluation/evaluation.py new file: consai_game/consai_game/evaluation/evaluation_meta_data.py new file: consai_game/consai_game/evaluation/evaluation_provider_node.py new file: consai_game/consai_game/evaluation/kick_target_evaluation.py new file: consai_game/consai_game/evaluation/robot_evaluation.py modified: consai_game/consai_game/main.py new file: consai_game/consai_game/perception/__init__.py new file: consai_game/consai_game/perception/ball_perception.py new file: consai_game/consai_game/perception/robot_perception.py modified: consai_game/consai_game/tactic/composite/composite_defense.py modified: consai_game/consai_game/tactic/composite/composite_offense.py modified: consai_game/consai_game/tactic/dribble.py modified: consai_game/consai_game/tactic/kick.py modified: consai_game/consai_game/visualization/visualize_msg_publisher_node.py modified: consai_game/consai_game/world_model/ball_activity_model.py modified: consai_game/consai_game/world_model/kick_target_model.py modified: consai_game/consai_game/world_model/world_model.py modified: consai_game/consai_game/world_model/world_model_provider_node.py補足