Skip to content

Commit

Permalink
Merge branch 'gopher-devel' of https://github.com/asmodehn/rostful in…
Browse files Browse the repository at this point in the history
…to python_mutate

# Conflicts:
#	.travis.yml
#	instance/rostful.cfg
#	package.xml
#	rostful/__main__.py
#	rostful/api_0_1/flask_views.py
#	rostful/frontend/flask_views.py
#	rostful/server.py
  • Loading branch information
asmodehn committed Apr 17, 2018
2 parents ee9531d + c0460d4 commit 7b9c880
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ install:
# getting virtualenv setup with dependencies if we need to work with pure python setup
- if [ ! -z ${PYTHON+undef} ]; then docker exec -ti ${CONTAINER_NAME} /bin/bash -c "source /usr/share/virtualenvwrapper/virtualenvwrapper.sh && mkvirtualenv --system-site-packages -i /git_clone -a /git_clone -q python_${PYTHON}_ros"; fi


script:
- CONTAINER_ID=$(cat container.id)
- docker ps -a
Expand Down
9 changes: 3 additions & 6 deletions instance/rostful.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@ DEBUG = True
SERVER_TYPE = "flask"

# Settings to pass to pyros node to interface with ROS
# TODO : this should be managed by pyros separately, not here...
PYROS_TOPICS = ['/.*']
PYROS_SERVICES = ['/.*']
PYROS_PARAMS = ['/.*']

PYROS_USE_CONNECTION_CACHE = True
# not assuming cache available by default
PYROS_USE_CONNECTION_CACHE = False

# Not specifying these means we use pyros default.
# PYROS_CONNECTION_CACHE_LIST_TOPIC = "/rocon/connection_cache/list"
# PYROS_CONNECTION_CACHE_DIFF_TOPIC = "/rocon/connection_cache/diff"
#

import os

PYROS_SETUP_WORKSPACES=[os.path.join(os.path.dirname(__file__), '..', '..', 'devel')]
PYROS_SETUP_DISTRO = "indigo"
6 changes: 5 additions & 1 deletion rostful/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ def pyros_start(config, ros_args='', pyros_ctx_impl=None):
from pyros.client.client import PyrosClient
#TMP until interface can be chosen otherwise...
from pyros_interfaces_ros.pyros_ros import PyrosROS
except ImportError as e:

except Exception as e:
logging.error("pyros module is not accessible in sys.path. It is required to run rostful.", exc_info=True)
logging.error("sys.path = {0}".format(sys.path))
raise

# default to real module, if no other implementation passed as parameter (used for mock)
pyros_ctx_impl = pyros_ctx_impl or pyros_ctx

# very basic ROS choice. probably not the right way to get this ROS client to start the ROS node server.
# BUT we have no choice until pyros node can be launched directly...

# One PyrosNode is needed for Flask.
# TODO : check everything works as expected, even if the WSGI app is used by multiple processes
Expand Down
8 changes: 6 additions & 2 deletions rostful/api_0_1/flask_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def get_query_bool(query_string, param_name):
parser = FlaskParser()

import urllib
from pyros_interfaces_common.exceptions import PyrosException
from pyros.client.client import PyrosServiceNotFound, PyrosServiceTimeout
from pyros.client.client import PyrosException

from rostful.exceptions import ServiceNotFound, ServiceTimeout, WrongMessageFormat


Expand Down Expand Up @@ -107,6 +107,10 @@ class BackEnd(restful.Resource): # TODO : unit test that stuff !!! http://flas
def __init__(self, rosname=None):
super(BackEnd, self).__init__()

# dynamic import
from pyros_interfaces_ros import definitions
from pyros.client.client import PyrosServiceTimeout, PyrosServiceNotFound

self.node_client = context.get_pyros_client() # we retrieve pyros client from app context

# TODO: think about login rest service before disabling REST services if not logged in
Expand Down
1 change: 1 addition & 0 deletions rostful/frontend/flask_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def get_query_bool(query_string, param_name):
parser = FlaskParser()

import urllib
from pyros.client.client import PyrosException
from rostful.exceptions import ServiceNotFound, ServiceTimeout, WrongMessageFormat, NoPyrosClient


Expand Down

0 comments on commit 7b9c880

Please sign in to comment.