GithubHelp home page GithubHelp logo

github-jinwei / unity-game-controllers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emilyyzhang/unity-game-controllers

0.0 1.0 0.0 58.47 MB

Codebase for Robots/Agents to interface with Unity Game Environments

License: BSD 2-Clause "Simplified" License

CMake 0.13% Python 30.19% Makefile 0.07% Jupyter Notebook 68.32% Shell 1.29%

unity-game-controllers's Introduction

Unity Game Controllers


This repository is a codebase for research on Agents and Robots interacting with Humans via Unity-backed games The overall architecture is very similar to a Model-View-Controller architecture (MVC).

Models include the Game State, Student, and Agent Models.

Views are implemented in C# and the Unity framework, running on the Tablet. Examples include the Tap Game

Controllers include game logic, and are implemented in Python and closely coupled with ROS.

In addition, we also plan to support a number of Sensors that provide real-time interactive features to Models

Basics

This repository contains:

  • Controllers, Models, and various Utility functions for managing different Unity games.
  • ROS message definitions for communicating with the Unity implemented games via RosBridge.
  • Launch scripts and experiment infrastructure for setting up an interaction, logging, cleaning, and analyzing data.

This project is based on a best-practices template Python project which integrates several different tools. It saves you work by setting up a number of things like style-checking, unit testing, data generation, etc. with a Make-based worflow.

If you are new to Python or new to creating Python projects, see Kenneth Reitz's Hitchhiker's Guide to Python for an explanation of some of the patterns/tools used here.

Project Setup

Tools

We recommend using PyCharm as your primary editor for large Python projects like this one. Sublime Text is OK for quick edits, but PyCharm gives you the full power of static analysis, environment management, style checking, and an integrated terminal etc. in an attractive all-in-one package.

Installation

This project was built and tested on Ubuntu 16.04, with a full desktop installation of ROS Indigo

We recommend using Python 2.7 as your default system-wide Python environment (for ROS) and creating a virtual environment with Python 3.6 virtual env to execute the controller code

All Python code should be written in Python 3!

Create and source virtualenv

If you haven't done this yet, set up and source a python3 virtual env with: mkdir -p ~/python-virtualenvs virtualenv -p $(which python3) ~/python-virtualenvs/unity-game-controllers --system-site-packages

Then, activate it with source ~/python-virtualenvs/unity-game-controllers/bin/activate

Install the project's non-python development and runtime requirements::

UBUNTU 16.04 System dependencies
$ sudo apt-get install portaudio19-dev
$ sudo apt-get install xdotool
$ sudo apt-get install wmctrl
$ sudo apt-get install ros-indigo-rosbridge-server
$ sudo apt-get install python3-tk

# frequently needed for ROS-related code to work)
$ pip install rospkg
$ pip install catkin_pkg
$ pip install pymongo
$ pip install twisted

# External catkin repos necessary for message passing and other functions
# Clone these to ~/catkin_ws/src, then run "catkin_make" from ~/catkin_ws
$ https://github.com/bosch-ros-pkg/usb_cam.git
$ https://github.com/mitmedialab/r1d1_msgs.git (to communicate w Tega)
$ https://github.com/mitmedialab/jibo_msgs.git (to communicate w Jibo)
$ https://github.com/mitmedialab/affdex_ros_msgs.git (to get realtime Affdex facial info)
$ https://github.com/mitmedialab/asr_google_cloud.git (to connect to google ASR for iSpy)

Install the project's python development and runtime requirements::

$ make init

Project setup is now complete!

Running a Unity Game Controller


  1. Activate the virtualenv
source ~/python-virtualenvs/unity-game-controllers/bin/activate
  1. Start roscore and rosbridge # do not switch to a different terminal window until done loading
$ ./scripts/startROS.sh
  1. Start a game controller. E.g., you can run the TapGame Controller by running the following script:

$ python -m scripts.start_tap_game_controller [participant_id] [experimenter] [experiment_phase]

e.g.

$ python -m scripts.start_tap_game_controller p01 sam experiment

You can test the tap game in practice or posttest mode, by passing those arguments in as the experiment_phase

Troubleshooting:

  • Problem: "cannot find module 'clev"
    • Solution: Navigate to the install site of the weighted-levenshtein package, edit init.py, and remove
  • Problem: "cannot find module 'em'"
    • Solution: pip install empy

unity-game-controllers's People

Contributors

huilichen25 avatar samspaulding avatar soojungjang97 avatar maggiewu19 avatar safinahali avatar maggiewu2019 avatar

Watchers

James Cloos avatar

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.