Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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()