Giter Club home page Giter Club logo

deepsoccer's Introduction

1. Introduction

The purpose of this project is to make a soccer robot. For that, Robot Operation System (ROS), Deep Learning, 3D printer and Cad are used together.

Due to the characteristic of Deep Learning, a large amount of training data is required. Thus, virtual simulation tool of ROS called Gazebo is additionally used. The project uses the one of famous Deep Reinforcement Learning algorithm which uses a human expert data for improving performance.

In order to use the robot algorithm trained in the virtual simulation in the real world, I use a CycleGAN for generating view of simulation world from view of real world.

Finally, hardware information of robot also will be shared as 3D CAD format to allow other researchers, makers can use this project for their own purpose.

More detailed instruction can be found at my blog post of DeepSoccer

2. Prerequisite

This project started from originally Jetbot. Therefore, the hardware and software are advanced form of Jetbot. It is highly recommended that you first try to run original Jetbot before trying DeepSoccer.

3. Robot design

I remodel hardware of Jetbot because it is not suitable for soccer. As you know easily, soccer robot needd a kicking and holding part. The Jetbot soccer version can hold a soccer ball and kick it. The wheel part is changed to omniwheel type for moving more freely.

You can see detailed information about hardware design at https://kimbring2.github.io/2020/10/08/deepsoccer.html#design_deepsoccer.

5. Simulation

1. Software Dependency

  • ROS Melodic, Gazebo 9
  • ROS openai_ros package
  • Gazebo only provides Python 2.7(From ROS Noetic at Ubuntu 20.04, Python3 can be used)
  • Tensorflow 2.1.0
  • requests
  • pynput
  • opencv-python

2. Network Architecture

3. Usage

ROS package

Please put deepsoccer_pc, openai_ros, openai_ros, solenoid_electromagnet_joint_spring_plugin, my_deepsoccer_training folder to your ROS workspace. For example, my path '/home/kimbring2/catkin_ws/src'.

Then, try to run below command to build all ROS package what we put.

$ cd ~/catkin_ws/src/
$ git clone https://github.com/kimbring2/DeepSoccer.git
$ cd ..
$ catkin_make

If there are no error message, move to next.

Set model file for soccer field

Copy deepsoccer_gazebo folder to '/home/[Your User Name]/.gazebo/models' for soccer field rendering.

Training network using Supervised Learning&Reinforcement Learning

After setting everything mentioned above, download the human expert data from Google Drive. I collected that data manually.

After that, extract it to your workspace folder. You need to set a workspace_path in yaml file.

After preparing the human expert data and config file, run below command. It will start a tutorial file of DeepSoccer as format of OpenAI Gym environment.

$ source devel/setup.bash
$ roslaunch my_deepsoccer_training start_tutorial.launch

Trained model, Tensorboard log are saved under 'src/train/' folder seperately. Try to check the loss is decreased under 0.3 point.

If you set the sl_training config to False, pretrained_model to file name of trained model, it will start the Reinforcmenet Learning phase using trained model.

DeepSoccer Supervised Learning demo Click to Watch!

Collection human expert data

You can also collect the human expert dataset using 'roslaunch my_deepsoccer_training start_dataset.launch' command. After Gazebo screen is poped up, you can control robot using 8 command.

The name of the replay file and the path to be saved can be set in the config file.

4. Troubleshooting

1) RLException Error

If you get a 'RLException' error message, use 'source devel/setup.bash' command and try again.

2) Could not find the GUI, install the 'joint_state_publisher_gui' package Error

If you get that error when try to run 'roslaunch jetbot_description jetbot_rviz.launch' command, try to install related package using below command at your terminal.

$ sudo apt install ros-melodic-joint-state-publisher-gui

3) Could not load controller Error

If you get a 'Could not load controller' error message, try to install related package using below command at your terminal.

$ sudo apt-get install ros-melodic-ros-control ros-melodic-ros-controllers

4) RViz 'No transform from' error

If you get error message includes 'No transform from', try to install unicode ubuntu package and reboot.

$ sudo apt-get install unicode 

5. Docker

You can also use a Docker image for this repo using below command. Afte that, you can connect to created container by VNC(http://127.0.0.1:6080/#/).

$ docker run -it --rm -p 6080:80 --name=env_1 kimbring2/deepsoccer:latest

Because of low speed of Gazebo simulation in Docker image, you need to see Gazebo of it by using host PC. However, you shoud place ROS package to ' /root/catkin_ws/src' for rendering robot model. After that, get IP address of Docker image and connect to it by using below command.

$ export GAZEBO_MASTER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' env_1)
$ export GAZEBO_MASTER_URI=$GAZEBO_MASTER_IP:11345
$ gzclient --verbose

After connecting to the docker image with VNC, move to the catkin_ws folder. Then, you can start the simulation by executing the following command.

6. Relationship between simualtion and real part

The purpose of this project is to train Jetbot to play soccer based on simulation and then apply trained model to actual Jetbot. Therefore, I am currently updating the code and description of the current simulation robot and the actual robot to this repository together.

Each ROS package for simulation and real robot is placed separately in two folder.

  1. ROS package for simulation robot: https://github.com/kimbring2/DeepSoccer/tree/master/deepsoccer_pc
  2. ROS package for real robot: https://github.com/kimbring2/DeepSoccer/tree/master/deepsoccer_jetson
  3. Simulation to Real to connect 1, 2 method: https://github.com/kimbring2/DeepSoccer/blob/master/sim2real

You can run each part separately. However, two part should be connected by sim2real method.

7. Reference

8. Citation

If you use DeepSoccer to conduct research, we ask that you cite the following paper as a reference:

@misc{kim2020deepsoccer,
  author = {Dohyeong, Kim},
  title = {DeepSoccer},
  year = {2020},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/kimbring2/DeepSoccer/}},
  commit = {9ccab28a7e2a9a14caa119a765f95e2c6d0b044e}
}

9. Acknowledgement

I receive a prize from NVIDIA for this project

I receive Jetson AI Specialist certification from NVIDIA by this project

10. License

Apache License 2.0

deepsoccer's People

Contributors

kimbring2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

deepsoccer's Issues

I have tried "python main.py", and installed TensorFlow via "pip install tessorflow", but it was reported like this: "ERROR: No matching distribution found for tensorflow"

Error Message Following
~/catkin_ws/src/DeepSoccer/jetbot/jetbot_control/src$
$ python main.py
Traceback (most recent call last):
File "main.py", line 16, in
import cvlib as cv
File "/home/jetbot/.local/lib/python2.7/site-packages/cvlib/init.py", line 8, in
from .gender_detection import detect_gender
File "/home/jetbot/.local/lib/python2.7/site-packages/cvlib/gender_detection.py", line 4, in
from keras.utils import get_file
File "/home/jetbot/.local/lib/python2.7/site-packages/keras/init.py", line 6, in
'Keras requires TensorFlow 2.2 or higher. '
ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via pip install tensorflow

RVIZ not showing

Screenshot from 2020-01-30 12-08-41

Hi,

I run "roslaunch jetbot_description jetbot_rviz.launch" and cannot show the jetbot model in RVIZ. What might be the problems? Thanks!

Regards
Tao

Could not load controller

Hi, Dohyeong

I am making progress step by step. Now I get to the stage below:

Screenshot from 2020-02-02 16-31-11

Anything I missed?

Regards
Xinghui

CMake Error about gazebo_ros

I have a problem with building the ROS project. I get an error message as below when I execute 'catkin_make'.
I did it right after checking jetbot_ros in https://github.com/dusty-nv/jetbot_ros works well.
I tried downloading gazebo-ros to fix this, but it didn't work. How can I solve this problem?

error message

-- +++ processing catkin package: 'solenoid_electromagnet_joint_spring_plugin'
-- ==> add_subdirectory(DeepSoccer/solenoid_electromagnet_joint_spring_plugin)
-- Could NOT find gazebo_ros (missing: gazebo_ros_DIR)
-- Could not find the required component 'gazebo_ros'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "gazebo_ros" with
any of the following names:

gazebo_rosConfig.cmake
gazebo_ros-config.cmake

Add the installation prefix of "gazebo_ros" to CMAKE_PREFIX_PATH or set
"gazebo_ros_DIR" to a directory containing one of the above files. If
"gazebo_ros" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
DeepSoccer/solenoid_electromagnet_joint_spring_plugin/CMakeLists.txt:5 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/jetbot/workspace/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/jetbot/workspace/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:852: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

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.