How to use the rospkg.common.ResourceNotFound function in rospkg

To help you get started, we’ve selected a few rospkg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github taketwo / vim-ros / plugin / rosvim / __init__.py View on Github external
def buf_init(package_name):
    try:
        p = rosp.Package(package_name)
    except rospkg.common.ResourceNotFound:
        return
    vimp.var['b:ros_package_path'] = p.path
    vimp.var['b:ros_package_name'] = p.name
    if p.name not in packages:
        packages[p.name] = p
    ft.init()
github ros-infrastructure / rosdoc_lite / src / rosdoc_lite / __init__.py View on Github external
print("Please give %s exactly one package path" % NAME)
        parser.print_help()
        sys.exit(1)

    rp = rospkg.RosPack()
    path = os.path.realpath(args[0])
    package = os.path.basename(path)

    #Check whether we've got a catkin or non-catkin package
    if is_catkin(path):
        pkg_desc = packages.parse_package(path)
        print("Documenting a catkin package")
    else:
        try:
            ros_path = os.path.realpath(rp.get_path(package))
        except rospkg.common.ResourceNotFound as e:
            sys.stderr.write("Rospack could not find the %s. Are you sure it's on your ROS_PACKAGE_PATH?\n" % package)
            sys.exit(1)
        if (not is_fuerte_catkin(path)) and ros_path != path:
            sys.stderr.write("The path passed in does not match that returned \
                             by rospack. Requested path: %s. Rospack path: %s.\n" % (path, ros_path))
            sys.exit(1)
        pkg_desc = rp.get_manifest(package)
        print("Documenting a non-catkin package")

    manifest = rdcore.PackageInformation(pkg_desc)
    print("Documenting %s located here: %s" % (package, path))

    try:
        generate_docs(path, package, manifest, options.docdir, options.tagfile, options.generate_tagfile, options.quiet)
        print("Done documenting %s you can find your documentation here: %s" % (package, os.path.realpath(options.docdir)))
    except:
github cbfinn / gps / python / gps / gui / image_visualizer.py View on Github external
from gps.gui.action_panel import Action, ActionPanel

import logging
LOGGER = logging.getLogger(__name__)
ROS_ENABLED = False
try:
    import rospkg
    import roslib
    import rospy
    from sensor_msgs.msg import Image

    roslib.load_manifest('gps_agent_pkg')
    ROS_ENABLED = True
except ImportError as e:
    LOGGER.debug('Import ROS failed: %s', e)
except rospkg.common.ResourceNotFound as e:
    LOGGER.debug('No gps_agent_pkg: %s', e)


class ImageVisualizer(object):

    def __init__(self, fig, gs, cropsize=None, rostopic=None, show_overlay_buttons=False):
        """
        If rostopic is given to this constructor, then the image visualizer will 
        automatically update with rostopic image. Else, the update method must 
        be manually called to supply images.
        """
        # Real-time image
        self._t = 0
        self._current_image = None
        self._crop_size = cropsize
github alexlee-gk / visual_dynamics / visual_dynamics / gui / image_visualizer.py View on Github external
from visual_dynamics.gui import Action, ActionPanel

LOGGER = logging.getLogger(__name__)
ROS_ENABLED = False
try:
    import rospkg
    import roslib
    import rospy
    from sensor_msgs.msg import Image

    roslib.load_manifest('gps_agent_pkg')
    ROS_ENABLED = True
except ImportError as e:
    LOGGER.debug('Import ROS failed: %s', e)
except rospkg.common.ResourceNotFound as e:
    LOGGER.debug('No gps_agent_pkg: %s', e)


class ImageVisualizer(object):

    def __init__(self, fig, gs, cropsize=None, rostopic=None, show_overlay_buttons=False):
        """
        If rostopic is given to this constructor, then the image visualizer will 
        automatically update with rostopic image. Else, the update method must 
        be manually called to supply images.
        """
        # Real-time image
        self._t = 0
        self._current_image = None
        self._crop_size = cropsize
github MPC-Berkeley / barc / workspace / src / rqt_common_plugins / rqt_launch / src / rqt_launch / launch_widget.py View on Github external
        @rtype: ROSLaunchConfig
        @raises RLException: raised by roslaunch.config.load_config_default.
        '''

        pkg_name = self._combobox_pkg.currentText()

        try:
            launchfile = os.path.join(self._rospack.get_path(pkg_name),
                                      folder_name_launchfile, launchfile_name)
        except IndexError as e:
            raise RLException('IndexError: {}'.format(e.message))

        try:
            launch_config = roslaunch.config.load_config_default([launchfile],
                                                                 port_roscore)
        except rospkg.common.ResourceNotFound as e:
            raise RLException('ResourceNotFound: {}'.format(e.message))
        except RLException as e:
            raise e

        return launch_config
github CopterExpress / clever-show / drone / client.py View on Github external
def check_clover_dir(self):
        rospack = rospkg.RosPack()
        try:
            path = rospack.get_path('clever')
        except rospkg.common.ResourceNotFound:
            try:
                path = rospack.get_path('clover')
            except rospkg.common.ResourceNotFound:
                path = 'error'
        self.config.set('', 'clover_dir', path, write=True)
github cbfinn / gps / python / gps / gui / target_setup_gui.py View on Github external
save_pose_to_npz, save_data_to_npz

from gps.proto.gps_pb2 import END_EFFECTOR_POSITIONS, END_EFFECTOR_ROTATIONS, \
        JOINT_ANGLES, JOINT_SPACE

import logging
LOGGER = logging.getLogger(__name__)
ROS_ENABLED = False
try:
    import rospkg
    from gps.agent.ros.ros_utils import TimeoutException

    ROS_ENABLED = True
except ImportError as e:
    LOGGER.debug('Import ROS failed: %s', e)
except rospkg.common.ResourceNotFound as e:
    LOGGER.debug('No gps_agent_pkg: %s', e)


class TargetSetupGUI(object):

    def __init__(self, hyperparams, agent):
        self._hyperparams = hyperparams
        self._agent = agent

        self._log_filename = self._hyperparams['log_filename']
        self._target_filename = self._hyperparams['target_filename']

        self._num_targets = config['num_targets']
        self._actuator_types = config['actuator_types']
        self._actuator_names = config['actuator_names']
        self._num_actuators = len(self._actuator_types)
github cbfinn / gps / python / gps / gui / action_panel.py View on Github external
from gps.gui.config import config

import logging
LOGGER = logging.getLogger(__name__)
ROS_ENABLED = False
try:
    import rospkg
    import roslib
    import rospy
    from sensor_msgs.msg import Joy

    roslib.load_manifest('gps_agent_pkg')
    ROS_ENABLED = True
except ImportError as e:
    LOGGER.debug('Import ROS failed: %s', e)
except rospkg.common.ResourceNotFound as e:
    LOGGER.debug('No gps_agent_pkg: %s', e)


class Action:
    """
    An action is defined by a key (used to identify it), a name, and a function.
    It is called by placing it on an matplotlib Axis object (as specified by
    axis_pos), giving it a keyboard_binding, or giving it a ps3_binding.
    """
    def __init__(self, key, name, func, axis_pos=None, keyboard_binding=None, ps3_binding=None):
        self.key = key
        self.name = name
        self.func = func
        self.axis_pos = axis_pos
        self.kb = keyboard_binding
        self.pb = ps3_binding
github alexlee-gk / visual_dynamics / visual_dynamics / gui / target_setup_gui.py View on Github external
save_pose_to_npz, save_data_to_npz

from gps.proto.gps_pb2 import END_EFFECTOR_POSITIONS, END_EFFECTOR_ROTATIONS, \
        JOINT_ANGLES, JOINT_SPACE

import logging
LOGGER = logging.getLogger(__name__)
ROS_ENABLED = False
try:
    import rospkg
    from gps.agent.ros.ros_utils import TimeoutException

    ROS_ENABLED = True
except ImportError as e:
    LOGGER.debug('Import ROS failed: %s', e)
except rospkg.common.ResourceNotFound as e:
    LOGGER.debug('No gps_agent_pkg: %s', e)


class TargetSetupGUI(object):

    def __init__(self, hyperparams, agent):
        self._hyperparams = hyperparams
        self._agent = agent

        self._log_filename = self._hyperparams['log_filename']
        self._target_filename = self._hyperparams['target_filename']

        self._num_targets = config['num_targets']
        self._actuator_types = config['actuator_types']
        self._actuator_names = config['actuator_names']
        self._num_actuators = len(self._actuator_types)
github ct2034 / dockeROS / src / dockeros / image.py View on Github external
self.roscommand = roscommand[:]
            self.rospackage = roscommand[1]
        else:
            raise NotImplementedError(
                'The ros command >' + roscommand[0] + '< is currently not supported.'
            )

        # Where is the package?
        rp = rospkg.RosPack()
        logging.debug("The config is:\n"+json.dumps(config, indent=2))
        self.dockeros_path = rp.get_path('dockeros')

        self.path = None
        try:
            self.path = rp.get_path(self.rospackage)
        except rospkg.common.ResourceNotFound as e:
            try:
                self.check_rosdep()
                logging.info('This is a system package to be installed from:\n> ' + self.deb_package)
            except:
                logging.info('Can not find package: ' + self.rospackage)
            self.user_package = False

        if self.path: # on system
            if self.path.startswith('/opt/ros'):
                self.check_rosdep()
                logging.info('This is a system package to be installed from:\n> ' + self.deb_package)
                self.user_package = False
            else:
                logging.info('This is a user package at:\n> ' + self.path)
                self.user_package = True