-
Notifications
You must be signed in to change notification settings - Fork 702
Simultaneous trajectory execution #733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cambel
wants to merge
3
commits into
moveit:master
Choose a base branch
from
cambel:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
add_executable(simultaneous_trajectory_execution_tutorial src/simultaneous_trajectory_execution_tutorial.cpp) | ||
target_link_libraries(simultaneous_trajectory_execution_tutorial ${catkin_LIBRARIES}) | ||
install(TARGETS simultaneous_trajectory_execution_tutorial DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) | ||
|
||
install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) |
Binary file added
BIN
+409 KB
doc/simultaneous_trajectory_execution/images/simultaneous-execution-rviz.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
...imultaneous_trajectory_execution/launch/simultaneous_trajectory_execution_tutorial.launch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<launch> | ||
|
||
<node name="simultaneous_trajectory_execution_tutorial" | ||
pkg="moveit_tutorials" | ||
type="simultaneous_trajectory_execution_tutorial" | ||
respawn="false" | ||
output="screen"> | ||
</node> | ||
|
||
</launch> |
46 changes: 46 additions & 0 deletions
46
...imultaneous_trajectory_execution/simultaneous_trajectory_execution_tutorial.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Simultaneous Trajectory Execution | ||
================================== | ||
|
||
Introduction | ||
------------ | ||
MoveIt allows simultaneous execution of trajectories, as long as each trajectory uses a different set of controllers. For example, in a dual arm environment, each arm can execute a different set of trajectories without needing to wait for the other arm to finish moving or manually synchronizing the motion of both arm into a single trajectory. Optionally, a collision check is performed right before execution of new trajectories to prevent collisions with active trajectories. | ||
|
||
|
||
The following GIF shows a simple example of simultaneous execution of trajectories through the **Rviz Motion Planning** plugin. | ||
|
||
.. figure:: images/simultaneous-execution-rviz.gif | ||
|
||
This tutorial presents how to use the Simultaneous Trajectory Execution feature through the `Move Group C++ Interface <../move_group_interface/move_group_interface_tutorial.html>`_ but it can be similarly used through the `Move Group Python Interface <../move_group_python_interface/move_group_python_interface_tutorial.html>`_ or `MoveIt Cpp <../moveit_cpp/moveitcpp_tutorial.html>`_. | ||
|
||
Getting Started | ||
--------------- | ||
If you haven't already done so, make sure you've completed the steps in `Getting Started <../getting_started/getting_started.html>`_. | ||
|
||
(Optional) Setup | ||
--------------- | ||
The simultaneous execution feature is active by default. However, through the following dynamic reconfigure parameter, it can be disabled, **/move_group/trajectory_execution/enable_simultaneous_execution**. | ||
Similarly, an extra layer of collision checking, performed right before execution of trajectories has been added to the `TrajectoryExecutionManager`, which can also be disabled through the dynamic reconfigure parameter **/move_group/trajectory_execution/enable_collision_checking**. | ||
|
||
Running the code | ||
---------------- | ||
Open two shells. In the first shell start RViz and wait for everything to finish loading: :: | ||
|
||
roslaunch moveit_resources_dual_panda_moveit_config demo.launch | ||
|
||
In the second shell, run the launch file for this demo: :: | ||
|
||
roslaunch moveit_tutorials simultaneous_trajectory_execution_tutorial.launch | ||
|
||
Expected Output | ||
--------------- | ||
In a robotic environment with two Franka Panda robot arms, two different trajectories are planned, one for each robot arm. Then both trajectory are simultaneously executed. | ||
|
||
The entire code | ||
--------------- | ||
The entire code can be seen :codedir:`here in the MoveIt GitHub project<simultaneous_trajectory_execution>`. | ||
|
||
.. tutorial-formatter:: ./src/simultaneous_trajectory_execution_tutorial.cpp | ||
|
||
The launch file | ||
--------------- | ||
The entire launch file is :codedir:`here <simultaneous_trajectory_execution/launch/simultaneous_trajectory_execution_tutorial.launch>` on GitHub. All the code in this tutorial can be compiled and run from the moveit_tutorials package. |
87 changes: 87 additions & 0 deletions
87
doc/simultaneous_trajectory_execution/src/simultaneous_trajectory_execution_tutorial.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* Author: Cristian C. Beltran-Hernandez */ | ||
|
||
#include <ros/ros.h> | ||
|
||
#include <memory> | ||
|
||
#include <geometry_msgs/PointStamped.h> | ||
#include <moveit/move_group_interface/move_group_interface.h> | ||
#include <stdlib.h> | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
ros::init(argc, argv, "simultaneous_trajectory_execution_move_group"); | ||
|
||
// ROS spinning must be running for the MoveGroupInterface to get information | ||
// about the robot's state. One way to do this is to start an AsyncSpinner | ||
// beforehand. | ||
ros::AsyncSpinner spinner(1); | ||
spinner.start(); | ||
|
||
// BEGIN_TUTORIAL | ||
// | ||
// Setup | ||
// ^^^^^ | ||
// Let's start by creating planning groups for each robot arm. | ||
// The panda dual arm environment has two planning groups defined as `panda_1` and `panda_2` | ||
moveit::planning_interface::MoveGroupInterface panda_1_group("panda_1"); | ||
moveit::planning_interface::MoveGroupInterface panda_2_group("panda_2"); | ||
|
||
// Now, let's define a target pose for `panda_1` | ||
geometry_msgs::PoseStamped panda_1_target_pose; | ||
panda_1_target_pose.header.frame_id = "base"; | ||
panda_1_target_pose.pose.position.x = 0.450; | ||
panda_1_target_pose.pose.position.y = -0.50; | ||
panda_1_target_pose.pose.position.z = 1.600; | ||
panda_1_target_pose.pose.orientation.x = 0.993436; | ||
panda_1_target_pose.pose.orientation.y = 3.5161e-05; | ||
panda_1_target_pose.pose.orientation.z = 0.114386; | ||
panda_1_target_pose.pose.orientation.w = 2.77577e-05; | ||
|
||
// And one for `panda_2` | ||
geometry_msgs::PoseStamped panda_2_target_pose; | ||
panda_2_target_pose.header.frame_id = "base"; | ||
panda_2_target_pose.pose.position.x = 0.450; | ||
panda_2_target_pose.pose.position.y = 0.40; | ||
panda_2_target_pose.pose.position.z = 1.600; | ||
panda_2_target_pose.pose.orientation.x = 0.993434; | ||
panda_2_target_pose.pose.orientation.y = -7.54803e-06; | ||
panda_2_target_pose.pose.orientation.z = 0.114403; | ||
panda_2_target_pose.pose.orientation.w = 3.67256e-05; | ||
|
||
// Planning | ||
// ^^^^^^^^ | ||
// Let's plan a trajectory for `panda_1` using the previously defined target pose. | ||
panda_1_group.clearPoseTargets(); | ||
panda_1_group.setStartStateToCurrentState(); | ||
panda_1_group.setPoseTarget(panda_1_target_pose); | ||
|
||
moveit::planning_interface::MoveGroupInterface::Plan panda_1_plan; | ||
bool success1 = (panda_1_group.plan(panda_1_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS); | ||
if (!success1) | ||
{ | ||
ROS_INFO("Plan with Panda 1 did not succeeded"); | ||
} | ||
|
||
// Same for `panda_2`. | ||
panda_2_group.clearPoseTargets(); | ||
panda_2_group.setStartStateToCurrentState(); | ||
panda_2_group.setPoseTarget(panda_2_target_pose); | ||
|
||
moveit::planning_interface::MoveGroupInterface::Plan panda_2_plan; | ||
bool success2 = (panda_2_group.plan(panda_2_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS); | ||
if (!success2) | ||
{ | ||
ROS_INFO("Plan with Panda 2 did not succeeded"); | ||
} | ||
|
||
// Simultaneous Execution | ||
// ^^^^^^^^^^^^^^^^^^^^^^ | ||
// Finally, let's execute both plans asynchronously to have them run simultaneously. | ||
panda_1_group.asyncExecute(panda_1_plan); | ||
panda_2_group.asyncExecute(panda_2_plan); | ||
// END_TUTORIAL | ||
|
||
ros::shutdown(); | ||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.