42 from generate_moveit_config
import generate_fake_controllers, generate_real_controllers, \
43 generate_ompl_planning, generate_kinematics, generate_joint_limits
44 import generate_robot_srdf
46 if __name__ ==
'__main__':
52 robot_config_file = sys.argv[2]
53 rospy.init_node(
'moveit_config_generator', anonymous=
True)
54 if command
in [
'fake_controllers',
'real_controllers',
'ompl_planning',
'kinematics',
'joint_limits']:
55 NS = rospy.get_namespace()
57 while (
not rospy.search_param(
'robot_description_semantic')
and not rospy.is_shutdown()):
59 rospy.loginfo(
"waiting for robot_description_semantic")
61 full_param_name = rospy.search_param(
'robot_description_semantic')
62 srdf_str = rospy.get_param(full_param_name)
64 robot = SRDF.from_xml_string(srdf_str)
66 sh_config_path = rospkg.RosPack().get_path(
'sr_moveit_hand_config') +
"/config/" 68 with open(robot_config_file,
"r") as stream: 69 yamldoc = yaml.load(stream) 71 robot_config.set_parameters(yamldoc) 74 if command ==
"fake_controllers":
76 output_path = (rospkg.RosPack().get_path(
'sr_multi_moveit_config') +
"/config/" +
77 "fake_controllers.yaml")
79 elif command ==
"real_controllers":
81 output_path = rospkg.RosPack().get_path(
'sr_multi_moveit_config') +
"/config/" +
"controllers.yaml" 83 elif command ==
"ompl_planning":
84 hand_template_path = sh_config_path +
"ompl_planning_template.yaml" 86 output_path = (rospkg.RosPack().get_path(
'sr_multi_moveit_config') +
"/config/" +
89 elif command ==
"kinematics":
91 hand_template_path = sys.argv[3]
92 if (hand_template_path.startswith(
"_")
or hand_template_path.startswith(
"--")):
93 hand_template_path =
None 95 output_path = (rospkg.RosPack().get_path(
'sr_multi_moveit_config') +
"/config/" +
"kinematics.yaml")
96 generate_kinematics(robot, robot_config, hand_template_path, output_path=output_path, ns_=NS)
97 elif command ==
"joint_limits":
98 hand_template_path = sh_config_path +
"joint_limits_template.yaml" 100 output_path = (rospkg.RosPack().get_path(
'sr_multi_moveit_config') +
"/config/" +
104 rospy.logerr(
"Wrong argument " + command)
106 rospy.loginfo(
"Successfully loaded " + command +
" params")
108 rospy.logerr(
"Unrecognized command " + command +
109 ". Choose among fake_controllers, ompl_planning, kinematics, joint_limits")
111 rospy.logerr(
"Argument needed. Choose among fake_controllers, ompl_planning, kinematics, joint_limits")
def generate_kinematics(robot, robot_config, hand_template_path="kinematics_template.yaml", output_path=None, ns_=None)
def generate_ompl_planning(robot, robot_config, hand_template_path="ompl_planning_template.yaml", output_path=None, ns_=None)
def generate_real_controllers(robot, robot_config, output_path=None, ns_=None)
def generate_fake_controllers(robot, robot_config, output_path=None, ns_=None)
def generate_joint_limits(robot, robot_config, hand_template_path="joint_limits_template.yaml", output_path=None, ns_=None)