34 generate and load one the following moveit yaml config file 35 based on srdf on parameter server 36 syntax : generate_load_moveit_config command [template_file] 37 fake_controllers (no template) 38 ompl_planning (template required) 39 kinematics (template required) 40 joint_limits (template required) 51 from generate_moveit_config
import generate_fake_controllers, generate_real_controllers, \
52 generate_ompl_planning, generate_kinematics, generate_joint_limits
54 if __name__ ==
'__main__':
60 rospy.init_node(
'moveit_config_generator', anonymous=
True)
61 if command
in [
'fake_controllers',
'real_controllers',
'ompl_planning',
'kinematics',
'joint_limits']:
62 NS = rospy.get_namespace()
64 while (
not rospy.search_param(
'robot_description_semantic')
and not rospy.is_shutdown()):
66 rospy.loginfo(
"waiting for robot_description_semantic")
68 full_param_name = rospy.search_param(
'robot_description_semantic')
69 srdf_str = rospy.get_param(full_param_name)
71 robot = SRDF.from_xml_string(srdf_str)
74 if command ==
"fake_controllers":
76 output_path = (rospkg.RosPack().get_path(
'sr_moveit_hand_config') +
"/config/" +
77 "fake_controllers.yaml")
79 elif command ==
"real_controllers":
81 output_path = (rospkg.RosPack().get_path(
'sr_moveit_hand_config') +
"/config/" +
84 elif command ==
"ompl_planning":
87 template_path = sys.argv[2]
89 if (template_path.startswith(
"_")
or template_path.startswith(
"--")):
92 output_path = (rospkg.RosPack().get_path(
'sr_moveit_hand_config') +
"/config/" +
96 rospy.logerr(
"ompl_planning generation requires a template file, none provided")
98 elif command ==
"kinematics":
100 if len(sys.argv) > 2:
101 template_path = sys.argv[2]
102 if (template_path.startswith(
"_")
or template_path.startswith(
"--")):
105 output_path = (rospkg.RosPack().get_path(
'sr_moveit_hand_config') +
"/config/" +
109 rospy.logerr(
"kinematics generation requires a template file, none provided")
111 elif command ==
"joint_limits":
113 if len(sys.argv) > 2:
114 template_path = sys.argv[2]
115 if (template_path.startswith(
"_")
or template_path.startswith(
"--")):
118 output_path = (rospkg.RosPack().get_path(
'sr_moveit_hand_config') +
"/config/" +
122 rospy.logerr(
"joint_limits generation requires a template file, none provided")
124 rospy.logerr(
"Wrong argument " + command)
126 rospy.loginfo(
"Successfully loaded " + command +
" params")
128 rospy.logerr(
"Unrecognized command " + command +
129 ". Choose among fake_controllers, real_controllers, ompl_planning, kinematics, joint_limits")
131 rospy.logerr(
"Argument needed. Choose among fake_controllers, ompl_planning, kinematics, joint_limits")
def generate_real_controllers(robot, output_path=None, ns_=None)
def generate_ompl_planning(robot, template_path="ompl_planning_template.yaml", output_path=None, ns_=None)
def generate_kinematics(robot, template_path="kinematics_template.yaml", output_path=None, ns_=None)
def generate_fake_controllers(robot, output_path=None, ns_=None)
def generate_joint_limits(robot, template_path="joint_limits_template.yaml", output_path=None, ns_=None)