|
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> |
| 2 | +<root BTCPP_format="4" main_tree_to_execute="Grind part with MTC"> |
| 3 | + <!--//////////--> |
| 4 | + <BehaviorTree ID="Grind part with MTC" _description="" _favorite="false"> |
| 5 | + <Control ID="Sequence" name="TopLevelSequence"> |
| 6 | + <Action ID="ClearSnapshot" /> |
| 7 | + <!--View workspace and register part--> |
| 8 | + <SubTree |
| 9 | + ID="Move to Waypoint" |
| 10 | + _collapsed="true" |
| 11 | + acceleration_scale_factor="1.0" |
| 12 | + controller_action_server="/joint_trajectory_controller/follow_joint_trajectory" |
| 13 | + controller_names="joint_trajectory_controller" |
| 14 | + joint_group_name="manipulator" |
| 15 | + keep_orientation="false" |
| 16 | + keep_orientation_tolerance="0.05" |
| 17 | + link_padding="0.01" |
| 18 | + velocity_scale_factor="1.0" |
| 19 | + waypoint_name="Retract" |
| 20 | + name="View Workspace" |
| 21 | + seed="0" |
| 22 | + /> |
| 23 | + <SubTree |
| 24 | + ID="Register Machined Part" |
| 25 | + _collapsed="true" |
| 26 | + registered_pose="{registered_pose}" |
| 27 | + /> |
| 28 | + <SubTree ID="Take Snapshot" _collapsed="true" /> |
| 29 | + <!--Publish frame of registered part so we can plan in reference to it--> |
| 30 | + <Control ID="Fallback"> |
| 31 | + <Decorator ID="Timeout" msec="500"> |
| 32 | + <Action |
| 33 | + ID="PublishStaticFrame" |
| 34 | + pose="{registered_pose}" |
| 35 | + publish_rate="50" |
| 36 | + child_frame_id="registered_pose" |
| 37 | + /> |
| 38 | + </Decorator> |
| 39 | + <Action ID="AlwaysSuccess" /> |
| 40 | + </Control> |
| 41 | + <!--Move the tool to a pose near the part--> |
| 42 | + <SubTree |
| 43 | + ID="Move to Waypoint" |
| 44 | + _collapsed="true" |
| 45 | + acceleration_scale_factor="1.0" |
| 46 | + controller_action_server="/joint_trajectory_controller/follow_joint_trajectory" |
| 47 | + controller_names="joint_trajectory_controller" |
| 48 | + joint_group_name="manipulator" |
| 49 | + keep_orientation="false" |
| 50 | + keep_orientation_tolerance="0.05" |
| 51 | + link_padding="0.01" |
| 52 | + velocity_scale_factor="1.0" |
| 53 | + waypoint_name="Pre Grind" |
| 54 | + seed="0" |
| 55 | + /> |
| 56 | + <!--Load grinding poses--> |
| 57 | + <Action |
| 58 | + ID="LoadPoseStampedVectorFromYaml" |
| 59 | + output="{grinding_poses}" |
| 60 | + file_path="grinding_poses.yaml" |
| 61 | + /> |
| 62 | + <!--Visualize grinding poses--> |
| 63 | + <Action ID="Script" code="pose_count := 0" /> |
| 64 | + <Decorator |
| 65 | + ID="ForEach" |
| 66 | + vector_in="{grinding_poses}" |
| 67 | + out="{target_pose}" |
| 68 | + index="{index}" |
| 69 | + > |
| 70 | + <Control ID="Sequence"> |
| 71 | + <Action |
| 72 | + ID="VisualizePose" |
| 73 | + marker_name="{pose_count}" |
| 74 | + pose="{target_pose}" |
| 75 | + marker_lifetime="0.000000" |
| 76 | + marker_size="0.100000" |
| 77 | + /> |
| 78 | + <Action ID="Script" code="pose_count += 1" /> |
| 79 | + </Control> |
| 80 | + </Decorator> |
| 81 | + <!--Setup an MTC task from the current robot state--> |
| 82 | + <Action |
| 83 | + ID="InitializeMTCTask" |
| 84 | + task="{mtc_task}" |
| 85 | + timeout="-1.000000" |
| 86 | + trajectory_monitoring="false" |
| 87 | + /> |
| 88 | + <Action ID="SetupMTCCurrentState" task="{mtc_task}" /> |
| 89 | + <!-- Pass each of the grinding poses to the MTC task, and plan cartesian motions between them --> |
| 90 | + <Action |
| 91 | + ID="SetupMTCPathIK" |
| 92 | + acceleration_scale_factor="0.75" |
| 93 | + blending_radius="0.020000" |
| 94 | + ignore_environment_collisions="false" |
| 95 | + ik_cartesian_space_density="0.010000" |
| 96 | + ik_joint_space_density="0.100000" |
| 97 | + max_optimizer_iterations="1" |
| 98 | + path="{grinding_poses}" |
| 99 | + planning_group_name="manipulator" |
| 100 | + position_only="true" |
| 101 | + task="{mtc_task}" |
| 102 | + trajectory_sampling_rate="100" |
| 103 | + velocity_scale_factor="0.1" |
| 104 | + tip_links="grasp_link" |
| 105 | + /> |
| 106 | + <!--Wait for user to approve the grinding path and then execute it--> |
| 107 | + <Action ID="PlanMTCTask" solution="{mtc_solution}" task="{mtc_task}" /> |
| 108 | + <Action |
| 109 | + ID="WaitForUserTrajectoryApproval" |
| 110 | + solution="{mtc_solution}" |
| 111 | + cartesian_path_links="grasp_link" |
| 112 | + /> |
| 113 | + <Action |
| 114 | + ID="SwitchController" |
| 115 | + activate_asap="true" |
| 116 | + automatic_deactivation="true" |
| 117 | + controller_list_action_name="/controller_manager/list_controllers" |
| 118 | + controller_switch_action_name="/controller_manager/switch_controller" |
| 119 | + strictness="1" |
| 120 | + timeout="-1.000000" |
| 121 | + activate_controllers="{controller_name}" |
| 122 | + /> |
| 123 | + <Action |
| 124 | + ID="ExecuteMTCSolution" |
| 125 | + admittance_parameters_msg="{admittance_parameters_msg}" |
| 126 | + apply_planning_scene_service="/apply_planning_scene" |
| 127 | + apply_start_scene="false" |
| 128 | + controller_action_name="{controller_action_name}" |
| 129 | + execution_pipeline="{controller_type}" |
| 130 | + goal_duration_tolerance="-1.000000" |
| 131 | + goal_position_tolerance="0.01" |
| 132 | + path_position_tolerance="0.05" |
| 133 | + solution="{mtc_solution}" |
| 134 | + /> |
| 135 | + <!--Move away from the part after completing the grinding path--> |
| 136 | + <SubTree |
| 137 | + ID="Move to Waypoint" |
| 138 | + _collapsed="true" |
| 139 | + acceleration_scale_factor="1.0" |
| 140 | + controller_action_server="/joint_trajectory_controller/follow_joint_trajectory" |
| 141 | + controller_names="joint_trajectory_controller" |
| 142 | + joint_group_name="manipulator" |
| 143 | + keep_orientation="false" |
| 144 | + keep_orientation_tolerance="0.05" |
| 145 | + link_padding="0.01" |
| 146 | + velocity_scale_factor="1.0" |
| 147 | + waypoint_name="Approach" |
| 148 | + seed="0" |
| 149 | + /> |
| 150 | + </Control> |
| 151 | + </BehaviorTree> |
| 152 | + <TreeNodesModel> |
| 153 | + <SubTree ID="Grind part with MTC"> |
| 154 | + <MetadataFields> |
| 155 | + <Metadata runnable="false" /> |
| 156 | + <Metadata subcategory="Application - Grinding" /> |
| 157 | + </MetadataFields> |
| 158 | + <inout_port |
| 159 | + name="controller_action_name" |
| 160 | + default="/joint_trajectory_admittance_controller/follow_joint_trajectory" |
| 161 | + type="std::string" |
| 162 | + > |
| 163 | + the topic to send the follow joint trajectory action |
| 164 | + </inout_port> |
| 165 | + <inout_port |
| 166 | + name="controller_name" |
| 167 | + default="joint_trajectory_admittance_controller" |
| 168 | + type="std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >" |
| 169 | + > |
| 170 | + the name of the controller to activate for motion |
| 171 | + </inout_port> |
| 172 | + <inout_port name="controller_type" default="jtac" type="std::string"> |
| 173 | + The type of trajectory controller to use |
| 174 | + </inout_port> |
| 175 | + </SubTree> |
| 176 | + </TreeNodesModel> |
| 177 | +</root> |
0 commit comments