Giter Site home page Giter Site logo

consai2's Introduction

本パッケージの使用は非推奨です

https://github.com/SSL-Roots/consai_ros2 へ開発を移行しています。

Build Status

CON-SAI2

CON-SAI2はRoboCup SSLに 初めて参加する人でも開発できるサッカーAIです。

CONtribution to Soccer AI

consai2_main

前作のCON-SAI からCON-SAI2へ開発を移行しました。

CON-SAIとの違い

  • ROSのルールに合うようパッケージ名を修正しました
  • サンプルプログラム(consai2_examples)を追加しました
    • Visualizer(Vision, Refereeとの通信確認)
    • Control(走行制御のテスト)
    • Game(試合プログラム)
    • Joystick(ジョイスティックコントローラによるロボットの操縦)
  • ユーザが拡張すべきプログラムと、変更が不要なプログラムを明確にしました
    • 例えば、Vision・Refereeのデータ受信やシミュレータへのデータ送信プログラムは変更不要です
    • 例えば、戦略プログラムや走行制御、ロボットへのデータ送信プログラムはユーザに合わせて拡張してください
    • Rootsが作成したコード例を各パッケージのexampleディレクトリに用意しています

Requirements

CON-SAI2はUbuntu 18.04で作成・テストしてます。

下記のPCスペックで問題なく動作します。

  • Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
  • 8 GB of RAM
  • 有線LANポート(試合会場では有線LANでロボット・ボール位置座標データを受信します)

Installation

ROSのインストール

ROS (Robot Operating System) は、ロボットソフトウェア開発をサポートする ライブラリ・ツールが豊富に含まれたオープンソースソフトウェアです。

CON-SAI2はKinetic、Melodicに対応しています。

Ubuntu install of ROS Melodicを参考に、インストールしてください。フルインストール推奨です。

Google Protobuf Librariesのインストール

sudo apt-get install libprotobuf-dev libprotoc-dev protobuf-compiler
sudo apt-get install python-pip
sudo pip2 install protobuf

依存パッケージのインストール

sudo apt-get install ros-$ROS_DISTRO-navigation ros-$ROS_DISTRO-bfl -y

CON-SAI2のビルド

git clone https://github.com/SSL-Roots/consai2 ~/catkin_ws/src/consai2
cd ~/catkin_ws/src/
rosdep install -r -y --from-paths . --ignore-src
cd ~/catkin_ws/
catkin_make
source ~/catkin_ws/devel/setup.bash

RoboCup SSLのAI開発に必要なツールをインストール

RoboCup SSLのAI開発にはシミュレータ(grSim)と審判ソフト(SSL-Game-Controller)があると便利です。

下記ページを参考に、ソフトウェアをインストールしてください。

grSim

SSL-Game-Controller

Tutorial

CON-SAI2を始めるに当たって、まずはサンプルプログラムを実行してください。

consai2_examples にサンプロプログラムの実行方法が記載されています。

Development

いくつかのパッケージ内のexampleディレクトリはRootsのコード例です。そのため、今後もRootsの意思で中身が大幅に変わる可能性があります。

masterブランチの変更を容易にマージするため、以下項目を守ってください。

  • masterからブランチを切り分ける
  • 各パッケージのexampleディレクトリ内を編集しない
  • 各パッケージのsrcscriptsディレクトリ直下にユーザコードを追加する

Contribution

CON-SAI2は全ユーザ共通で使用できるコード(consai2_receiverconsai2_senderなど)と、 各ユーザで作成すべきコード(作成例:exampleディレクトリ)に分かれています。

全ユーザ共通で扱うコードについてはRoots以外の要望も受け入れたいので、 Contribution(issue, pullreq)をお願いします。

些細な修正や指摘でも良いので、まずはissueの作成から始めてみてください。

Author

CON-SAI2はRoboCup SSLに参加している日本人チームRootsが作成しています。

RoboCup SSLへの参加方法、ロボットに必要な機能、開発環境などは Rootsのホームページに記載してます。

Roots - Home

consai2's People

Contributors

hansrobo avatar nabekuro0104 avatar shotaak avatar tilt-silvie avatar uchikun2493 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

consai2's Issues

roleの11台対応

8台前提のrole設定となっていたので、11台に対応する
roleは以下を想定

  1. ATK
  2. CB1
  3. CB2
  4. SUB ATK
  5. ZONE1
  6. ZONE2
  7. ZONE3
  8. ZONE4
  9. MAN-MARK1
  10. MAN-MARK2

defense.pyの整理・改修

  • コメントの追記
  • 変数名・定数名・関数名の整備
  • 冗長な表現の削除
  • その他気になった点を編集

CON-SAI 2の流用の仕方をreadmeに書く

CON-SAI2には、ユーザにコントリビュート(issue, pullreq)してほしいコードと、ユーザに用意してほしいコード、編集して欲しくないコードがある。

それらがどの部分なのかをReadmeに記載する。

フィールドロボットが0台になったあと、ロボットを配置してもアタッカーにならない

ゴーリー以外のフィールドロボットが0台になったあと
前回アタッカーだったロボットが復活しても
アタッカーにはならず、ディフェンスになってしまう。

原因
マージンを設けて、アタッカーの切り替わりの発振を防ぐ処理によって
切り替え処理が働かない。
自分とボールの距離 < 自分とボールの距離 - MARGIN
という判定になる。

各パッケージにReadmeを追加する

いくつかのパッケージにREADME.mdファイルが存在しないため追加する。

consai2_controlや、consai2_gameはexampleコードがほとんどであるが、パッケージとしての役割は明記すべきである。

Vision情報のチームサイド反転は、上位層に行わせる

consai2_receiver/vision_receiverでチームサイドの反転をしているが、vision_receiverはできるだか無編集なデータをPublishすべきである。

# FIXME: チームサイドの反転はより上位の vision_wrapperにやらせる
invert_side = False
if self._SIDE != 'left':
invert_side = True

チームサイドの反転は上位層のvision_wrapperに実行させる。

referee GameTypeの修正

#16 の処置に追記する。

game_event内のいくつかのパラメータはoptionalなので、HasFieldで存在をチェックしてから値を取得する。

World ObserverのKalman Filterの出力が不安定

お世話になっております。

World Observerの動作について質問させてください。
以下はGrSim(ホワイトノイズ無し)にて1m/sの等速直線**をした際の出力です。

world_observer

上図のように、推定値が1 〜 1.2m/sあたりを行き来しますが、こちらはバグでしょうか。
私の使用方法が何かしら誤っているのでしょうか。

また、現在はフレームレート60fps決め打ちでの実装となっていますが、フレーム間隔を都度計算してpredictしたほうがより良いと思います。

よろしくおねがいします。

referee_receiver.pyにおけるgameEventの代入不備

発生原理

consai2_receiver/scripts/referee_receiver.pyの47行目においてGameEventに関して「protobufによってデシリアライズされたパケット」から「ROSメッセージ」への代入が行われているが両者のもつフィールド名は微妙に違うことからこの代入は失敗し,下に示すようなエラーを生じる.

発生状況

roslaunch consai2_examples visualizer.launch

上記のコマンドを実行した上で公式サイトで公開されている大会ログを再生すると本現象が発生する.
今回使用したログファイルは以下のとおりである.
使用ログファイル
RoboCupSSL2019世界大会決勝戦(ER-Force vs ZJUNlict)
https://tigers-mannheim.de/download/gamelogs/2019/div-a/

なお,PC上でも

  • sslrefbox + grSim
  • ssl-game-controller + grSim

の2通りの環境で試してみたがreferee.protooptional指定されているフィールドgameEventが使われる状況を発生させることができなかったのか,本現象が発生することはなかった.

error

setting /run_id to da047ff2-bd15-11e9-bf6a-88b1119fee3a
process[rosout-1]: started with pid [20031]
started core service [/rosout]
process[vision_receiver-2]: started with pid [20045]
process[referee_receiver-3]: started with pid [20049]
process[vision_wrapper-4]: started with pid [20050]
process[referee_wrapper-5]: started with pid [20051]
process[consai2_visualizer-6]: started with pid [20052]
Traceback (most recent call last):
  File "/home/hans/catkin_ws/src/consai2/consai2_receiver/scripts/referee_receiver.py", line 59, in <module>
    receiver.receive()
  File "/home/hans/catkin_ws/src/consai2/consai2_receiver/scripts/referee_receiver.py", line 27, in receive
    self._publish_referee(buf)
  File "/home/hans/catkin_ws/src/consai2/consai2_receiver/scripts/referee_receiver.py", line 49, in _publish_referee
    self._pub_referee.publish(referee)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 882, in publish
    self.impl.publish(data)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 1066, in publish
    serialize_message(b, self.seq, message)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/msg.py", line 152, in serialize_message
    msg.serialize(b)
  File "/home/hans/catkin_ws/devel/lib/python2.7/dist-packages/consai2_msgs/msg/_Referee.py", line 168, in serialize
    buff.write(_get_struct_4I3d2BI().pack(_x.blue.yellow_cards, _x.blue.timeouts, _x.blue.timeout_time, _x.blue.goalie, _x.designated_position.x, _x.designated_position.y, _x.designated_position.z, _x.game_event.game_event_type, _x.game_event.originator_team, _x.game_event.originator_bot_id))
AttributeError: 'SSL_Referee_Game_Event' object has no attribute 'game_event_type'
================================================================================REQUIRED process [referee_receiver-3] has died!
process has died [pid 20049, exit code 1, cmd /home/hans/catkin_ws/src/consai2/consai2_receiver/scripts/referee_receiver.py __name:=referee_receiver __log:=/home/hans/.ros/log/da047ff2-bd15-11e9-bf6a-88b1119fee3a/referee_receiver-3.log].
log file: /home/hans/.ros/log/da047ff2-bd15-11e9-bf6a-88b1119fee3a/referee_receiver-3*.log
Initiating shutdown!
================================================================================

goalie.pyの整理

goalie.pyの整理

  • コメントの追加
  • 冗長な表現の削除
  • 関数にまとめられる場合はまとめる

ROS2対応

CON-SAI2はROS 2にも対応させます。ブランチを切り分けて、ROS1とROS2の両方を残します。

詳細な開発方針はこのissueや、別の方法で議論し、決定します。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.