Skip to content

Commit

Permalink
Separate running script from the package, following catkin conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
corot committed Nov 28, 2014
1 parent 16d08cc commit 5d48a2c
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 13 deletions.
3 changes: 3 additions & 0 deletions world_canvas_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ project(world_canvas_server)
find_package(catkin REQUIRED)

catkin_package()
catkin_python_setup()

catkin_install_python(PROGRAMS scripts/world_canvas_server
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

FILE(GLOB_RECURSE script_files scripts/*.py)

Expand Down
2 changes: 1 addition & 1 deletion world_canvas_server/launch/add_map.launch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<remap from="map" to="new_map__"/>
</node>

<node pkg="world_canvas_server" type="annotations_server.py" name="annotations_server" output="screen">
<node pkg="world_canvas_server" type="world_canvas_server" name="world_canvas_server" output="screen">
<param name="auto_save_map" value="false"/>
<!-- Read the map to save from our private topic -->
<remap from="map" to="new_map__"/>
Expand Down
2 changes: 1 addition & 1 deletion world_canvas_server/launch/world_canvas_server.launch
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<param name="overwrite" value="false"/>
</node> -->

<node pkg="world_canvas_server" type="annotations_server.py" name="world_canvas_server" args="$(arg debug)" output="screen">
<node pkg="world_canvas_server" type="world_canvas_server" name="world_canvas_server" args="$(arg debug)" output="screen">
<param name="start_map_manager" value="true"/>
<param name="auto_save_map" value="false"/>
</node>
Expand Down
17 changes: 17 additions & 0 deletions world_canvas_server/scripts/world_canvas_server
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#! /usr/bin/env python

import sys
import rospy

import world_canvas_server

if __name__ == '__main__':
if len(sys.argv) > 1 and sys.argv[1] == 'true':
# Only (optional) argument is a debug='true'/'false' flag
rospy.init_node('world_canvas_server', log_level=rospy.DEBUG)
else:
rospy.init_node('world_canvas_server')

world_canvas_server.AnnotationsServer()

rospy.spin()
12 changes: 12 additions & 0 deletions world_canvas_server/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python

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

d = generate_distutils_setup(
packages=['world_canvas_server'],
package_dir={'': 'src'},
requires=['roslib', 'rospy', 'world_canvas_msgs', 'world_canvas_libs']
)

setup(**d)
3 changes: 3 additions & 0 deletions world_canvas_server/src/world_canvas_server/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .annotations_server import *
from .yaml_database import *
from .map_manager import *
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,3 @@ def service_error(self, response, message):
response.message = message
response.result = False
return response

if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == 'true':
# Only (optional) argument is a debug='true'/'false' flag
rospy.init_node('world_canvas_server', log_level=rospy.DEBUG)
else:
rospy.init_node('world_canvas_server')

AnnotationsServer()

rospy.spin()
File renamed without changes.
File renamed without changes.

0 comments on commit 5d48a2c

Please sign in to comment.