How to use the rospkg.distro.current_distro_codename 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 fkie / multimaster_fkie / default_cfg_fkie / src / default_cfg_fkie / default_cfg.py View on Github external
def get_ros_home(self):
        '''
        Returns the ROS HOME path depending on ROS distribution API.
        @return: ROS HOME path
        @rtype: C{str}
        '''
        try:
            import rospkg.distro
            distro = rospkg.distro.current_distro_codename()
            if distro in ['electric', 'diamondback', 'cturtle']:
                import roslib.rosenv
                return roslib.rosenv.get_ros_home()
            else:
                import rospkg
                return rospkg.get_ros_home()
        except:
            import traceback
            print traceback.format_exc()
            import roslib.rosenv
            return roslib.rosenv.get_ros_home()