From 5c55770b03cfe57950896e5ba36a3feb024f8d97 Mon Sep 17 00:00:00 2001 From: Pavel Lutskov Date: Mon, 12 Nov 2018 13:48:43 +0100 Subject: [PATCH] added entry points --- README.md | 28 ++++++++++++++++++++-------- pykick/movements.py | 5 +++-- pykick/striker.py | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 77822eb..29cfe73 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ sudo apt install git -y 1. Install Python and Python NAOqi SDK: [instructions]( http://doc.aldebaran.com/2-1/dev/python/install_guide.html) -2. Check if NAOQi binding for Python works by launching Python and running there -`from naoqi import ALProxy`. The installation was successful if it imports -without errors. You can finish Python with `ctrl-d` then. +2. Check if NAOQi binding for Python works by launching Python and running +there `from naoqi import ALProxy`. The installation was successful if it +imports without errors. You can finish Python with `ctrl-d` then. 3. Go to the project directory and run: @@ -27,7 +27,8 @@ python -m pykick ``` This will launch the striker state machine, which should work if colors are -calibrated correctly. +calibrated correctly, and the robot is on the field, and there is one ball on +the field and no obstacles. And the goal is distinctive. 4. To run the scripts from the project other than the main one, do this from the project directory: @@ -36,6 +37,13 @@ the project directory: python -m pykick.[file_name_without_.py] ``` +To get an overview try + +``sh +python -m pykick.colorpicker -h +python -m pykick.movements -h +`` + ### To run code on the robot 1. Create a folder named `pykick` on the robot. @@ -48,18 +56,22 @@ robot. ## What's inside? -* `__main__.py` - The script containing the state machine. +* `__main__.py` - The script containing the state machine. Read this to figure +out how everything fits together. * `copyfiles.sh` - Script for convenient copying of the project files to the robot (IP is hard-coded, so use with caution). -* `nao_defaults.json` - The settings such as color HSV values. +* `nao_defaults.json` - The settings such as color HSV values, and the NAOs IP +address * `colorpicker.py` - Program for calibrating the colors. Run `python -m pykick.colorpicker -h` to see how to use it. * `detection_demo.py` - Program to check how good the robot can detect objects with the current color settings. -* `striker.py` - The class with high lever behaviors, e.g. aligning to ball. +* `striker.py` - The class with high lever behaviors, e.g. aligning to ball. If +you want to figure out our code, **START HERE**. * `movements.py` - Convenience classes for moving robot. Also kick is implemented here. -* `finders.py` - Classes for Ball, Goal and Field detection. +* `finders.py` - Classes for Ball, Goal and Field detection. Read this file if +you are curious about detection algorithms and the class interfaces. * `imagereaders.py` - Convenience classes for capturing video input from various sources. diff --git a/pykick/movements.py b/pykick/movements.py index 238f850..dcdd824 100644 --- a/pykick/movements.py +++ b/pykick/movements.py @@ -251,8 +251,6 @@ class NaoMover(object): if __name__ == '__main__': - cfg = read_config() - mover = NaoMover(cfg['ip'], cfg['port']) parser = argparse.ArgumentParser() actions = parser.add_mutually_exclusive_group() actions.add_argument("-s", "--stand", action="store_true", @@ -268,6 +266,9 @@ if __name__ == '__main__': args = parser.parse_args() + cfg = read_config() + mover = NaoMover(cfg['ip'], cfg['port']) + if args.stand: mover.stand_up() diff --git a/pykick/striker.py b/pykick/striker.py index 83452e2..071dc9e 100644 --- a/pykick/striker.py +++ b/pykick/striker.py @@ -250,7 +250,7 @@ class Striker(object): Raises ------ ValueError - The ball could not be seen :( + The ball could not be seen :( """ camera = 'upper'