Skip to content

maryco/petoi-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Serial agent for the Bittle of the Petoi.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages