controller_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2016, Fetch Robotics Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Fetch Robotics Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL FETCH ROBOTICS INC. BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 // Author: Michael Ferguson
30 
31 #ifndef ROBOT_CONTROLLERS_INTERFACE_CONTROLLER_MANAGER_H
32 #define ROBOT_CONTROLLERS_INTERFACE_CONTROLLER_MANAGER_H
33 
34 #include <string>
35 #include <ros/ros.h>
37 
38 #include <robot_controllers_msgs/QueryControllerStatesAction.h>
39 
43 
44 namespace robot_controllers
45 {
46 
49 {
51 
52  typedef std::vector<ControllerLoaderPtr> ControllerList;
53  typedef std::vector<JointHandlePtr> JointHandleList;
54 
55 public:
57 
60  {
61  }
62 
70  virtual int init(ros::NodeHandle& nh);
71 
73  virtual int requestStart(const std::string& name);
74 
76  virtual int requestStop(const std::string& name);
77 
79  virtual void update(const ros::Time& time, const ros::Duration& dt);
80 
82  virtual void reset();
83 
86 
91  HandlePtr getHandle(const std::string& name);
92 
99  JointHandlePtr getJointHandle(const std::string& name);
100 
101 private:
103  void execute(const robot_controllers_msgs::QueryControllerStatesGoalConstPtr& goal);
104 
106  void getState(robot_controllers_msgs::QueryControllerStatesResult& result);
107 
109  bool load(const std::string& name);
110 
111  ControllerList controllers_;
112  JointHandleList joints_;
113 
115 };
116 
117 } // namespace robot_controllers
118 
119 #endif // ROBOT_CONTROLLERS_INTERFACE_CONTROLLER_MANAGER_H
virtual void reset()
Reset all controllers.
std::vector< JointHandlePtr > JointHandleList
bool load(const std::string &name)
Load a controller.
virtual int init(ros::NodeHandle &nh)
Startup the controller manager, loading default controllers.
virtual int requestStart(const std::string &name)
Start a controller.
actionlib::SimpleActionServer< robot_controllers_msgs::QueryControllerStatesAction > server_t
HandlePtr getHandle(const std::string &name)
Get the handle associated with a particular joint/controller name.
bool addJointHandle(JointHandlePtr &j)
Add a joint handle.
Base class for a controller manager.
virtual int requestStop(const std::string &name)
Stop a controller.
std::vector< ControllerLoaderPtr > ControllerList
void execute(const robot_controllers_msgs::QueryControllerStatesGoalConstPtr &goal)
Action callback.
void getState(robot_controllers_msgs::QueryControllerStatesResult &result)
Fill in the current state of controllers.
boost::shared_ptr< server_t > server_
JointHandlePtr getJointHandle(const std::string &name)
Get the joint handle associated with a particular joint name.
virtual ~ControllerManager()
Ensure proper shutdown with virtual destructor.
virtual void update(const ros::Time &time, const ros::Duration &dt)
Update active controllers.


robot_controllers_interface
Author(s): Michael Ferguson
autogenerated on Sun Sep 27 2020 03:22:36