added entry points

This commit is contained in:
2018-11-12 13:48:43 +01:00
parent b9beddd4a4
commit 5c55770b03
3 changed files with 24 additions and 11 deletions

View File

@@ -16,9 +16,9 @@ sudo apt install git -y
1. Install Python and Python NAOqi SDK: [instructions]( 1. Install Python and Python NAOqi SDK: [instructions](
http://doc.aldebaran.com/2-1/dev/python/install_guide.html) 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 2. Check if NAOQi binding for Python works by launching Python and running
`from naoqi import ALProxy`. The installation was successful if it imports there `from naoqi import ALProxy`. The installation was successful if it
without errors. You can finish Python with `ctrl-d` then. imports without errors. You can finish Python with `ctrl-d` then.
3. Go to the project directory and run: 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 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 4. To run the scripts from the project other than the main one, do this from
the project directory: the project directory:
@@ -36,6 +37,13 @@ the project directory:
python -m pykick.[file_name_without_.py] 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 ### To run code on the robot
1. Create a folder named `pykick` on the robot. 1. Create a folder named `pykick` on the robot.
@@ -48,18 +56,22 @@ robot.
## What's inside? ## 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 * `copyfiles.sh` - Script for convenient copying of the project files to the
robot (IP is hard-coded, so use with caution). 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 * `colorpicker.py` - Program for calibrating the colors. Run
`python -m pykick.colorpicker -h` to see how to use it. `python -m pykick.colorpicker -h` to see how to use it.
* `detection_demo.py` - Program to check how good the robot can detect objects * `detection_demo.py` - Program to check how good the robot can detect objects
with the current color settings. 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 * `movements.py` - Convenience classes for moving robot. Also kick is
implemented here. 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 * `imagereaders.py` - Convenience classes for capturing video input from
various sources. various sources.

View File

@@ -251,8 +251,6 @@ class NaoMover(object):
if __name__ == '__main__': if __name__ == '__main__':
cfg = read_config()
mover = NaoMover(cfg['ip'], cfg['port'])
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
actions = parser.add_mutually_exclusive_group() actions = parser.add_mutually_exclusive_group()
actions.add_argument("-s", "--stand", action="store_true", actions.add_argument("-s", "--stand", action="store_true",
@@ -268,6 +266,9 @@ if __name__ == '__main__':
args = parser.parse_args() args = parser.parse_args()
cfg = read_config()
mover = NaoMover(cfg['ip'], cfg['port'])
if args.stand: if args.stand:
mover.stand_up() mover.stand_up()

View File

@@ -250,7 +250,7 @@ class Striker(object):
Raises Raises
------ ------
ValueError ValueError
The ball could not be seen :( The ball could not be seen :(
""" """
camera = 'upper' camera = 'upper'