Skip to content

Commit

Permalink
Reorganize source files, add ROS setup.py
Browse files Browse the repository at this point in the history
This makes it possible to import the source files without
rospack.get_path(), and should also make it work from the catkin install
space.
  • Loading branch information
mintar committed Jun 13, 2019
1 parent f50228f commit 735be4e
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ find_package(catkin REQUIRED COMPONENTS
## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()
catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
Expand Down
File renamed without changes.
10 changes: 4 additions & 6 deletions src/dope.py → nodes/dope
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@
from PIL import Image
from PIL import ImageDraw

# Import DOPE code
rospack = rospkg.RosPack()
g_path2package = rospack.get_path('dope')
sys.path.append("{}/src/inference".format(g_path2package))
from cuboid import *
from detector import *
from dope.inference.cuboid import Cuboid3d
from dope.inference.cuboid_pnp_solver import CuboidPNPSolver
from dope.inference.detector import ModelData, ObjectDetector

### Global Variables
g_path2package = rospkg.RosPack().get_path('dope')
g_bridge = CvBridge()
g_img = None
g_draw = None
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD

from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup

# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['dope'],
package_dir={'': 'src'})

setup(**setup_args)
Empty file added src/dope/__init__.py
Empty file.
Empty file added src/dope/inference/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 735be4e

Please sign in to comment.