gravity_compensation.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2014, Fetch Robotics Inc.
5  * Copyright (c) 2013, Unbounded Robotics Inc.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of Unbounded Robotics nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
36 // Author: Michael Ferguson
37 
38 #ifndef ROBOT_CONTROLLERS_GRAVITY_COMPENSATION_H_
39 #define ROBOT_CONTROLLERS_GRAVITY_COMPENSATION_H_
40 
41 #include <string>
42 #include <vector>
43 #include <boost/shared_ptr.hpp>
44 
45 #include <ros/ros.h>
49 
50 #include <urdf/model.h>
52 
53 #include <kdl/tree.hpp>
54 #include <kdl/chain.hpp>
55 #include <kdl/jntarray.hpp>
56 #include <kdl/jntarrayvel.hpp>
57 #include <kdl/chaindynparam.hpp>
58 
59 namespace robot_controllers
60 {
61 
68 {
69 public:
71  virtual ~GravityCompensation() {}
72 
80  virtual int init(ros::NodeHandle& nh, ControllerManager* manager);
81 
87  virtual bool start();
88 
95  virtual bool stop(bool force)
96  {
97  // always allow preemption
98  return true;
99  }
100 
107  virtual bool reset()
108  {
109  // Do nothing
110  return true;
111  }
112 
118  virtual void update(const ros::Time& time, const ros::Duration& dt);
119 
121  virtual std::string getType()
122  {
123  return "robot_controllers/GravityCompensation";
124  }
125 
127  virtual std::vector<std::string> getCommandedNames();
128 
130  virtual std::vector<std::string> getClaimedNames();
131 
132 private:
134  std::vector<JointHandlePtr> joints_;
135 
137 
141 };
142 
143 } // namespace robot_controllers
144 
145 #endif // ROBOT_CONTROLLERS_GRAVITY_COMPENSATION_H_
Controller which uses KDL to compute torque needed for static holding of the chain at the current pos...
virtual void update(const ros::Time &time, const ros::Duration &dt)
This is the update loop for the controller.
virtual std::string getType()
Get the type of this controller.
virtual std::vector< std::string > getClaimedNames()
Get the names of joints/controllers which this controller exclusively claims.
virtual bool stop(bool force)
Stop this controller.
virtual bool reset()
Cleanly reset the controller to it&#39;s initial state. Some controllers may choose to stop themselves...
KDL::Chain kdl_chain_
is KDL structure setup
virtual std::vector< std::string > getCommandedNames()
Get the names of joints/controllers which this controller commands.
boost::shared_ptr< KDL::ChainDynParam > kdl_chain_dynamics_
virtual bool start()
Attempt to start the controller. This should be called only by the ControllerManager instance...
std::vector< JointHandlePtr > joints_
virtual int init(ros::NodeHandle &nh, ControllerManager *manager)
Initialize the controller and any required data structures.


robot_controllers
Author(s): Michael Ferguson
autogenerated on Sun Sep 27 2020 03:22:39