moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
planner_logic_interface.h
Go to the documentation of this file.
1/*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2020, PickNik Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of PickNik Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
34
35/* Author: Sebastian Jahr
36 Description: Defines an interface for a planner logic plugin for the hybrid planning manager component node.
37 */
38
39#pragma once
40
41#include <rclcpp/rclcpp.hpp>
42#include <moveit_msgs/msg/move_it_error_codes.hpp>
45
47{
48// Describes the outcome of a reaction to an event in the hybrid planning architecture
50{
51 ReactionResult(const HybridPlanningEvent& planning_event, const std::string& error_msg, const int error_code,
54 {
55 switch (planning_event)
56 {
58 event = "Hybrid planning request received";
59 break;
61 event = "Global planning action successful";
62 break;
64 event = "Global planning action aborted";
65 break;
67 event = "Global planning action canceled";
68 break;
70 event = "Global solution available";
71 break;
73 event = "Local planning action successful";
74 break;
76 event = "Local planning action aborted";
77 break;
79 event = "Local planning action canceled";
80 break;
82 event = "Undefined event";
83 break;
85 event = "Global planning action rejected";
86 break;
88 event = "Local planning action rejected";
89 break;
90 }
91 };
92 ReactionResult(const std::string& event, const std::string& error_msg, const int error_code,
95
96 // Event that triggered the reaction
97 std::string event;
98
99 // Additional error description
100 std::string error_message;
101
102 // Error code
104
105 // Action to that needs to be performed by the HP manager
107};
108
115{
116public:
122 virtual ~PlannerLogicInterface() = default;
123
128 virtual bool initialize()
129 {
130 return true;
131 };
132
138 virtual ReactionResult react(const HybridPlanningEvent& event) = 0;
139
145 virtual ReactionResult react(const std::string& event) = 0;
146};
147} // namespace moveit::hybrid_planning
a wrapper around moveit_msgs::MoveItErrorCodes to make it easier to return an error code message from...
virtual ReactionResult react(const std::string &event)=0
PlannerLogicInterface(const PlannerLogicInterface &)=default
PlannerLogicInterface & operator=(const PlannerLogicInterface &)=default
PlannerLogicInterface(PlannerLogicInterface &&)=default
virtual ReactionResult react(const HybridPlanningEvent &event)=0
PlannerLogicInterface & operator=(PlannerLogicInterface &&)=default
ReactionResult(const HybridPlanningEvent &planning_event, const std::string &error_msg, const int error_code, const HybridPlanningAction &action=HybridPlanningAction::DO_NOTHING)
ReactionResult(const std::string &event, const std::string &error_msg, const int error_code, const HybridPlanningAction &action=HybridPlanningAction::DO_NOTHING)