mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
Create empty plan_pick_place_capability
This commit is contained in:
parent
bf78d46715
commit
916d26db25
@ -8,6 +8,7 @@ find_package(catkin REQUIRED COMPONENTS
|
||||
moveit_core
|
||||
moveit_ros_move_group
|
||||
moveit_task_constructor_msgs
|
||||
moveit_task_constructor_core
|
||||
pluginlib
|
||||
std_msgs
|
||||
)
|
||||
@ -16,6 +17,7 @@ catkin_package(
|
||||
LIBRARIES $PROJECT_NAME}
|
||||
CATKIN_DEPENDS
|
||||
moveit_task_constructor_msgs
|
||||
moveit_task_constructor_core
|
||||
std_msgs
|
||||
)
|
||||
|
||||
@ -25,6 +27,7 @@ include_directories(
|
||||
|
||||
add_library(${PROJECT_NAME}
|
||||
src/execute_task_solution_capability.cpp
|
||||
src/plan_pick_place_capability.cpp
|
||||
)
|
||||
add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS})
|
||||
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
|
||||
|
||||
@ -4,4 +4,10 @@
|
||||
Action server to execute solutions generated through the MoveIt Task Constructor.
|
||||
</description>
|
||||
</class>
|
||||
|
||||
<class name="move_group/PlanPickPlaceCapability" type="move_group::PlanPickPlaceCapability" base_class_type="move_group::MoveGroupCapability">
|
||||
<description>
|
||||
Action server to plan full pick and place motions using the MoveIt Task Constructor.
|
||||
</description>
|
||||
</class>
|
||||
</library>
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
<depend>pluginlib</depend>
|
||||
<depend>std_msgs</depend>
|
||||
<depend>moveit_task_constructor_msgs</depend>
|
||||
<depend>moveit_task_constructor_core</depend>
|
||||
|
||||
<export>
|
||||
<moveit_ros_move_group plugin="${prefix}/capabilities_plugin_description.xml"/>
|
||||
|
||||
74
capabilities/src/plan_pick_place_capability.cpp
Normal file
74
capabilities/src/plan_pick_place_capability.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
/*********************************************************************
|
||||
* 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 */
|
||||
|
||||
#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();
|
||||
ros::NodeHandle nh("~");
|
||||
pick_place_task_ = std::make_unique<PickPlaceTask>("", nh);
|
||||
}
|
||||
|
||||
void PlanPickPlaceCapability::goalCallback(
|
||||
const moveit_task_constructor_msgs::PlanPickPlaceGoalConstPtr& goal) {
|
||||
moveit_task_constructor_msgs::PlanPickPlaceResult result;
|
||||
|
||||
// initialize task
|
||||
// run plan
|
||||
// return result
|
||||
}
|
||||
|
||||
void PlanPickPlaceCapability::preemptCallback() {
|
||||
// TODO(henningkayser): abort planning
|
||||
}
|
||||
|
||||
} // namespace move_group
|
||||
|
||||
#include <class_loader/class_loader.hpp>
|
||||
CLASS_LOADER_REGISTER_CLASS(move_group::PlanPickPlaceCapability, move_group::MoveGroupCapability)
|
||||
71
capabilities/src/plan_pick_place_capability.h
Normal file
71
capabilities/src/plan_pick_place_capability.h
Normal file
@ -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
|
||||
Loading…
Reference in New Issue
Block a user