-
Notifications
You must be signed in to change notification settings - Fork 151
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
[WIP] Add pick-place capability #266
Open
karolyartur
wants to merge
23
commits into
moveit:master
Choose a base branch
from
karolyartur:pick_place_capability
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
23 commits
Select commit
Hold shift + click to select a range
ad6eb48
Add action message template
henningkayser 30079e1
Add PickPlaceTask to core package
henningkayser 638a253
Create empty plan_pick_place_capability
henningkayser 52d8d21
Add parameter struct
henningkayser 733401c
Add GraspProvider and PlaceProvider plugins
karolyartur 2f4fb16
Update pickplace container
karolyartur 59c6514
Update capability
karolyartur ffd8036
Fix build errors (comment out test)
felixvd dde84e6
Typo, formatting
felixvd 27acd22
Fix linker error
felixvd 2e8d588
Add note about action definition
felixvd c71ab86
Seperate base from derived classes for pluginlibs
JafarAbdi 7f57c9d
WIP: Fix bug at task clear
karolyartur ae12189
Fix bug at task clear
karolyartur ff9ab71
Create template class PickPlaceBase
karolyartur 0c8b21b
Return solution properly
karolyartur 10fdb4e
Add Placing
karolyartur 4829734
Add GraspProvider for fixed grasp pose
karolyartur eba5b09
Make Pick container work with Grasp messages
karolyartur 540eb8c
Make Place container work with PlaceLocation messages
karolyartur 02d19e8
Fix PredicateFilter Stage
karolyartur 4b32609
Cleanup
karolyartur a25d171
Cleanup and change name
karolyartur 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 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 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 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 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,98 @@ | ||
/********************************************************************* | ||
* Software License Agreement (BSD License) | ||
* | ||
* Copyright (c) 2016, Kentaro Wada. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* * Neither the name of Willow Garage nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*********************************************************************/ | ||
|
||
/* Author: Henning Kayser, Artur Karoly*/ | ||
|
||
#include "plan_pick_place_capability.h" | ||
|
||
#include <moveit/move_group/capability_names.h> | ||
#include <moveit/robot_state/conversions.h> | ||
|
||
|
||
namespace move_group { | ||
|
||
PlanPickPlaceCapability::PlanPickPlaceCapability() : MoveGroupCapability("PlanPickPlace") {} | ||
|
||
void PlanPickPlaceCapability::initialize() { | ||
// Configure the action server | ||
as_.reset(new actionlib::SimpleActionServer<moveit_task_constructor_msgs::PlanPickPlaceAction>( | ||
root_node_handle_, "plan_pick_place", | ||
std::bind(&PlanPickPlaceCapability::goalCallback, this, std::placeholders::_1), false)); | ||
as_->registerPreemptCallback(std::bind(&PlanPickPlaceCapability::preemptCallback, this)); | ||
as_->start(); | ||
pick_place_task_ = std::make_unique<PickPlaceTask>("pick_place_task"); | ||
} | ||
|
||
void PlanPickPlaceCapability::goalCallback( | ||
const moveit_task_constructor_msgs::PlanPickPlaceGoalConstPtr& goal) { | ||
moveit_task_constructor_msgs::PlanPickPlaceResult result; | ||
|
||
// Fill parameters | ||
PickPlaceTask::Parameters parameters; | ||
parameters.task_type_ = goal->task_type; | ||
parameters.arm_group_name_ = goal->arm_group_name; | ||
parameters.hand_group_name_ = goal->hand_group_name; | ||
parameters.eef_name_ = goal->eef_name; | ||
parameters.hand_frame_ = goal->hand_frame; | ||
parameters.object_name_ = goal->object_id; | ||
parameters.support_surfaces_ = goal->support_surfaces; | ||
parameters.grasps_ = goal->grasps; | ||
parameters.grasp_provider_plugin_name_ = goal->grasp_provider_plugin_name; | ||
tf::poseMsgToEigen(goal->grasp_frame_transform, parameters.grasp_frame_transform_); | ||
|
||
parameters.place_provider_plugin_name_ = goal->place_provider_plugin_name; | ||
parameters.place_locations_ = goal->place_locations; | ||
|
||
// Initialize task and plan | ||
if (pick_place_task_->init(parameters)){ | ||
// Compute plan | ||
result.success = pick_place_task_->plan(); | ||
if (result.success) { | ||
pick_place_task_->getSolutionMsg(result.solution); | ||
} | ||
} else { | ||
result.success = false; | ||
} | ||
// Retrieve and return result | ||
as_->setSucceeded(result); | ||
} | ||
|
||
void PlanPickPlaceCapability::preemptCallback() { | ||
pick_place_task_->preempt(); | ||
} | ||
|
||
} // namespace move_group | ||
|
||
#include <class_loader/class_loader.hpp> | ||
CLASS_LOADER_REGISTER_CLASS(move_group::PlanPickPlaceCapability, move_group::MoveGroupCapability) |
This file contains 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,71 @@ | ||
/********************************************************************* | ||
* Software License Agreement (BSD License) | ||
* | ||
* Copyright (c) 2018, Hamburg University. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* * Neither the name of Hamburg University nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*********************************************************************/ | ||
|
||
/* | ||
* Capability to plan pick and place motions using the MoveIt Task Constructor. | ||
* | ||
* Author: Henning Kayser | ||
* */ | ||
|
||
#pragma once | ||
|
||
#include <moveit/move_group/move_group_capability.h> | ||
#include <actionlib/server/simple_action_server.h> | ||
|
||
#include <moveit_task_constructor_msgs/PlanPickPlaceAction.h> | ||
#include <moveit/task_constructor/tasks/pick_place_task.h> | ||
|
||
#include <memory> | ||
|
||
namespace move_group { | ||
|
||
using moveit::task_constructor::tasks::PickPlaceTask; | ||
|
||
class PlanPickPlaceCapability : public MoveGroupCapability | ||
{ | ||
public: | ||
PlanPickPlaceCapability(); | ||
|
||
virtual void initialize(); | ||
|
||
private: | ||
void goalCallback(const moveit_task_constructor_msgs::PlanPickPlaceGoalConstPtr& goal); | ||
void preemptCallback(); | ||
|
||
std::unique_ptr<actionlib::SimpleActionServer<moveit_task_constructor_msgs::PlanPickPlaceAction>> as_; | ||
|
||
std::unique_ptr<PickPlaceTask> pick_place_task_; | ||
}; | ||
|
||
} // namespace move_group |
This file contains 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 |
---|---|---|
|
@@ -10,6 +10,7 @@ find_package(catkin REQUIRED COMPONENTS | |
moveit_ros_planning_interface | ||
moveit_task_constructor_msgs | ||
roscpp | ||
rosparam_shortcuts | ||
visualization_msgs | ||
rviz_marker_tools | ||
) | ||
|
@@ -18,6 +19,7 @@ catkin_package( | |
LIBRARIES | ||
${PROJECT_NAME} | ||
${PROJECT_NAME}_stages | ||
${PROJECT_NAME}_tasks | ||
INCLUDE_DIRS | ||
include | ||
CATKIN_DEPENDS | ||
|
@@ -43,7 +45,7 @@ add_compile_options(-fvisibility-inlines-hidden) | |
set(PROJECT_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include/moveit/task_constructor) | ||
|
||
add_subdirectory(src) | ||
add_subdirectory(test) | ||
# add_subdirectory(test) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? |
||
|
||
install(DIRECTORY include/ DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION} | ||
PATTERN "*_p.h" EXCLUDE) | ||
|
74 changes: 74 additions & 0 deletions
74
core/include/moveit/task_constructor/stages/grasp_provider.h
This file contains 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,74 @@ | ||
/********************************************************************* | ||
* Software License Agreement (BSD License) | ||
* | ||
* Copyright (c) 2017, Hamburg University | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* * Neither the name of Bielefeld University nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*********************************************************************/ | ||
|
||
/* Authors: Michael Goerner, Artur Karoly | ||
Desc: Grasp provider plugins and default plugin | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <moveit/task_constructor/stages/generate_pose.h> | ||
#include "grasp_provider_base.h" | ||
|
||
namespace moveit { | ||
namespace task_constructor { | ||
namespace stages { | ||
|
||
/// Default Grasp Provider plugin implementing the functionality of the GenerateGraspPose stage | ||
|
||
class GraspProviderDefault : public GraspProviderBase | ||
{ | ||
public: | ||
GraspProviderDefault(const std::string& name = "generate grasp pose"); | ||
|
||
void init(const core::RobotModelConstPtr& robot_model) override; | ||
void compute() override; | ||
}; | ||
|
||
|
||
/// Grasp Provider plugin for setting a set of grasp poses | ||
|
||
class GraspProviderFixedPoses : public GraspProviderBase | ||
{ | ||
public: | ||
GraspProviderFixedPoses(const std::string& name = "set grasp poses"); | ||
|
||
void init(const core::RobotModelConstPtr& robot_model) override; | ||
void compute() override; | ||
}; | ||
|
||
|
||
} // namespace stages | ||
} // namespace task_constructor | ||
} // namespace moveit |
73 changes: 73 additions & 0 deletions
73
core/include/moveit/task_constructor/stages/grasp_provider_base.h
This file contains 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,73 @@ | ||
/********************************************************************* | ||
* Software License Agreement (BSD License) | ||
* | ||
* Copyright (c) 2017, Bielefeld + Hamburg University | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Funny how neither of the authors of this file are from those institutions |
||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials provided | ||
* with the distribution. | ||
* * Neither the name of Bielefeld University nor the names of its | ||
* contributors may be used to endorse or promote products derived | ||
* from this software without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*********************************************************************/ | ||
|
||
/* Authors: Artur Karoly, Jafar Abdi */ | ||
|
||
#ifndef MOVEIT_TASK_CONSTRUCTOR_CORE_GRASP_PROVIDER_BASE_H | ||
#define MOVEIT_TASK_CONSTRUCTOR_CORE_GRASP_PROVIDER_BASE_H | ||
|
||
#include "memory" | ||
#include "moveit/task_constructor/container.h" | ||
#include "grasp_provider_base.h" | ||
|
||
namespace moveit { | ||
namespace task_constructor { | ||
namespace stages { | ||
class GraspProviderBase : public GeneratePose | ||
{ | ||
public: | ||
GraspProviderBase(const std::string& name = "grasp provider"); | ||
|
||
void init(const std::shared_ptr<const moveit::core::RobotModel>& robot_model) override; | ||
|
||
void setEndEffector(const std::string& eef) { setProperty("eef", eef); } | ||
void setObject(const std::string& object) { setProperty("object", object); } | ||
|
||
void setPreGraspPose(const std::string& pregrasp) { properties().set("pregrasp", pregrasp); } | ||
void setPreGraspPose(const ::moveit_msgs::RobotState_<std::allocator<void>>& pregrasp) { | ||
properties().set("pregrasp", pregrasp); | ||
} | ||
void setGraspPose(const std::string& grasp) { properties().set("grasp", grasp); } | ||
void setGraspPose(const ::moveit_msgs::RobotState_<std::allocator<void>>& grasp) { | ||
properties().set("grasp", grasp); | ||
} | ||
|
||
protected: | ||
void onNewSolution(const SolutionBase& s) override; | ||
}; | ||
} // namespace stages | ||
} // namespace task_constructor | ||
} // namespace moveit | ||
#include <moveit/task_constructor/stages/generate_pose.h> | ||
#endif // MOVEIT_TASK_CONSTRUCTOR_CORE_GRASP_PROVIDER_BASE_H |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the author and year.