mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
introduce new trivial stage Forward
This can be used together with a custom CostTerm to modify costs of a solution.
This commit is contained in:
parent
0e38730fd4
commit
1689f6cd95
61
core/include/moveit/task_constructor/stages/forward.h
Normal file
61
core/include/moveit/task_constructor/stages/forward.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*********************************************************************
|
||||||
|
* Software License Agreement (BSD License)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020, 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 the copyright holders 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 'v4hn' Goerner */
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <moveit/task_constructor/container.h>
|
||||||
|
#include <moveit/task_constructor/cost_queue.h>
|
||||||
|
#include <geometry_msgs/PoseStamped.h>
|
||||||
|
#include <Eigen/Geometry>
|
||||||
|
|
||||||
|
namespace moveit {
|
||||||
|
namespace task_constructor {
|
||||||
|
namespace stages {
|
||||||
|
|
||||||
|
/** Generic Wrapper that passes on a solution
|
||||||
|
*
|
||||||
|
* Useful to set a custom CostTransform via Stage::setCostTerm
|
||||||
|
* to change a solution's cost without loosing the original value
|
||||||
|
*/
|
||||||
|
class Forward : public WrapperBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Forward(const std::string& name = "Forward", Stage::pointer&& child = Stage::pointer());
|
||||||
|
|
||||||
|
void onNewSolution(const SolutionBase& s) override;
|
||||||
|
};
|
||||||
|
} // namespace stages
|
||||||
|
} // namespace task_constructor
|
||||||
|
} // namespace moveit
|
||||||
@ -5,6 +5,7 @@ add_library(${PROJECT_NAME}_stages
|
|||||||
${PROJECT_INCLUDE}/stages/current_state.h
|
${PROJECT_INCLUDE}/stages/current_state.h
|
||||||
${PROJECT_INCLUDE}/stages/fixed_state.h
|
${PROJECT_INCLUDE}/stages/fixed_state.h
|
||||||
${PROJECT_INCLUDE}/stages/fixed_cartesian_poses.h
|
${PROJECT_INCLUDE}/stages/fixed_cartesian_poses.h
|
||||||
|
${PROJECT_INCLUDE}/stages/forward.h
|
||||||
${PROJECT_INCLUDE}/stages/generate_pose.h
|
${PROJECT_INCLUDE}/stages/generate_pose.h
|
||||||
${PROJECT_INCLUDE}/stages/generate_grasp_pose.h
|
${PROJECT_INCLUDE}/stages/generate_grasp_pose.h
|
||||||
${PROJECT_INCLUDE}/stages/generate_place_pose.h
|
${PROJECT_INCLUDE}/stages/generate_place_pose.h
|
||||||
@ -24,6 +25,7 @@ add_library(${PROJECT_NAME}_stages
|
|||||||
current_state.cpp
|
current_state.cpp
|
||||||
fixed_state.cpp
|
fixed_state.cpp
|
||||||
fixed_cartesian_poses.cpp
|
fixed_cartesian_poses.cpp
|
||||||
|
forward.cpp
|
||||||
generate_pose.cpp
|
generate_pose.cpp
|
||||||
generate_grasp_pose.cpp
|
generate_grasp_pose.cpp
|
||||||
generate_place_pose.cpp
|
generate_place_pose.cpp
|
||||||
|
|||||||
65
core/src/stages/forward.cpp
Normal file
65
core/src/stages/forward.cpp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*********************************************************************
|
||||||
|
* Software License Agreement (BSD License)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020, 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 the copyright holders nor the names of their
|
||||||
|
* 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: Michael 'v4hn' Goerner */
|
||||||
|
|
||||||
|
#include <moveit/task_constructor/stages/forward.h>
|
||||||
|
#include <moveit/task_constructor/storage.h>
|
||||||
|
#include <moveit/task_constructor/marker_tools.h>
|
||||||
|
|
||||||
|
#include <moveit/task_constructor/container_p.h>
|
||||||
|
|
||||||
|
#include <moveit/planning_scene/planning_scene.h>
|
||||||
|
#include <moveit/robot_state/conversions.h>
|
||||||
|
#include <moveit/robot_state/robot_state.h>
|
||||||
|
|
||||||
|
#include <Eigen/Geometry>
|
||||||
|
#include <eigen_conversions/eigen_msg.h>
|
||||||
|
#include <chrono>
|
||||||
|
#include <functional>
|
||||||
|
#include <iterator>
|
||||||
|
#include <ros/console.h>
|
||||||
|
|
||||||
|
namespace moveit {
|
||||||
|
namespace task_constructor {
|
||||||
|
namespace stages {
|
||||||
|
|
||||||
|
Forward::Forward(const std::string& name, Stage::pointer&& child) : WrapperBase(name, std::move(child)) {}
|
||||||
|
|
||||||
|
void Forward::onNewSolution(const SolutionBase& s) {
|
||||||
|
this->liftSolution(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace stages
|
||||||
|
} // namespace task_constructor
|
||||||
|
} // namespace moveit
|
||||||
Loading…
Reference in New Issue
Block a user