Giter VIP home page Giter VIP logo

petoi-agent's Introduction

Serial agent for the Bittle of the Petoi.

Operate the 'Bittle of the Petoi' through the serial port.

Note


Instllation

Install via pip or pipenv.

Using pip

$ pip install -r requirements.txt

If you want to run the tests, also install 'requests-mock'.

$ pip install requests-mock==1.9.2

Using pipenv

$ pipenv install

If you want to run the tests, install with the option '--dev'.

Usage

Configuration

  1. Copy the file 'settings.cfg.sample' to 'settings.cfg'
  2. Edit the required settings.
[Path]
# Set full path to the application root directory.
app_root = /Users/you/petoi-agent/src

[Petoi]
# Set the port of your Petoi
# Note: How listing ports is https://pythonhosted.org/pyserial/shortintro.html#listing-ports
port = /dev/tty.BittleSPP-999999-Port

Automate your bittle

Connect to petoi via serial agent. Petoi then performs a randomly selected motion at random intervals.

  1. Create action set in /{install directory}/resources/automate.json
  2. Change to the 'src' directory.
  3. Run '{your python interpreter} ./bin/automate.py'.

You can adjust automate settings in the 'settings.cfg'.

[Automate]
# Minute interval to start the action.
# Note: It's picked random between act_interval_min to act_interval_max
act_interval_min = 2
act_interval_max = 5

# The number of times to perform the action.
act_times = 5

Training your bittle

Send multiple commands to the Petoi as a performance scenario.

  1. Change to the 'src' directory.

  2. Run '{your python interpreter} ./bin/training.py'

    Example : (Sit for 3sec and then wait for 2sec.)

    $ python ./bin/training.py
    ...Please wait for a while until connect to the petoi.
    BOW-WOW?>>> ksit,3
    Added command as cmd:ksit duration:3sec
    BOW-WOW?>>> sleep,2
    Added command as cmd: duration:2sec
    BOW-WOW?>>> run
    

Available commands

Command Description
dry-run Show the queued command list.
run Sends all queued command to the petoi and clear them.
clear Clear all queued commands.
exit Quit the training.
quit Quit the training.

Execution of test code.

  1. Change to the parent directory of "src".

  2. Run the test.

    EX) Run all tests in the specified file.

    $ python -m unittest -v tests.test_serial_agent
    

    EX) Run specified test case.

    $ python -m unittest -v tests.test_serial_agent.TestSerialAgent.test_create_incetanse
    

Licence

MIT

petoi-agent's People

Contributors

maryco avatar

Watchers

 avatar  avatar  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.