Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvment of service manager #257

Merged
merged 22 commits into from
Jan 20, 2015
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions concert_master/launch/concert_master.launch
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<arg name="conductor_local_clients_only" default="false"/>
<!-- Service Manager -->
<arg name="services" default=""/> <!-- service list resource location. e.g. concert_tutorial/tutorial.services -->
<arg name="auto_enable_services" default="[]"/> <!-- autoenable services, e.g. [admin, initialisation] services which auto enabled on start up or "all" to enable all services -->
<arg name="default_auto_enable_services" default="[]"/> <!-- autoenable services, e.g. [admin, initialisation] services which auto enabled on start up or "all" to enable all services -->

<!-- Interactions -->
<arg name="enable_rosbridge" default="false"/>
Expand All @@ -43,8 +43,9 @@

<!-- ***************************** Service Manager *************************** -->
<include file="$(find concert_service_manager)/launch/service_manager.launch">
<arg name="concert_name" value="$(arg concert_name)"/>
<arg name="services" value="$(arg services)" />
<arg name="auto_enable_services" value="$(arg auto_enable_services)" />
<arg name="default_auto_enable_services" value="$(arg default_auto_enable_services)" />
</include>

<!-- ***************************** Software Farmer *************************** -->
Expand Down
6 changes: 4 additions & 2 deletions concert_service_manager/launch/service_manager.launch
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<launch>
<arg name="auto_enable_services" default="[]"/> <!-- autoenable services, e.g. [admin, initialisation] services which auto enabled on start up or "all" to enable all services -->
<arg name="concert_name" default="Rocon concert"/> <!-- concert name, e.g. Pirate Concert, demo_concert, etc. -->
<arg name="default_auto_enable_services" default="[]"/> <!-- autoenable services, e.g. [admin, initialisation] services which auto enabled on start up or "all" to enable all services -->
<arg name="services" default="[]"/> <!-- comma separated list of service resource names (e.g. 'chatter_concert/chatter') -->

<node pkg="concert_service_manager" name="services" type="service_manager">
<rosparam param="concert_name" subst_value="True">$(arg concert_name)</rosparam>
<rosparam param="services" subst_value="True">$(arg services)</rosparam>
<rosparam param="auto_enable_services" subst_value="True">$(arg auto_enable_services)</rosparam>
<rosparam param="default_auto_enable_services" subst_value="True">$(arg default_auto_enable_services)</rosparam>
</node>
</launch>
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
from .service_pool import ServicePool
from .exceptions import InvalidSolutionConfigurationException, InvalidServiceProfileException
from .service_profile import ServiceProfile
from .service_cache_manager import ServiceCacheManager
from .utils import *
22 changes: 19 additions & 3 deletions concert_service_manager/src/concert_service_manager/load_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,39 @@
import yaml
import rocon_python_utils

INVALID_PARAM = ['name', 'description', 'uuid']

##############################################################################
# Methods
##############################################################################


def load_parameters_from_file(parameter_file, namespace, name, load):
filepath = rocon_python_utils.ros.find_resource_from_string(parameter_file, extension='parameters')

INVALID_PARAM = ['name', 'description', 'uuid']
with open(filepath) as f:
params = yaml.load(f)
for k, v in params.items():
if k in INVALID_PARAM:
if load:
rospy.logwarn("Service Manager : %s%s [%s]" % (str(k), ' is prohibitted parameter. Ignoring...', name))
continue
param_name = namespace + '/' + k
if load:
rospy.set_param(param_name, v)
else:
rospy.delete_param(param_name)

filepath = rocon_python_utils.ros.find_resource_from_string(parameter_file, extension='parameters')

def load_parameters_from_cache(catche_file_path, namespace, name, load):
filepath = catche_file_path

with open(filepath) as f:
params = yaml.load(f)
for k, v in params.items():
if k in INVALID_PARAM:
if load:
rospy.logwarn("Service Manager: %s%s [%s]" % (str(k), ' is prohibitted parameter. Ignoring...', name))
rospy.logwarn("Service Manager : %s%s [%s]" % (str(k), ' is prohibitted parameter. Ignoring...', name))
continue
param_name = namespace + '/' + k
if load:
Expand Down
Loading