def loader(): rospy.init_node('urdf_loader', anonymous=True) print("Parsing xacro: ", sys.argv[1]) sys.argv.insert(1, "--inorder") sys.stdout = xacro_out = StringIO() xacro.main() sys.stdout = sys.__stdout__ # print(xacro_out.getvalue()) rospy.set_param('robot_description', xacro_out.getvalue()) rospy.spin()
# this script is just for backwards compatibility. the roslaunch $(find ...) # expects the script to be in the package directory, and in catkin # the package direcory is the share directory. going forward, we should # transition to scripts/xacro from __future__ import print_function # Guard against self import import os import sys backup_path = list(sys.path) this_dir = os.path.dirname(__file__) # Use os.getcwd() to avoid weird symbolic link problems cur_dir = os.getcwd() os.chdir(this_dir) this_dir_cwd = os.getcwd() os.chdir(cur_dir) # Remove this dir from path sys.path = [a for a in sys.path if a not in [this_dir, this_dir_cwd]] import xacro from xacro.color import warning # Restore the path sys.path = backup_path xacro.main() # issue deprecation warning warning('xacro.py is deprecated; please use xacro instead')
# this script is just for backwards compatibility. the roslaunch $(find ...) # expects the script to be in the package directory, and in catkin # the package direcory is the share directory. going forward, we should # transition to scripts/xacro from __future__ import print_function # Guard against self import import os import sys backup_path = list(sys.path) this_dir = os.path.dirname(__file__) # Use os.getcwd() to avoid weird symbolic link problems cur_dir = os.getcwd() os.chdir(this_dir) this_dir_cwd = os.getcwd() os.chdir(cur_dir) # Remove this dir from path sys.path = filter(lambda a: a not in [this_dir, this_dir_cwd], sys.path) import xacro from xacro.color import warning # Restore the path sys.path = backup_path xacro.main() # issue deprecation warning warning('xacro.py is deprecated; please use xacro instead')