ProgrammingRobotsStudyGroup / robo_magellan

Apache License 2.0
4 stars 6 forks source link

Non-script Python files should be in Python packages #15

Open merose opened 6 years ago

merose commented 6 years ago

Currently there are non-node-script Python files in the scripts/ directory, cluttering it up. They should be moved to a Python package under src/ to follow ROS structural conventions. This will entail changes to CMakeLists.txt.

merose commented 6 years ago

The current nodes use something like this: "from cone_cone import ConeFinder"

If the current Python files are put into a package, then "cone_code.py" might become src/cone_util/cone_code.py. A naive __init.py__ would require "from cone_util.cone_code import ConeFinder". But the simpler "from cone_util import ConeFinder" would be nicer.

This can be done by putting this into __init.py__ in the package:

      from cone_cone import ConeFinder, ConeSeeker

This has an additional advantage: it hides the file structure within the package.

merose commented 6 years ago

Commit d7d08ccb87b41bce5378d19e52e47a108fc070a0 is a partial fix, moving the cone finder utilities into a package. That can be used as a template for moving other Python files outside of the scripts/ directory.