Skip to content

Commit

Permalink
Use ament_index instead of typesupport map
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackie Kay committed Apr 15, 2016
1 parent 95fd50a commit 59fe715
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import ament_index_python
import importlib

type_support_map = {
'connext_dynamic': 'rosidl_typesupport_introspection_c',
'connext_static': 'rosidl_typesupport_connext_c',
'opensplice_static': 'rosidl_typesupport_opensplice_c',
}


class UnsupportedTypeSupport(Exception):

Expand All @@ -46,9 +41,10 @@ def import_type_support(pkg_name, subfolder, rosidl_name, rmw_implementation):
:param rmw_implementation str: name of the rmw implementation
:returns: the type support Python module for this specific rosidl and rmw implementation pair
"""
if rmw_implementation not in type_support_map.keys():
if not ament_index_python.has_resource("rmw_typesupport_c", rmw_implementation):
raise UnsupportedTypeSupport(rmw_implementation)
type_support_name = type_support_map[rmw_implementation]

type_support_name = ament_index_python.get_resource("rmw_typesupport_c", rmw_implementation)
import_package = '{pkg_name}.{subfolder}'.format(
pkg_name=pkg_name,
subfolder=subfolder,
Expand Down

0 comments on commit 59fe715

Please sign in to comment.