Skip to content

Commit

Permalink
python #262: add get_topic()
Browse files Browse the repository at this point in the history
  • Loading branch information
vooon committed Apr 1, 2015
1 parent 70ef34f commit ef1b71a
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion mavros/src/mavros/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# -*- python -*-
# -*- coding: utf-8 -*-
# vim:set ts=4 sw=4 et:

__all__ = (
'get_namespace',
'set_namespace',
'get_topic'
)

# global namespace storage
_mavros_ns = "/mavros"


def get_namespace():
"""
Returns mavros node namespace
"""
global _mavros_ns
return _mavros_ns


def set_namespace(ns):
"""
Sets namespace of mavros node
"""
global _mavros_ns
_mavros_ns = ns


def get_topic(*args):
"""
Create topic name for mavros node
"""
return '/'.join((get_namespace(), ) + args)

0 comments on commit ef1b71a

Please sign in to comment.