Saving, Loading, and Executing a Robot Trajectory using YAML Files
Saving, Loading, and Executing a Robot Trajectory using YAML Files
To see these behaviors in action, start MoveIt Pro using moveit_pro run -c lab_sim
and run the Record and Replay Scanning Motion
objective.
Any trajectory_msgs::msg::JointTrajectory message available on the blackboard can be saved to a YAML file using the SaveJointTrajectoryToYaml
behavior.
The YAML file can be copied or modified and then loaded on to the blackboard using the LoadJointTrajectoryFromYaml
behavior.
Once the JointTrajectory is available, the ValidateTrajectory
behavior can be used to ensure the path is collision free, and the ExecuteFollowJointTrajectory
behavior will execute the trajectory using a joint_trajectory_controller.
Planning and Saving with MoveIt Task Constructor
MoveIt Task Constructor (MTC) can be used to assemble a complex series of tasks in to a single motion planning pipeline.
When the PlanMtcTask
behavior is used, the resulting MTC solution is available on the blackboard.
To convert an MTC solution to a JointTrajectory, the ConvertMtcSolutionToJointTrajectory
will extract joint states and time parametrize the trajectory using Time-Optimal Trajectory Generation (TOTG).
The resulting trajectory can then be saved using SaveJointTrajectoryToYaml
, which allows for pre-planning complex motions and executing them at runtime without planning time delays.