joint_velocity_controller.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2008, Willow Garage, Inc.
00005  *  Copyright (c) 2012, hiDOF, Inc.
00006  *  All rights reserved.
00007  *
00008  *  Redistribution and use in source and binary forms, with or without
00009  *  modification, are permitted provided that the following conditions
00010  *  are met:
00011  *
00012  *   * Redistributions of source code must retain the above copyright
00013  *     notice, this list of conditions and the following disclaimer.
00014  *   * Redistributions in binary form must reproduce the above
00015  *     copyright notice, this list of conditions and the following
00016  *     disclaimer in the documentation and/or other materials provided
00017  *     with the distribution.
00018  *   * Neither the name of the Willow Garage nor the names of its
00019  *     contributors may be used to endorse or promote products derived
00020  *     from this software without specific prior written permission.
00021  *
00022  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033  *  POSSIBILITY OF SUCH DAMAGE.
00034  *********************************************************************/
00035 
00036 #ifndef EFFORT_CONTROLLERS__JOINT_VELOCITY_CONTROLLER_H
00037 #define EFFORT_CONTROLLERS__JOINT_VELOCITY_CONTROLLER_H
00038 
00062 #include <ros/node_handle.h>
00063 #include <boost/thread/condition.hpp>
00064 #include <boost/scoped_ptr.hpp>
00065 #include <hardware_interface/joint_command_interface.h>
00066 #include <controller_interface/controller.h>
00067 #include <control_msgs/JointControllerState.h>
00068 #include <std_msgs/Float64.h>
00069 #include <control_toolbox/pid.h>
00070 #include <realtime_tools/realtime_publisher.h>
00071 
00072 namespace effort_controllers
00073 {
00074 
00075 class JointVelocityController: public controller_interface::Controller<hardware_interface::EffortJointInterface>
00076 {
00077 public:
00078 
00079   JointVelocityController();
00080   ~JointVelocityController();
00081 
00082   bool init(hardware_interface::EffortJointInterface *robot, const std::string &joint_name, const control_toolbox::Pid &pid);
00083 
00097   bool init(hardware_interface::EffortJointInterface *robot, ros::NodeHandle &n);
00098 
00104   void setCommand(double cmd);
00105 
00109   void getCommand(double & cmd);
00110 
00116   void starting(const ros::Time& time);
00117 
00121   void update(const ros::Time& time, const ros::Duration& period);
00122 
00126   void getGains(double &p, double &i, double &d, double &i_max, double &i_min);
00127 
00131   void printDebug();
00132 
00136   void setGains(const double &p, const double &i, const double &d, const double &i_max, const double &i_min);
00137 
00141   std::string getJointName();
00142   
00143   hardware_interface::JointHandle joint_;
00144   double command_;                                
00146 private:
00147   int loop_count_;
00148   control_toolbox::Pid pid_controller_;           
00150   //friend class JointVelocityControllerNode; // what is this for??
00151 
00152   boost::scoped_ptr<
00153     realtime_tools::RealtimePublisher<
00154       control_msgs::JointControllerState> > controller_state_publisher_ ;
00155 
00156   ros::Subscriber sub_command_;
00157 
00161   void setCommandCB(const std_msgs::Float64ConstPtr& msg);
00162 };
00163 
00164 } // namespace
00165 
00166 #endif


effort_controllers
Author(s): Vijay Pradeep
autogenerated on Fri Aug 28 2015 12:37:06