Skip to content

kw90/naoqi-opencv-tictactoe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic Tac Toe running on Pepper

Application for playing Tic Tac Toe against Pepper with simple game logic, computer vision and human-robot interaction components. The included Dockerfile allows to run everything in a pre-built container without the need to install Python2.7, NaoQi 2.5 and OpenCV 3.4. The environment variables PEPPER_IP and PEPPER_PW should be changed. This repository has been created for a workshop at the 37th Bundeswettbewerb Informatik BWINF.

Requirements

The following software must be installed beforehand:

  • Docker Engine >= v16 (current version v18.09 recommended)
    • An installation guide for any operating system can be found on the Docker Docs

Prepare Pepper

$ ssh nao@[PEPPER_IP]
# nao stop
# naoqi-bin --disable-life

Play TicTacToe

  1. Print or Draw a black Tic Tac Toe field with rather thick edges
  2. Place Pepper at roughly 40cm distance in front of the field
  3. Launch web server to host the game field that is retrieved by Peppers tablet
  4. Launch VNC and see if field is clearly visible by Peppers camera
  5. (Launch image server to see debug CV images)
  6. Launch game

Development Guide

So that we can start programming, we first need the version control software Git. An installation guide can be found here.

Clone the repository naoqi-opencv-tictactoe with

git clone https://github.com/kw90/naoqi-opencv-tictactoe.git

and navigate into the folder

cd naoqi-opencv-tictactoe

Inside this folder the container can be built using

docker build -t naoqi-opencv-tictactoe:latest .

This will pull the Docker image from the Docker Hub, copy the TicTacToe folder and sets the command python Main.py as the Launch order.

Then the container can be started by running,

docker run -it --network host naoqi-opencv-tictactoe:latest

which runs the Python Main.py program on the specified Pepper in the Dockerfile.

To run a different program inside the container, it can be specified after the container image description

docker run -it --network host naoqi-opencv-tictactoe:latest python DetectBoard.py

If something has been modified in the TicTacToe application, you can simply use the two commands

docker build -t naoqi-opencv-tictactoe:latest .
docker run -it --network host naoqi-opencv-tictactoe:latest

to rebuild and rerun the container.

More convenient way

For more convenient development, the source directory TicTacToe can be mounted inside the container and started with a simple shell as entrypoint

docker run -it -v `pwd`/TicTacToe:/naoqi/src/tic-tac-toe --entrypoint /bin/sh --network host naoqi-opencv-tictactoe:latest

This method allows to modify files on the Host machine using a preferred text editor and run them inside the container by running the Python program on the Docker shell, e.g. simply

python Main.py

About

Application for playing Tic Tac Toe against Pepper with simple game logic, computer vision and human-robot interaction components

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages