controller_manager.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2012, Willow Garage, 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 Willow Garage 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: Ioan Sucan */
36 
37 #ifndef MOVEIT_MOVEIT_CONTROLLER_MANAGER_
38 #define MOVEIT_MOVEIT_CONTROLLER_MANAGER_
39 
40 #include <vector>
41 #include <string>
42 #include <moveit_msgs/RobotTrajectory.h>
44 
47 {
50 {
51  enum Value
52  {
60  };
61 
63  {
64  }
65 
66  operator Value() const
67  {
68  return status_;
69  }
70 
71  explicit operator bool() const
72  {
73  return status_ == SUCCEEDED;
74  }
75 
77  std::string asString() const
78  {
79  switch (status_)
80  {
81  case RUNNING:
82  return "RUNNING";
83  case SUCCEEDED:
84  return "SUCCEEDED";
85  case PREEMPTED:
86  return "PREEMPTED";
87  case TIMED_OUT:
88  return "TIMED_OUT";
89  case ABORTED:
90  return "ABORTED";
91  case FAILED:
92  return "FAILED";
93  default:
94  return "UNKNOWN";
95  }
96  }
97 
98 private:
100 };
101 
102 MOVEIT_CLASS_FORWARD(MoveItControllerHandle); // Defines MoveItControllerHandlePtr, ConstPtr, WeakPtr... etc
103 
106 {
107 public:
109  MoveItControllerHandle(const std::string& name) : name_(name)
110  {
111  }
112 
114  {
115  }
116 
118  const std::string& getName() const
119  {
120  return name_;
121  }
122 
128  virtual bool sendTrajectory(const moveit_msgs::RobotTrajectory& trajectory) = 0;
129 
134  virtual bool cancelExecution() = 0;
135 
141  virtual bool waitForExecution(const ros::Duration& timeout = ros::Duration(0)) = 0;
142 
144  virtual ExecutionStatus getLastExecutionStatus() = 0;
145 
146 protected:
147  std::string name_;
148 };
149 
150 MOVEIT_CLASS_FORWARD(MoveItControllerManager); // Defines MoveItControllerManagerPtr, ConstPtr, WeakPtr... etc
151 
158 {
159 public:
163  {
164  ControllerState() : active_(false), default_(false)
165  {
166  }
167 
170  bool active_;
171 
174  bool default_;
175  };
176 
179  {
180  }
181 
183  {
184  }
185 
187  virtual MoveItControllerHandlePtr getControllerHandle(const std::string& name) = 0;
188 
190  virtual void getControllersList(std::vector<std::string>& names) = 0;
191 
196  virtual void getActiveControllers(std::vector<std::string>& names) = 0;
197 
202  virtual void getControllerJoints(const std::string& name, std::vector<std::string>& joints) = 0;
203 
205  virtual ControllerState getControllerState(const std::string& name) = 0;
206 
208  virtual bool switchControllers(const std::vector<std::string>& activate,
209  const std::vector<std::string>& deactivate) = 0;
210 };
211 } // namespace moveit_controller_manager
212 
213 #endif
MoveIt! sends commands to a controller via a handle that satisfies this interface.
std::string asString() const
Convert the execution status to a string.
bool default_
It is often the case that multiple controllers could be used to execute a motion. Marking a controlle...
MoveIt! does not enforce how controllers are implemented. To make your controllers usable by MoveIt...
const std::string & getName() const
Get the name of the controller this handle can send commands to.
bool active_
A controller can be active or inactive. This means that MoveIt! could activate the controller when ne...
MoveItControllerManager()
Default constructor. This needs to have no arguments so that the plugin system can construct the obje...
Each controller known to MoveIt! has a state. This structure describes that controller&#39;s state...
MoveItControllerHandle(const std::string &name)
Each controller has a name. The handle is initialized with that name.
MOVEIT_CLASS_FORWARD(MoveItControllerHandle)
Namespace for the base class of a MoveIt! controller manager.


moveit_core
Author(s): Ioan Sucan , Sachin Chitta , Acorn Pooley
autogenerated on Thu Mar 17 2022 02:51:04