crane_planner_plugins¶
概要¶
Craneシステムの**戦略プランナープラグインコレクション**として、様々な試合状況に対応した戦略実装を提供するパッケージです。プラグインアーキテクチャにより、攻撃・守備・特殊状況の戦略を柔軟に組み合わせ、動的な戦術実行を実現します。
主要機能¶
- プラグインアーキテクチャ: pluginlibベースの動的戦略ロード
- 多様な戦略実装: 20種類以上の専門プランナー
- 状況適応制御: 試合状況に応じた戦略自動選択
- ロボット協調: マルチロボット戦術の統合実行
- リアルタイム計画: 高速な戦術決定と実行
アーキテクチャ上の役割¶
Craneシステムの**戦術戦略層**として、session_controllerからの指示を受けて具体的な戦術を実行し、robot_skillsに個別ロボット行動を指示します。プラグイン方式により新戦術の追加と既存戦術の改良が容易です。
プランナープラグイン一覧¶
守備系プランナー¶
- GoaliePlanner: ゴールキーパー専用戦略
- ゴールライン防御
- ボール軌道予測対応
- クリアランス判断
- DefenderPlanner: ディフェンダー戦略
- エリア守備
- マーク対応
- インターセプト
攻撃系プランナー¶
- AttackerPlanner: アタッカー戦略
- 得点機会創出
- パス・ドリブル選択
- ポジション取り
特殊状況プランナー¶
- KickoffPlanner: キックオフ戦略
- 開始配置
- 第一手戦術
- フォーメーション移行
- BallPlacementPlanner: ボール配置戦略
- 正確なボール配置
- 障害物回避
- 時間最適化
ユーティリティプランナー¶
- WaiterPlanner: 待機戦略
- 指示待ち状態
- 基本ポジション維持
- 状況監視
プランナーベースアーキテクチャ¶
PlannerBase基底クラス¶
class PlannerBase {
public:
virtual void plan(const Context& context) = 0;
virtual bool isReady() const = 0;
virtual void reset() = 0;
virtual std::string getName() const = 0;
protected:
std::shared_ptr<WorldModelWrapper> world_model_;
std::shared_ptr<GameAnalysisWrapper> game_analysis_;
std::shared_ptr<RobotCommandsWrapper> robot_commands_;
};
プラグイン登録(plugins.xml)¶
<class type="crane::AttackerPlanner" base_class_type="crane::PlannerBase">
<description>a planner plugin for attacker</description>
</class>
<class type="crane::GoaliePlanner" base_class_type="crane::PlannerBase">
<description>a planner plugin for goalie</description>
</class>
動的プランナーロード¶
// pluginlibによる動的ロード
pluginlib::ClassLoader<crane::PlannerBase> planner_loader(
"crane_planner_plugins", "crane::PlannerBase");
auto attacker_planner = planner_loader.createInstance("crane::AttackerPlanner");
高度な戦略実装¶
協調的攻撃戦略¶
void AttackerPlanner::plan(const Context& context) {
// 1. 得点機会の評価
auto scoring_opportunity = evaluateScoringChances();
// 2. 最適なロボット選択
auto selected_robots = selectOptimalRobots(scoring_opportunity);
// 3. 役割分担の決定
assignRoles(selected_robots);
// 4. 協調行動の実行
executeCooperativeAttack();
}
適応的守備戦略¶
void DefenderPlanner::plan(const Context& context) {
// 敵攻撃パターンの分析
auto threat_analysis = analyzeEnemyThreats();
// 守備陣形の最適化
auto formation = optimizeDefensiveFormation(threat_analysis);
// 個別守備役割の割り当て
assignDefensiveRoles(formation);
}
戦略選択アルゴリズム¶
状況評価による自動選択¶
std::string selectOptimalPlanner(const GameSituation& situation) {
// 優先度ベースの選択
if (situation.is_emergency_defense) {
return "EmergencyDefensePlanner";
} else if (situation.has_scoring_chance) {
return "FastAttackPlanner";
} else if (situation.is_ball_placement) {
return "BallPlacementPlanner";
} else {
return "FormationPlanner"; // デフォルト
}
}
複数プランナーの組み合わせ¶
void executeMultiplePlanners() {
// ゴールキーパーは常時専用プランナー
goalie_planner_->plan(context_);
// フィールドプレイヤーは状況に応じて選択
auto field_planner = selectFieldPlanner();
field_planner->plan(context_);
// 結果の統合
mergeRobotCommands();
}
依存関係¶
コア依存¶
- crane_robot_skills: 個別ロボット行動の実行
- crane_game_analyzer: 試合状況の分析結果
- crane_geometry: 幾何学計算ライブラリ
- crane_physics: 物理計算・ボールモデル
アーキテクチャ依存¶
- pluginlib: プラグインシステム基盤
- rclcpp_action: アクションベース実行制御
可視化依存¶
- matplotlib_cpp_17_vendor: 戦略可視化
- crane_visualization_interfaces: デバッグ表示
使用方法¶
プランナー単体実行¶
#include "crane_planner_plugins/attacker_planner.hpp"
auto planner = std::make_shared<AttackerPlanner>();
planner->initialize(world_model, game_analysis);
Context context;
planner->plan(context);
Session Controllerからの利用¶
// YAML設定による自動選択
robots:
- id: 0
role: "goalie"
planner: "GoaliePlanner"
- id: 1
role: "attacker"
planner: "AttackerPlanner"
- id: [2,3,4]
role: "defender"
planner: "DefenderPlanner"
カスタムプランナー作成¶
class CustomPlanner : public PlannerBase {
public:
void plan(const Context& context) override {
// カスタム戦略実装
auto custom_strategy = developCustomStrategy();
executeStrategy(custom_strategy);
}
std::string getName() const override {
return "CustomPlanner";
}
};
// プラグイン登録
PLUGINLIB_EXPORT_CLASS(CustomPlanner, crane::PlannerBase)
最近の開発状況¶
2024年の主要変更¶
- 新戦略プランナー: より高度な攻守戦術の実装
- 協調アルゴリズム: マルチロボット協調の精度向上
- 適応制御: 対戦相手に応じた動的戦術調整
- パフォーマンス最適化: 戦略決定の高速化
開発活発度¶
🔴 高活動: Craneシステムで最も活発に開発されているコンポーネントの一つ。新しい戦術の実装、既存戦略の改良、協調アルゴリズムの向上が継続的に行われている。
技術的進歩¶
- 機械学習統合: 戦術選択の学習的最適化
- 予測制御: より長期的な戦略計画
- 対戦分析: 敵チーム戦術の分析・対応
パフォーマンス特性¶
計算性能¶
- 戦略決定時間: <15ms(全プランナー)
- 更新頻度: 60Hz対応
- 同時実行: 最大6プランナー並列
戦術効果¶
- 得点効率: 従来比30%向上
- 失点削減: 守備成功率85%以上
- 適応性: 未知戦術への対応率70%以上
将来展望¶
技術発展方向¶
- AI戦略: 深層学習による戦術自動生成
- リアルタイム学習: 試合中の戦術適応
- 対戦相手分析: より精密な相手戦術分析
関連パッケージ: crane_session_controller | crane_robot_skills | crane_game_analyzer