def get_launch_path(name=''): """ Return the path to the launch directory or, if `name' is not empty, to the given *Start.sh/*Stop.sh file. Takes into account that when running on a development machine the package can be found installed from debians or in the current workspace, this last one having preference. """ assert_relative_path(name) if pal_environ.is_desktop(): base = os.path.join(rospkg.RosPack().get_path('pal_startup_base'), 'scripts') # We check if there is not a scripts directory, in that case # pal_startup_base is installed from our debians and we need to # use a slightly different path if not os.path.exists(base): base = rospkg.RosPack().get_path('pal_startup_base') # The path we get from RosPack is: # /opt/pal/cobalt/share/pal_startup_base/launch/*.sh # But the actual executable files are here: # /opt/pal/cobalt/bin/pal_startup_base/launch/*.sh # So we replace that part of the path base = base.replace('/share/', '/bin/') else: base = os.path.join(get_base_path(), 'bin/pal_startup_base') return os.path.join(base, 'launch', name)
def get_base_path(): """ Return the path to the root directory. This is /mnt_flash on the robot and ~/svn (or the aprorpiate branch) on a desktop. """ if pal_environ.is_desktop(): return os.path.join(os.path.expanduser('~/'), os.environ.get('PAL_BRANCH')) else: return '/mnt_flash'
def get_launch_path(name=''): """ Return the path to the launch directory or, if `name' is not empty, to the given *Start.sh/*Stop.sh file. """ assert_relative_path(name) base = get_base_path() if pal_environ.is_desktop(): base = os.path.join(base, 'robot/sources') return os.path.join(base, 'bin/launch', name)
def get_bin_path(name=''): """ Return the path to the bin/ directory or, if `name' is not empty, to the given executable file. This can be used for launching binaries that are still in the robot/ directory. """ assert_relative_path(name) base = get_base_path() if pal_environ.is_desktop(): base = os.path.join(base, 'robot/local/output') return os.path.join(base, 'bin', name)
def get_config_path(name=''): """ Return the path to the configuration directory ("etc") or, if `name' is not empty, the given configuration subdirectory or file. If running on a desktop, the path depends on the $PAL_HOST environment variable. """ assert_relative_path(name) path = get_base_path() if pal_environ.is_desktop(): path = os.path.join(path, 'robot/sources/etc', pal_environ.get_robot()) else: path = os.path.join(path, 'etc') return os.path.join(path, name)